Class: CamaleonCms::Admin::Settings::PostTypesController

Inherits:
CamaleonCms::Admin::SettingsController
  • Object
show all
Defined in:
app/controllers/camaleon_cms/admin/settings/post_types_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 28

def create
  @post_type = current_site.post_types.new(@data_term)
  if @post_type.save
    flash[:notice] = t('camaleon_cms.admin.post_type.message.created')
    redirect_to action: :index
  else
    index
  end
end

#destroyObject



38
39
40
41
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 38

def destroy
  flash[:notice] = t('camaleon_cms.admin.post_type.message.deleted') if @post_type.destroy
  redirect_to action: :index
end

#editObject



15
16
17
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 15

def edit
  add_breadcrumb I18n.t("camaleon_cms.admin.button.edit")
end

#indexObject



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

#showObject



12
13
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 12

def show
end

#updateObject



19
20
21
22
23
24
25
26
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 19

def update
  if @post_type.update(@data_term)
    flash[:notice] = t('camaleon_cms.admin.post_type.message.updated')
    redirect_to action: :index
  else
    edit
  end
end