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 @cms_layout.save! flash[:notice] = 'Layout created' redirect_to :action => :edit, :id => @cms_layout rescue ActiveRecord::RecordInvalid flash.now[:error] = 'Failed to create layout' render :action => :new end |
#destroy ⇒ Object
37 38 39 40 41 |
# File 'app/controllers/cms_admin/layouts_controller.rb', line 37 def destroy @cms_layout.destroy flash[:notice] = 'Layout 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 @cms_site.cms_layouts.count == 0 @cms_layouts = @cms_site.cms_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 @cms_layout.update_attributes!(params[:cms_layout]) flash[:notice] = 'Layout updated' redirect_to :action => :edit, :id => @cms_layout rescue ActiveRecord::RecordInvalid flash.now[:error] = 'Failed to update layout' render :action => :edit end |