Class: CamaleonCms::Admin::PostTagsController
- Inherits:
-
CamaleonCms::AdminController
- Object
- CamaleonCms::AdminController
- CamaleonCms::Admin::PostTagsController
- Defined in:
- app/controllers/camaleon_cms/admin/post_tags_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
render post tag create form.
-
#destroy ⇒ Object
destroy a post tag.
-
#edit ⇒ Object
render post tag edit form.
- #index ⇒ Object
-
#list ⇒ Object
render a json of post tags of a post type.
-
#show ⇒ Object
render post tag view.
-
#update ⇒ Object
save changes of a post tag.
Instance Method Details
#create ⇒ Object
render post tag create form
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/camaleon_cms/admin/post_tags_controller.rb', line 42 def create data_term = params[:post_tag] @post_tag = @post_type..new(data_term) if @post_tag.save @post_tag.(params[:meta]) if params[:meta].present? @post_tag.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
destroy a post tag
56 57 58 59 |
# File 'app/controllers/camaleon_cms/admin/post_tags_controller.rb', line 56 def destroy flash[:notice] = t('camaleon_cms.admin.post_type.message.deleted') if @post_tag.destroy redirect_to action: :index end |
#edit ⇒ Object
render post tag edit form
25 26 27 |
# File 'app/controllers/camaleon_cms/admin/post_tags_controller.rb', line 25 def edit t("camaleon_cms.admin.button.edit") end |
#index ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/camaleon_cms/admin/post_tags_controller.rb', line 14 def index @post_tags = @post_type. @post_tags = @post_tags.paginate(:page => params[:page], :per_page => current_site.admin_per_page) end |
#list ⇒ Object
render a json of post tags of a post type
62 63 64 65 |
# File 'app/controllers/camaleon_cms/admin/post_tags_controller.rb', line 62 def list @post_tags = @post_type..pluck("name") render json: @post_tags end |
#show ⇒ Object
render post tag view
21 22 |
# File 'app/controllers/camaleon_cms/admin/post_tags_controller.rb', line 21 def show end |
#update ⇒ Object
save changes of a post tag
30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/camaleon_cms/admin/post_tags_controller.rb', line 30 def update if @post_tag.update(params[:post_tag]) @post_tag.(params[:meta]) if params[:meta].present? @post_tag.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 |