fablabbcn/fablabs

View on GitHub
app/views/backstage/employees/index.html.haml

Summary

Maintainability
Test Coverage
= render "backstage/header"

.container
  .row
    .col-lg-12
      = title "Employees"

      .well
        = search_form_for [:backstage, @q], builder: SimpleForm::FormBuilder do |f|
          .row
            .col-lg-3= f.input :user_first_name_cont, label: "First Name"
            .col-lg-3= f.input :user_last_name_cont, label: 'Last name'
            .col-lg-3= f.input :user_username_cont, label: 'Username'
            .col-lg-3= f.input :user_email_cont, label: 'Email'
          .row
            .col-lg-3
              = f.input :user_country_code_eq, as: 'country', label: 'Country', iso_codes: true, include_blank: 'ALL'
            .col-lg-3
              = f.input :user_workflow_state_eq, collection: User.workflow_spec.state_names, label: "State", include_blank: 'ALL'
            .col-lg-3
              = f.input :user_roles_name_eq, collection: Role::AVAILABLE, include_blank: 'ALL'
            .col-lg-3.m-auto
              = f.submit "Filter", class: 'btn btn-primary'



      = page_entries_info @employees
      %table.table
        %thead
          %tr
            %th ID
            %th Name
            %th Role
            %th Lab
            %th Applied
        %tbody
          - @employees.each do |employee|
            - if employee.user.present?
              = content_tag_for :tr, employee, {class: employee.current_state} do
                %td= employee.id
                %td= link_to employee.user.full_name, lab_employees_url(employee.lab)
                %td= employee.job_title
                %td= link_to employee.lab, employee.lab
                %td= employee.created_at.to_s(:short)

      = paginate @employees, theme: 'twitter-bootstrap-4', nav_class: "m-auto pt-3"