johnrees/fablabs

View on GitHub
app/views/labs/_employees.html.haml

Summary

Maintainability
Test Coverage
.text-large
  = t(".people", default: "Employees")
- if current_or_null_user.can_update?(lab)
  = link_to "edit", lab_employees_path(lab), id: "edit-employees"

.row.mt-3
  - employees.each do |employee|
    .col-md-4
      .list-item-small-wrapper{itemscope: true, itemtype: "http://data-vocabulary.org/Person"}
        = image_tag employee.user.avatar_url, class: 'list-item-small-image'
        .list-item-small-content
          = link_to employee.user, class: 'text-medium' do
            %span.first_name{itemprop: "givenName"}= employee.user.first_name
            %span.last_name{itemprop: "familyName"}= employee.user.last_name
          .text-small{itemprop: "jobTitle"}= employee.job_title

.container.mt-3.mb-3
  .row
    - if current_user
      - if current_user.applied_to?(@lab) and !current_user.employed_by?(@lab)
        = link_to new_lab_employee_path(@lab), class: 'btn disabled btn-default' do
          = icon "check-square"
          = t(".applied", default: "Applied")
      - elsif current_user.can_create? @lab.employees.build
        = link_to new_lab_employee_path(@lab), class: 'btn btn-primary' do
          = icon "check-square"
          = t(".i_work_here", default: "I work here")
    - else
      = link_to new_lab_employee_path(@lab), class: 'btn btn-primary' do
        = icon "check-square"
        = t(".i_work_here", default: "I work here")