Class: CamaleonCms::Admin::Settings::PostTypesController
Instance Method Summary
collapse
#languages, #save_languages, #save_theme, #shortcodes, #site, #site_saved, #test_email, #theme
#ajax, #cama_get_i18n_frontend, #dashboard, #search
Instance Method Details
#create ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 33
def create
@post_type = current_site.post_types.new(@data_term)
if @post_type.save
@post_type.set_field_values(cama_permitted_field_options('PostType')) 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
45
46
47
48
|
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 45
def destroy
flash[:notice] = t('camaleon_cms.admin.post_type.message.deleted') if @post_type.destroy
redirect_to action: :index
end
|
#edit ⇒ Object
18
19
20
|
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 18
def edit
add_breadcrumb I18n.t('camaleon_cms.admin.button.edit')
end
|
#index ⇒ Object
10
11
12
13
14
|
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 10
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
16
|
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 16
def show; end
|
#update ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 22
def update
if @post_type.update(@data_term)
@post_type.set_field_values(cama_permitted_field_options('PostType')) 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
|