Class: CamaleonCms::Admin::Settings::PostTypesController
- Inherits:
-
CamaleonCms::Admin::SettingsController
- Object
- CamaleonCms::Admin::SettingsController
- CamaleonCms::Admin::Settings::PostTypesController
- Defined in:
- app/controllers/camaleon_cms/admin/settings/post_types_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 30 def create @post_type = current_site.post_types.new(@data_term) if @post_type.save @post_type.set_field_values(params.require(:field_options).permit!) if params[:field_options].present? hooks_run("created_post_type", {post_type: @post_type}) flash[:notice] = t('camaleon_cms.admin.post_type.message.created') redirect_to action: :index else index end end |
#destroy ⇒ Object
42 43 44 45 |
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 42 def destroy flash[:notice] = t('camaleon_cms.admin.post_type.message.deleted') if @post_type.destroy redirect_to action: :index end |
#edit ⇒ Object
15 16 17 |
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 15 def edit I18n.t("camaleon_cms.admin.button.edit") end |
#index ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 6 def index @post_types = current_site.post_types @post_types = @post_types.paginate(:page => params[:page], :per_page => current_site.admin_per_page) render "index" end |
#show ⇒ Object
12 13 |
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 12 def show end |
#update ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 19 def update if @post_type.update(@data_term) @post_type.set_field_values(params.require(:field_options).permit!) if params[:field_options].present? hooks_run("updated_post_type", {post_type: @post_type}) flash[:notice] = t('camaleon_cms.admin.post_type.message.updated') redirect_to action: :index else edit end end |