app/views/admin/roles/_role.slim
- t_scope = [ :the_role_gui, :roles, :role ]
- content_for :role_update_btn_set do
.btn-group
a.btn.btn-warning
i.icon-repeat.glyphicon.glyphicon-repeat
a.btn.btn-success
i.icon-ok.glyphicon.glyphicon-ok
- content_for :role_main do
ruby:
hidden = 'visibility:hidden'
.panel.panel-primary
.panel-heading
= t(:role_info, scope: t_scope)
= link_to t(:role_export, scope: t_scope), role_export_admin_role_path(role), class: "btn btn-xs btn-warning pull-right the_role-btn_export"
.panel-body
= form_for(role, url: change_admin_role_path(role), html: { class: "form-inline" } ) do |f|
.row
.col-md-12
h3.holder(style='margin: 3px')
= t(:role_name, scope: t_scope) + ':'
span.a =<> role.name
span.b(style=hidden)
.form-group<>
= f.text_field :name, class: "form-control"
= yield(:role_update_btn_set)
h5.holder style='margin: 3px'
= t(:title, scope: t_scope) + ':'
span.a =<> role.title
span.b(style=hidden)
.form-group<>
= f.text_field :title, class: "form-control"
= yield(:role_update_btn_set)
h5.holder style='margin: 3px'
= t(:role_description, scope: t_scope) + ':'
span.a =<> role.description
span.b(style=hidden)
.form-group<>
= f.text_field :description, class: "form-control"
= yield(:role_update_btn_set)
.panel.panel-primary
.panel-heading
= t(:role_rules, scope: t_scope)
.panel-body
- role.to_hash.each_pair do |section, rules|
.panel.panel-info
.panel-heading
.row
.col-md-9
h5 = section
.col-md-3
.delete
.btn-group
= button_to t(:delete_section, scope: t_scope), admin_role_section_path(role, section), method: :delete, class: 'btn btn-danger', data: { confirm: t(:section_delete_confirm, scope: t_scope) }
.panel-body
.rules
- rules.each_pair do |rule, value|
.row
.col-md-9
h4
| →
=<> rule
.col-md-3
.controls
- klass = value ? :success : :info
- state = value ? t(:enabled, scope: t_scope) : t(:disabled, scope: t_scope)
.btn-group
button(class="btn btn-#{klass}") = state
button(class="btn btn-#{klass} dropdown-toggle", data={toggle: :dropdown})
span
span.caret
span
ul.dropdown-menu
li.success = link_to t(:enable, scope: t_scope), rule_on_admin_role_section_path(role, section, :name => rule), :method => :put
li.info = link_to t(:disable, scope: t_scope), rule_off_admin_role_section_path(role, section, :name => rule), :method => :put
li.divider
li.error = link_to t(:delete_rule, scope: t_scope), destroy_rule_admin_role_section_path(role, section, :name => rule), method: :delete, data: { confirm: t(:rule_delete_confirm, scope: t_scope) }
.panel.panel-success
.panel-heading
= t(:create_section, scope: t_scope)
.panel-body
= form_tag admin_role_sections_path(role), class: "form-inline"do |f|
.form-group
= text_field_tag :section_name, '', class: "form-control", placeholder: t(:new_section_placeholder, scope: t_scope)
=<> submit_tag t(:create_section, scope: t_scope), class: "btn btn-success"
.panel.panel-success
.panel-heading
= t(:create_rule, scope: t_scope)
.panel-body
= form_tag create_rule_admin_role_sections_path(role), role: :form, class: "form-inline" do |f|
.form-group<>
select.form-control(name='section_name')
- role.to_hash.each_pair do |section, rules|
option(value=section)= section
.form-group
=<> text_field_tag :rule_name, '', class: "form-control", placeholder: t(:new_rule_placeholder, scope: t_scope)
=<> submit_tag t(:create_rule, scope: t_scope), class: "btn btn-success"