TheRole/TheRoleManagementPanelBootstrap3

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

Summary

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

= render partial: 'sidebar'

- content_for :role_main do
  .panel.panel-success
    .panel-heading = raw t(:create, scope: t_scope)

    = render partial: 'the_notification/form', locals: { object: @role }

    .panel-body
      = form_for(@role, url: admin_roles_path, role: :form) do |f|
        label = t(:name, scope: t_scope)
        p = f.text_field :name, class: "form-control"

        label = t(:title, scope: t_scope)
        p = f.text_field :title, class: "form-control"

        label = t(:description, scope: t_scope)
        p = f.text_field :description, class: "form-control"

        - opts = options_for_select Role.all.map{|role| [ role.name, role.id ] }
        - unless opts.empty?
          .form-group
            label = t(:based_on_role, scope: t_scope)
            = f.select :based_on_role, opts, { include_blank: true }, class: "form-control"

        = f.submit t(:create, scope: t_scope), class: "btn btn-success"