Commit 23c11742 by Van Hau Le

Merge branch 'feature/job_list_page' into 'master'

Feature/job list page

See merge request !15
parents 5d606475 b95b0124
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -123,3 +123,37 @@ html {
.top_cities {
margin: 20px;
}
/* job */
.box {
border: solid 1px black;
margin: 10px;
padding: 5px;
.job_data {
width: 100%;
.job_data_row {
display: table;
width: 100%;
padding: 1px 0 0 0;
dt {
display: table-cell;
margin: 1px 0 0 0;
width: 100px;
padding: 0 0 0 8px;
font-weight: bold;
line-height: 32px;
vertical-align: top;
}
dd {
display: table-cell;
padding: 8px 3px 8px 8px;
}
}
}
}
dl, dt, dd {
list-style-type: none;
line-height: normal;
}
......@@ -2,6 +2,6 @@ class TopsController < ApplicationController
def index
@vn_cities = City.city_order.take(Settings.top.city.limit)
@industries = Industry.industry_order.take(Settings.top.city.limit)
@jobs = Job.page(params[:page]).per(Settings.job.per_page)
@jobs = Job.latest_job
end
end
......@@ -36,4 +36,8 @@ class Job < ApplicationRecord
has_many :industry_jobs
has_many :industries, through: :industry_jobs
def self.latest_job
@latest_job ||= Job.order(updated_at: :desc).take(Settings.top.job.limit)
end
end
<div class="col-md-3">
<div class="col-show">
<%= city.name %> (<%= (city.job_count) %>)
<%= link_to "#{city.name} (#{city.job_count})", jobs_path %>
</div>
</div>
<div class="col-md-3">
<div class="col-show">
<%= industry.name %> (<%= (industry.job_count) %>)
<%= link_to "#{industry.name} (#{industry.job_count})", jobs_path %>
</div>
</div>
<div>
<%= job.title %>
<%= job.short_des %>
<%= job.salary %>
<div class="box">
<div class="job_data">
<dl class="job_data_row">
<dt>Title</dt>
<dd><%= job.title %></dd>
</dl>
<dl class="job_data_row">
<dt>Short description</dt>
<dd><%= truncate(job.short_des, length: 250) %></dd>
</dl>
<dl class="job_data_row">
<dt>Salary</dt>
<dd><%= job.salary %></dd>
</dl>
<dl class="job_data_row">
<dt>Location</dt>
<dd><%= job&.cities&.first&.name %></dd>
</dl>
</div>
<button type="button" class="btn btn-outline-secondary">Favorite</button>
</div>
<div>
<%= render partial: "jobs/job", collection: @jobs %>
</div>
<h3>Total: <%= Job.count %></h3>
<h3>Result for: </h3>
<%= paginate @jobs %>
<%= render partial: "jobs/job", collection: @jobs %>
<%= paginate @jobs %>
<li class="page-item">
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote, class: 'page-link' %>
</li>
<li class='page-item disabled'>
<%= link_to raw(t 'views.pagination.truncate'), '#', class: 'page-link' %>
</li>
<li class="page-item">
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, remote: remote, class: 'page-link' %>
</li>
<li class="page-item">
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote, class: 'page-link' %>
</li>
<% if page.current? %>
<li class="page-item active">
<%= content_tag :a, page, data: { remote: remote }, rel: page.rel, class: 'page-link' %>
</li>
<% else %>
<li class="page-item">
<%= link_to page, url, remote: remote, rel: page.rel, class: 'page-link' %>
</li>
<% end %>
<%= paginator.render do %>
<nav>
<ul class="pagination">
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| %>
<% if page.left_outer? || page.right_outer? || page.inside_window? %>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<% end %>
<% end %>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
</ul>
</nav>
<% end %>
<li class="page-item">
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote, class: 'page-link' %>
</li>
<div class="box">
<div class="job_data">
<dl class="job_data_row">
<dt>Title</dt>
<dd><%= latest_job.title %></dd>
</dl>
<dl class="job_data_row">
<dt>Short description</dt>
<dd><%= truncate(latest_job.short_des, length: 250) %></dd>
</dl>
<dl class="job_data_row">
<dt>Salary</dt>
<dd><%= latest_job.salary %></dd>
</dl>
<dl class="job_data_row">
<dt>Location</dt>
<dd><%= latest_job&.cities&.first&.name %></dd>
</dl>
</div>
</div>
......@@ -4,5 +4,5 @@
<div class="row row-cols-4">
<%= render partial: "cities/city", collection: @vn_cities %>
</div>
<%= link_to "All cities", cities_path, class: "btn btn-lg btn-info" %>
<%= link_to "All cities", cities_path, class: "btn btn-info" %>
</div>
......@@ -4,5 +4,5 @@
<div class="row row-cols-5">
<%= render partial: "industries/industry", collection: @industries %>
</div>
<%= link_to "All industries", industries_path, class: "btn btn-lg btn-info" %>
<%= link_to "All industries", industries_path, class: "btn btn-info" %>
</div>
......@@ -13,9 +13,8 @@
<h3>Latest jobs</h3>
<div>
<%= render partial: "jobs/job", collection: @jobs %>
<%= render partial: "shared/latest_job", collection: @jobs %>
</div>
<%= paginate @jobs %>
</div>
<div class="top_cities">
......
job:
per_page: 5
per_page: 20
csv:
file_path: "jobss.csv"
......@@ -7,3 +7,5 @@ csv:
top:
city:
limit: 9
job:
limit: 5
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment