AgileVentures/MetPlus_PETS

View on GitHub
app/views/agency_people/home.html.haml

Summary

Maintainability
Test Coverage
- provide(:person_home_active, 'active')

.row
  .col-sm-10.col-sm-offset-1.agency-people-home
    .pull-right
      = link_to 'Add Job Seeker', new_job_seeker_path,
                class: 'btn btn-primary btn-xs',
                style: 'margin-bottom: -20px; margin-top: 5 px;'
  .col-sm-10.col-sm-offset-1.tasks.margin-top
    .panel.with-nav-tabs.panel-success
      .panel-heading
        %ul.nav.nav-tabs.agency-person-task-tabs
          - if @agency_person.agency_admin?(@agency)
            %li
              %a{ href: '#tab1',
                  data: { target: '.tasks #tab1', toggle: 'pill' } }
                Unassigned Tasks
          %li.active.in
            %a{ href: '#tab2',
                data: { target: '.tasks #tab2', toggle: 'pill' } }
              Your Open Tasks
          - if @agency_person.agency_admin?(@agency)
            %li
              %a{ href: '#tab3',
                  data: { target: '.tasks #tab3', toggle: 'pill' } }
                All Open Tasks
          %li
            %a{ href: '#tab4',
                data: { target: '.tasks #tab4', toggle: 'pill' } }
              - if @agency_person.agency_admin?(@agency)
                All Closed Tasks
              - if !@agency_person.agency_admin?(@agency)
                Your Closed Tasks
      .panel-body
        .tab-content
          - if @agency_person.agency_admin?(@agency)
            .tab-pane#tab1
              = render partial: 'tasks/tasks_structure',
                                :locals => { task_type: @agency_new }
          .tab-pane.active#tab2
            = render partial: 'tasks/tasks_structure',
                              :locals => { task_type: @task_type }
          - if @agency_person.agency_admin?(@agency)
            .tab-pane#tab3
              = render partial: 'tasks/tasks_structure',
                                :locals => { task_type: @agency_all }
          .tab-pane#tab4
            = render partial: 'tasks/tasks_structure',
                              :locals => { task_type: @agency_closed }
      .clearfix
.row
  .col-sm-10.col-sm-offset-1.agency-people-home
    - if @agency_person.job_developer?(@agency) && @agency_person.case_manager?(@agency)
      %ul.nav.nav-pills.custom-pills
        %li.active
          %a{ href: '#',
              data: { target: '.agency-people-home #js-as-jd', toggle: 'pill' } }
            Your Job Seekers (as JD)
        %li
          %a{ href: '#',
              data: { target: '.agency-people-home #js-as-cm', toggle: 'pill' } }
            Your Job Seekers (as CM)
        %li
          %a{ href: '#',
              data: { target: '.agency-people-home #js-without-jd', toggle: 'pill' } }
            Job Seekers without a JD
        %li
          %a{ href: '#',
              data: { target: '.agency-people-home #js-without-cm', toggle: 'pill' } }
            Job Seekers without a CM
    - elsif @agency_person.job_developer?(@agency)
      %ul.nav.nav-pills.custom-pills
        %li.active
          %a{ href: '#',
              data: { target: '.agency-people-home #jd-js-as-jd', toggle: 'pill' } }
            Your Job Seekers (as JD)
        %li
          %a{ href: '#',
              data: { target: '.agency-people-home #jd-js-without-jd', toggle: 'pill' } }
            Job Seekers without a JD
    - elsif @agency_person.case_manager?(@agency)
      %ul.nav.nav-pills.custom-pills
        %li.active
          %a{ href: '#',
              data: { target: '.agency-people-home #cm-js-as-cm', toggle: 'pill' } }
            Your Job Seekers (as CM)
        %li
          %a{ href: '#',
              data: { target: '.agency-people-home #cm-js-without-cm', toggle: 'pill' } }
            Job Seekers without a CM
    .tab-content.tab-content-margin
      - if @agency_person.job_developer?(@agency) && @agency_person.case_manager?(@agency)
        .tab-pane.fade.in.active#js-as-jd
          - if @your_jobseekers_jd.empty?
            %i There are no job seekers assigned to you yet.
          - else
            .pagination-div{ id: "agency_person-#{@people_type_jd}",
            data: { url: list_js_jd_agency_people_path(@agency_person.id,@people_type_jd) } }
        .tab-pane.fade#js-as-cm
          - if @your_jobseekers_cm.empty?
            %i There are no job seekers assigned to you yet.
          - else
            .pagination-div{ id: "agency_person-#{@people_type_cm}",
            data: { url: list_js_cm_agency_people_path(@agency_person.id,@people_type_cm) } }
        .tab-pane.fade#js-without-jd
          - if @js_without_jd.empty?
            %i All job seekers have a Job Developer at the moment.
          - else
            .pagination-div{ id: "agency_person-#{@people_type_without_jd}",
             data: { url: list_js_without_jd_agency_people_path(@agency_person.id,@people_type_without_jd) } }
        .tab-pane.fade#js-without-cm
          - if @js_without_cm.empty?
            %i All job seekers have a Case Manager at the moment.
          - else
            .pagination-div{ id: "agency_person-#{@people_type_without_cm}",
             data: { url: list_js_without_cm_agency_people_path(@agency_person.id,@people_type_without_cm) } }
      - if @agency_person.job_developer?(@agency)
        .tab-pane.fade.in.active#jd-js-as-jd
          - if @your_jobseekers_jd.empty?
            %i There are no job seekers assigned to you yet.
          - else
            .pagination-div{ id: "agency_person-#{@people_type_jd}",
             data: { url: list_js_jd_agency_people_path(@agency_person.id,@people_type_jd) } }
        .tab-pane.fade#jd-js-without-jd
          - if @js_without_jd.empty?
            %i All job seekers have a Job Developer at the moment.
          - else
            .pagination-div{ id: "agency_person-#{@people_type_without_jd}",
             data: { url: list_js_without_jd_agency_people_path(@agency_person.id,@people_type_without_jd) } }
      - if @agency_person.case_manager?(@agency)
        .tab-pane.fade.in.active#cm-js-as-cm
          - if @your_jobseekers_cm.empty?
            %i There are no job seekers assigned to you yet.
          - else
            .pagination-div{ id: "agency_person-#{@people_type_cm}",
            data: { url: list_js_cm_agency_people_path(@agency_person.id,@people_type_cm) } }
        .tab-pane.fade#cm-js-without-cm
          - if @js_without_cm.empty?
            %i All job seekers have a Case Manager at the moment.
          - else
            .pagination-div{ id: "agency_person-#{@people_type_without_cm}",
             data: { url: list_js_without_cm_agency_people_path(@agency_person.id,@people_type_without_cm) } }