Class: CmsAdmin::MenusController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/cms_admin/menus_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
# File 'app/controllers/cms_admin/menus_controller.rb', line 18

def create
  @menu.save!
  flash[:success] = I18n.t('cms.menus.created')
  redirect_to :action => :index
  rescue ActiveRecord::RecordInvalid
    logger.detailed_error($!)
    flash.now[:error] = I18n.t('cms.menus.creation_failure')
    render :action => :new
end

#destroyObject



38
39
40
41
42
# File 'app/controllers/cms_admin/menus_controller.rb', line 38

def destroy
  @menu.destroy
  flash[:success] = I18n.t('cms.menus.deleted')
  redirect_to :action => :index
end

#editObject



14
15
16
# File 'app/controllers/cms_admin/menus_controller.rb', line 14

def edit
  render
end

#indexObject



5
6
7
8
# File 'app/controllers/cms_admin/menus_controller.rb', line 5

def index
  return redirect_to :action => :new if @site.menus.count == 0
  @menus = @site.menus
end

#newObject



10
11
12
# File 'app/controllers/cms_admin/menus_controller.rb', line 10

def new
  render
end

#updateObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/cms_admin/menus_controller.rb', line 28

def update
  @menu.update_attributes!(params[:menu])
  flash[:success] = I18n.t('cms.menus.updated')
  redirect_to :action => :index, :id => @menu
rescue ActiveRecord::RecordInvalid
  logger.detailed_error($!)
  flash.now[:error] = I18n.t('cms.menus.update_failure')
  render :action => :index
end