Class: CamaleonCms::Admin::CategoriesController
- Inherits:
-
CamaleonCms::AdminController
- Object
- CamaleonCms::AdminController
- CamaleonCms::Admin::CategoriesController
- Defined in:
- app/controllers/camaleon_cms/admin/categories_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
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
-
#list ⇒ Object
return html category list used to reload categories list in post editor form.
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/camaleon_cms/admin/categories_controller.rb', line 38 def create data_term = params[:category] @category = @post_type.categories.new(data_term) if @category.save @category.(params[:meta]) @category.set_field_values(params[:field_options]) flash[:notice] = t('camaleon_cms.admin.post_type.message.created') redirect_to action: :index else render 'edit' end end |
#destroy ⇒ Object
56 57 58 59 60 |
# File 'app/controllers/camaleon_cms/admin/categories_controller.rb', line 56 def destroy flash[:notice] = t('camaleon_cms.admin.post_type.message.deleted') if @category.destroy redirect_to action: :index end |
#edit ⇒ Object
23 24 25 |
# File 'app/controllers/camaleon_cms/admin/categories_controller.rb', line 23 def edit t("camaleon_cms.admin.button.edit") end |
#index ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/camaleon_cms/admin/categories_controller.rb', line 14 def index @categories = @post_type.categories @categories = @categories.paginate(:page => params[:page], :per_page => current_site.admin_per_page) hooks_run("list_category", {categories: @categories, post_type: @post_type}) end |
#list ⇒ Object
return html category list used to reload categories list in post editor form
52 53 54 |
# File 'app/controllers/camaleon_cms/admin/categories_controller.rb', line 52 def list render inline: post_type_html_inputs(@post_type, "categories", "categories" , "checkbox" , params[:categories] || [], "categorychecklist", true ) end |
#show ⇒ Object
20 21 |
# File 'app/controllers/camaleon_cms/admin/categories_controller.rb', line 20 def show end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/camaleon_cms/admin/categories_controller.rb', line 27 def update if @category.update(params[:category]) @category.(params[:meta]) @category.set_field_values(params[:field_options]) flash[:notice] = t('camaleon_cms.admin.post_type.message.updated') redirect_to action: :index else render 'edit' end end |