Class: Spina::Admin::Conferences::Blog::CategoriesController
- Inherits:
-
AdminController
- Object
- AdminController
- Spina::Admin::Conferences::Blog::CategoriesController
- Defined in:
- app/controllers/spina/admin/conferences/blog/categories_controller.rb
Overview
Spina::Admin::Conferences::Blog::CategoriesController
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/spina/admin/conferences/blog/categories_controller.rb', line 26 def create @category = Spina::Admin::Conferences::Blog::Category.new category_params if @category.save redirect_to spina.edit_admin_conferences_blog_category_url(@category.id), notice: t('spina.blog.categories.saved') else I18n.t('spina.blog.categories.new') render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
54 55 56 57 |
# File 'app/controllers/spina/admin/conferences/blog/categories_controller.rb', line 54 def destroy @category.destroy redirect_to spina.admin_conferences_blog_categories_path end |
#edit ⇒ Object
37 38 39 40 |
# File 'app/controllers/spina/admin/conferences/blog/categories_controller.rb', line 37 def edit @category.name render layout: 'spina/admin/admin' end |
#index ⇒ Object
16 17 18 |
# File 'app/controllers/spina/admin/conferences/blog/categories_controller.rb', line 16 def index @categories = Spina::Admin::Conferences::Blog::Category.order(:name) end |
#new ⇒ Object
20 21 22 23 24 |
# File 'app/controllers/spina/admin/conferences/blog/categories_controller.rb', line 20 def new @category = Spina::Admin::Conferences::Blog::Category.new I18n.t('spina.blog.categories.new') render layout: 'spina/admin/admin' end |
#update ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/spina/admin/conferences/blog/categories_controller.rb', line 42 def update @category.name if @category.update(category_params) @category.name redirect_to spina.edit_admin_conferences_blog_category_url( @category.id, params: { locale: @locale } ), notice: t('spina.blog.categories.saved') else render :edit, status: :unprocessable_entity end end |