TheRole/TheRoleManagementPanelBootstrap3

View on GitHub
app/views/admin/roles/_sidebar.slim

Summary

Maintainability
Test Coverage
- t_scope = [ :the_role_gui, :roles, :sidebar ]

- content_for :role_sidebar do
  .panel.panel-primary
    .panel-heading
      = t :role_nav, scope: t_scope
    .panel-body
      h4 = link_to raw('← Home'), root_path

  .panel.panel-primary
    .panel-heading
      = t :roles_list, scope: t_scope
    .panel-body

      - (@roles || Role.all).each do |role|
        p
          =<> link_to role.title, edit_admin_role_url(role)
          =<> "(#{role.users.count})"
          =<> link_to admin_role_url(role), method: :delete, title: role.title, data: { confirm: t(:delete_role_confirm, scope: t_scope) }, class: :delete do
            i.icon-remove.glyphicon.glyphicon-remove

      hr

      p.new = link_to t(:new_role, scope: t_scope), new_admin_role_path, class: 'btn btn-xs btn-success'

      hr

      .panel.panel-default
        .panel-heading
          = t(:roles_export, scope: t_scope)
        .panel-body
          = link_to t(:roles_export, scope: t_scope), export_admin_roles_path, class: "btn btn-xs btn-warning"

      .panel.panel-default
        .panel-heading
          = t(:roles_import, scope: t_scope)
        .panel-body
          = form_tag import_admin_roles_path, multipart: true, method: :put do
            .form-group
              = file_field_tag :roles
            .form-group
              = submit_tag t(:roles_import, scope: t_scope), class: "btn btn-xs btn-warning", data: { confirm: t(:roles_import_confirm, scope: t_scope) }