Growstuff/growstuff

View on GitHub
app/views/admin/roles/index.html.haml

Summary

Maintainability
Test Coverage
- content_for :title, "Listing roles"

- content_for :breadcrumbs do
  %li.breadcrumb-item= link_to 'Admin', admin_path
  %li.breadcrumb-item.active= link_to 'Roles', admin_roles_path

- if can? :create, Role
  %p= link_to 'New role', new_admin_role_path, class: 'btn btn-primary'

%table.table.table-striped
  %thead
    %tr
      %th Name
      %th Description
      %th
      %th

  - @roles.each do |role|
    %tr
      %td= role.name
      %td= role.description
      %td
        - if can? :edit, role
          = link_to edit_admin_role_path(role), class: 'btn btn-default btn-xs' do 
            = edit_icon
            = t('.edit')
        - if can?(:destroy, role) && ! role.members.any?
          = link_to admin_role_path(role), method: :delete, data: { confirm: t(:are_you_sure?) }, class: 'btn btn-default btn-xs text-danger' do
            = delete_icon
            = t('.delete')

= will_paginate(@roles)