Class: Admin::RoleSectionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::RoleSectionsController
- Includes:
- TheRole::Controller
- Defined in:
- app/controllers/admin/role_sections_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #create_rule ⇒ Object
- #destroy ⇒ Object
- #destroy_rule ⇒ Object
- #rule_off ⇒ Object
- #rule_on ⇒ Object
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/admin/role_sections_controller.rb', line 12 def create if @role.create_section params[:section_name] flash[:notice] = t(:section_created, scope: t_scope) else flash[:error] = t(:section_not_created, scope: t_scope) end redirect_to_edit end |
#create_rule ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/admin/role_sections_controller.rb', line 22 def create_rule if @role.create_rule params[:section_name], params[:rule_name] flash[:notice] = t(:section_rule_created, scope: t_scope) else flash[:error] = t(:section_rule_not_created, scope: t_scope) end redirect_to_edit end |
#destroy ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/admin/role_sections_controller.rb', line 62 def destroy section_name = params[:id] if @role.delete_section section_name flash[:notice] = t(:section_deleted, scope: t_scope) else flash[:error] = t(:section_not_deleted, scope: t_scope) end redirect_to_edit end |
#destroy_rule ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/admin/role_sections_controller.rb', line 52 def destroy_rule if @role.delete_rule @section_name, @rule_name flash[:notice] = t(:section_rule_deleted, scope: t_scope) else flash[:error] = t(:section_rule_not_deleted, scope: t_scope) end redirect_to_edit end |
#rule_off ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/admin/role_sections_controller.rb', line 42 def rule_off if @role.rule_off @section_name, @rule_name flash[:notice] = t(:section_rule_off, scope: t_scope) else flash[:error] = t(:state_not_changed, scope: t_scope) end redirect_to_edit end |
#rule_on ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/admin/role_sections_controller.rb', line 32 def rule_on if @role.rule_on @section_name, @rule_name flash[:notice] = t(:section_rule_on, scope: t_scope) else flash[:error] = t(:state_not_changed, scope: t_scope) end redirect_to_edit end |