app/views/jobs/index.html.haml
.container-fluid.border-bottom.mb-5
= search_form_for @q do |f|
.row
.col-md-2.border-right.text-center.py-4
= title t '.title'
.col-md-8.border-right.py-4
.row
.col-lg-4
= f.label :title_or_description_or_tags_name_cont, 'Title or description'
= f.search_field :title_or_description_or_tags_name_cont, placeholder: 'Search jobs', class: 'form-control mb-3'
.col-lg-4.mb-3
= f.label :country_code_eq, 'Filter by country'
= f.select(:country_code_eq, options_for_select(@countries.map { |a,b| [a, b]}, params[:q] ? params[:q][:country_code_eq] : '' ), { include_blank: 'All countries' }, {class: 'form-control my-3'})
.col-lg-4
= f.label :tags_id_eq, 'Filter by tags'
= f.select(:tags_id_eq, options_for_select(Job.all_tags.map { |a| [a.name, a.id]}, params[:q] ? params[:q][:tags_id_eq] : '' ), { include_blank: 'All tags' }, {class: 'form-control my-3'})
.col-lg-6
= f.submit class: 'btn btn-primary my-2 px-4 ml-auto'
.col-md-2.py-4
- if current_user&.has_role?(:superadmin)
= link_to t('.new_job'), new_job_path, class: 'btn btn-primary'
- else
= link_to t('.new_job'), "https://docs.google.com/forms/d/e/1FAIpQLSeSf0baoFfeEMZamGup9XhUv4LJTSn1vFRYea-n8ZgidYPPQQ/viewform", target:"_blank", class: 'btn btn-primary'
.container-fluid
%table.table.table-hover.table-striped.border
%thead
%tr
%th Title
%th Description
%th Apply url
%th Tags
%th Created by
%th= sort_link @q, :min_salary
%th= sort_link @q, :max_salary
%th= sort_link @q, :country_code, 'Country'
%th= sort_link @q, :created_at, 'Created at'
%th
%tbody
- @jobs.each do |job|
%tr
%td=link_to truncate(job.title), job
%td=link_to truncate(job.description), job
%td
- if job.apply_url.present?
=link_to 'Apply', job.apply_url, target: '_blank', class: 'btn btn-sm btn-outline-primary'
%td
- job.tag_list.each do |t|
=link_to t, jobs_path('q[tags_name_cont]': t), class: "badge badge-info"
%td=link_to job.user, job.user || ''
%td= job.min_salary
%td= job.max_salary
%td= job.country&.common_name
%td{title: job.created_at}= time_ago_in_words(job.created_at, include_seconds: false)
%td
- if current_user == job.user
= link_to 'Edit', edit_job_path(job)
= paginate @jobs, theme: 'twitter-bootstrap-4', nav_class: "m-auto"