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

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

Overview

Camaleon CMS is a content management system

Copyright (C) 2015 by Owen Peredo Diaz
Email: [email protected]
This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the  GNU Affero General Public License (GPLv3) for more details.

Instance Method Summary collapse

Instance Method Details

#createObject


36
37
38
39
40
41
42
43
44
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 36

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


46
47
48
49
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 46

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

#editObject


23
24
25
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 23

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

#indexObject


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

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


20
21
# File 'app/controllers/camaleon_cms/admin/settings/post_types_controller.rb', line 20

def show
end

#updateObject


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

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