.well %h3 %b Role name: = role.name %h5 %b Title: = role.title %p.description %b Description of role: = role.description - role.to_hash.each_pair do |section, rules| .section %h3= section .delete .btn-group = button_to 'Delete section', admin_role_section_path(role, section), :method => :delete, :class => 'btn btn-danger', :confirm => 'Are you sure?' - rules.each_pair do |rule, value| .rule %h4 → = rule .controls .btn-group - klass = value ? :success : :info - state = value ? :Enable : :Disable %button{ :class => "btn btn-#{klass}" }= state %button{ :class => "btn btn-#{klass} dropdown-toggle", 'data-toggle' => :dropdown } %span.caret %ul.dropdown-menu %li.success= link_to 'Enable', rule_on_admin_role_section_path(role, section, :name => rule), :method => :put %li.info= link_to 'Disable', rule_off_admin_role_section_path(role, section, :name => rule), :method => :put %li.divider %li.error= link_to 'Delete rule', destroy_rule_admin_role_section_path(role, section, :name => rule), :method => :delete, :confirm => 'Are you sure?' %h4 Create new section = form_tag admin_role_sections_path(role), :class => 'well form-inline' do |f| = text_field_tag :section_name, '', :class => 'input-xlarge', :placeholder => "New Section Name" = submit_tag 'Create Section', :class => :btn %h4 Create new rule = form_tag create_rule_admin_role_sections_path(role), :class => 'well form-inline' do |f| %select.span3{ :name => :section_name } - role.to_hash.each_pair do |section, rules| %option{ :value => section }= section = text_field_tag :rule_name, '', :class => 'input-large', :placeholder => "New Rule Name" = submit_tag 'Create Rule', :class => :btn