Class: CamaleonCms::Admin::UserRolesController
- Inherits:
-
CamaleonCms::AdminController
- Object
- CamaleonCms::AdminController
- CamaleonCms::Admin::UserRolesController
- Defined in:
- app/controllers/camaleon_cms/admin/user_roles_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
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/camaleon_cms/admin/user_roles_controller.rb', line 29 def create user_role_data = params[:user_role] @user_role = current_site.user_roles.new(user_role_data) if @user_role.save @user_role.("_post_type_#{current_site.id.to_s}", defined?(params[:rol_values][:post_type]) ? params[:rol_values][:post_type] : {}) @user_role.("_manager_#{current_site.id.to_s}", defined?(params[:rol_values][:post_type]) ? params[:rol_values][:manager] : {}) flash[:notice] = t('camaleon_cms.admin.users.message.rol_created') redirect_to action: :edit, id: @user_role.id else new end end |
#destroy ⇒ Object
58 59 60 61 62 |
# File 'app/controllers/camaleon_cms/admin/user_roles_controller.rb', line 58 def destroy @user_role.destroy flash[:notice] = t('camaleon_cms.admin.users.message.rol_deleted') redirect_to action: :index end |
#edit ⇒ Object
42 43 44 45 |
# File 'app/controllers/camaleon_cms/admin/user_roles_controller.rb', line 42 def edit I18n.t("camaleon_cms.admin.button.edit") render 'form' end |
#index ⇒ Object
15 16 17 18 |
# File 'app/controllers/camaleon_cms/admin/user_roles_controller.rb', line 15 def index @user_roles = current_site.user_roles @user_roles = @user_roles.paginate(:page => params[:page], :per_page => current_site.admin_per_page) end |
#new ⇒ Object
23 24 25 26 27 |
# File 'app/controllers/camaleon_cms/admin/user_roles_controller.rb', line 23 def new I18n.t("camaleon_cms.admin.button.new") @user_role ||= current_site.user_roles.new render 'form' end |
#show ⇒ Object
20 21 |
# File 'app/controllers/camaleon_cms/admin/user_roles_controller.rb', line 20 def show end |
#update ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/camaleon_cms/admin/user_roles_controller.rb', line 47 def update if @user_role.editable? && @user_role.update(params[:user_role]) @user_role.("_post_type_#{current_site.id.to_s}", defined?(params[:rol_values][:post_type]) ? params[:rol_values][:post_type] : {}) @user_role.("_manager_#{current_site.id.to_s}", defined?(params[:rol_values][:post_type]) ? params[:rol_values][:manager] : {}) flash[:notice] = t('camaleon_cms.admin.users.message.rol_updated') redirect_to action: :edit, id: @user_role.id else edit end end |