AgileVentures/MetPlus_PETS

View on GitHub
app/views/jobs/show.html.haml

Summary

Maintainability
Test Coverage
- provide(:title, @job.title)

.col-sm-offset-1.col-sm-10
  .links
    .pull-right#job-show-links-id
      - if policy(@job).match_jd_job_seekers?
        = render 'match_jd_job_seekers_form'
      - if pets_user
        - if policy(@job).match_job_seekers?
          = link_to 'Match all job seekers', match_job_seekers_job_path(@job), |
                    class: 'btn btn-info',                                 |
                    data: {confirm: "Search for matching job seekers? " +  |
                                    "(this may take a while)"}             |
        - if @job.active? && policy(@job).revoke?
          = render partial: 'revoke_modal'
          = link_to 'Revoke', '#', class: 'btn btn-danger', id: 'revoke_link',
                   data: { 'job-id' => "#{@job.id}",
                           'job-title' => "#{@job.title}",
                           'job-companyJobId' => "#{@job.company_job_id}" }
        - if policy(@job).update?
          = link_to 'Edit Job', edit_job_path(@job), class: 'btn btn-default'
        - if @resume
          = link_to 'Match against my Résumé', '#', id: 'match_my_resume',
                  class: 'btn btn-primary', data: { job_id: @job.id, job_seeker_id: pets_user.id }

  .clearfix

  = render partial: 'job_info', locals: { job: @job }

  #apply_job
  - if pets_user && @job.active?
    - if User.job_developer?(pets_user)
      = link_to 'Click Here to Submit an Application for Job Seeker', '#',
                class: 'col-sm-offset-4', id: 'jd-apply-button',
                data: { toggle: 'modal', target: '#jdApplyJobModal' }
      = render partial: '/job_applications/jd_apply_job_modal', locals: { job: @job }
      = render partial: '/job_applications/preview_modal', locals: { job: @job }
    - elsif pets_user.job_seeker?
      - if @job.last_application_by_job_seeker(pets_user)
        .panel.panel-primary.center-aligned-div
          .panel-body
            %h5
              You already have an application submitted for this job.
            %h5
              If you want the employer to see a revised version of your résumé
              = link_to 'edit your profile', edit_job_seeker_path(pets_user)
              and upload the revised résumé.

  .clearfix
  - if pets_user.is_a?(CompanyPerson)
    %h3 Applications for this Job
    = render partial: 'job_applications/accept_modal'
    = render partial: 'job_applications/reject_modal'
    = render partial: 'job_applications/process_modal'
    .pagination-div{ id: "applications-job",
                     data: { url: list_applications_path('job-company-person', @job) } }
  - if pets_user && User.job_developer?(pets_user)
    %h3 Applications for this Job
    .pagination-div{ id: "applications-job",
                     data: { url: list_applications_path('job-job-developer', @job) } }
= render partial: 'resume_match_modal'