Class: CmsAdmin::LayoutsController
- Inherits:
-
BaseController
- Object
- BaseController
- CmsAdmin::LayoutsController
- Defined in:
- app/controllers/cms_admin/layouts_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/controllers/cms_admin/layouts_controller.rb', line 19 def create @layout.save! flash[:notice] = I18n.t('cms.layouts.created') redirect_to :action => :edit, :id => @layout rescue ActiveRecord::RecordInvalid flash.now[:error] = I18n.t('cms.layouts.creation_failure') render :action => :new end |
#destroy ⇒ Object
37 38 39 40 41 |
# File 'app/controllers/cms_admin/layouts_controller.rb', line 37 def destroy @layout.destroy flash[:notice] = I18n.t('cms.layouts.deleted') redirect_to :action => :index end |
#edit ⇒ Object
15 16 17 |
# File 'app/controllers/cms_admin/layouts_controller.rb', line 15 def edit render end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/cms_admin/layouts_controller.rb', line 6 def index return redirect_to :action => :new if @site.layouts.count == 0 @layouts = @site.layouts.roots end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/cms_admin/layouts_controller.rb', line 11 def new render end |
#update ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'app/controllers/cms_admin/layouts_controller.rb', line 28 def update @layout.update_attributes!(params[:layout]) flash[:notice] = I18n.t('cms.layouts.updated') redirect_to :action => :edit, :id => @layout rescue ActiveRecord::RecordInvalid flash.now[:error] = I18n.t('cms.layouts.update_failure') render :action => :edit end |