Class: EtabliocmsActualities::Admin::CategoriesController
- Inherits:
-
EtabliocmsCore::Admin::BaseController
- Object
- EtabliocmsCore::Admin::BaseController
- EtabliocmsActualities::Admin::CategoriesController
- Defined in:
- app/controllers/etabliocms_actualities/admin/categories_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/etabliocms_actualities/admin/categories_controller.rb', line 9 def create @category = Category.new(params[:category]) if @category.save flash[:notice] = t('category.created') redirect_to :action => 'index' else render :action => 'new' end end |
#destroy ⇒ Object
33 34 35 36 37 |
# File 'app/controllers/etabliocms_actualities/admin/categories_controller.rb', line 33 def destroy Category.find(params[:id]).destroy flash[:notice] = t('category.destroyed') redirect_to :action => 'index' end |
#edit ⇒ Object
19 20 21 |
# File 'app/controllers/etabliocms_actualities/admin/categories_controller.rb', line 19 def edit @category = Category.find(params[:id]) end |
#move ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/etabliocms_actualities/admin/categories_controller.rb', line 39 def move @category = Category.find(params[:id]) if ["move_lower", "move_higher", "move_to_top", "move_to_bottom"].include?(params[:method]) @category.send(params[:method]) flash[:notice] = t('category.moved') else flash[:notice] = t('category.not_moved') end redirect_to :action => 'index' end |
#new ⇒ Object
5 6 7 |
# File 'app/controllers/etabliocms_actualities/admin/categories_controller.rb', line 5 def new @category = Category.new end |
#update ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/etabliocms_actualities/admin/categories_controller.rb', line 23 def update @category = Category.find(params[:id]) if @category.update_attributes(params[:category]) flash[:notice] = t('category.updated') redirect_to :action => 'index' else render :action => 'edit' end end |