Class: CamaleonCms::Admin::Appearances::Widgets::MainController
- Inherits:
-
CamaleonCms::AdminController
- Object
- CamaleonCms::AdminController
- CamaleonCms::Admin::Appearances::Widgets::MainController
- Defined in:
- app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb', line 20 def create params[:widget_main][:status] = "simple" @widget = current_site..new(params.require(:widget_main).permit!) if @widget.save! flash[:notice] = t('camaleon_cms.admin.widgets.message.created') else flash[:error] = t('camaleon_cms.admin.widgets.message.error_created') end redirect_to action: :index end |
#destroy ⇒ Object
40 41 42 43 44 |
# File 'app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb', line 40 def destroy @widget = @widget.destroy! flash[:notice] = t('camaleon_cms.admin.widgets.message.deleted') redirect_to action: :index end |
#edit ⇒ Object
16 17 18 |
# File 'app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb', line 16 def edit new end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb', line 7 def index @widgets = current_site. end |
#new ⇒ Object
11 12 13 14 |
# File 'app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb', line 11 def new @widget ||= current_site..new render "form", layout: false end |
#update ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/controllers/camaleon_cms/admin/appearances/widgets/main_controller.rb', line 31 def update if @widget.update!(params.require(:widget_main).permit!) flash[:notice] = t('camaleon_cms.admin.widgets.message.updated') else flash[:error] = t('camaleon_cms.admin.widgets.message.error_updated') end redirect_to action: :index end |