Class: Comfy::Admin::Cms::LayoutsController
- Inherits:
-
BaseController
- Object
- BaseController
- Comfy::Admin::Cms::LayoutsController
- Includes:
- ReorderAction
- Defined in:
- app/controllers/comfy/admin/cms/layouts_controller.rb
Instance Method Summary collapse
Methods included from ReorderAction
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/comfy/admin/cms/layouts_controller.rb', line 25 def create @layout.save! flash[:success] = I18n.t("comfy.admin.cms.layouts.created") redirect_to action: :edit, id: @layout rescue ActiveRecord::RecordInvalid flash.now[:danger] = I18n.t("comfy.admin.cms.layouts.creation_failure") render action: :new end |
#destroy ⇒ Object
43 44 45 46 47 |
# File 'app/controllers/comfy/admin/cms/layouts_controller.rb', line 43 def destroy @layout.destroy flash[:success] = I18n.t("comfy.admin.cms.layouts.deleted") redirect_to action: :index end |
#edit ⇒ Object
21 22 23 |
# File 'app/controllers/comfy/admin/cms/layouts_controller.rb', line 21 def edit render end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/comfy/admin/cms/layouts_controller.rb', line 12 def index return redirect_to action: :new if @site.layouts.count.zero? @layouts = @site.layouts.roots.order(:position) end |
#new ⇒ Object
17 18 19 |
# File 'app/controllers/comfy/admin/cms/layouts_controller.rb', line 17 def new render end |
#update ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/controllers/comfy/admin/cms/layouts_controller.rb', line 34 def update @layout.update!(layout_params) flash[:success] = I18n.t("comfy.admin.cms.layouts.updated") redirect_to action: :edit, id: @layout rescue ActiveRecord::RecordInvalid flash.now[:danger] = I18n.t("comfy.admin.cms.layouts.update_failure") render action: :edit end |