Commit 5d606475 by Van Hau Le

Merge branch 'feature/industry_page' into 'master'

Feature/industry page

See merge request !14
parents 31dc3481 e68f4427
......@@ -109,3 +109,17 @@ footer {
html {
scroll-behavior: smooth;
}
/* banner */
.banner {
img {
width: 75%;
}
}
/* top page */
.top_cities {
margin: 20px;
}
class CompaniesController < ApplicationController
def index
@companies = Company.all
@companies = Company.page(params[:page]).per(Settings.table.page.per)
end
end
class TopsController < ApplicationController
def index
@vn_cities = City.city_order.take(Settings.top.city.limit)
@industries = Industry.all
@industries = Industry.industry_order.take(Settings.top.city.limit)
@jobs = Job.page(params[:page]).per(Settings.job.per_page)
end
end
......@@ -15,4 +15,12 @@
class Industry < ApplicationRecord
has_many :industry_jobs
has_many :jobs, through: :industry_jobs
def job_count
@job_count ||= jobs.count
end
def self.industry_order
@industry_order ||= all.sort_by(&:job_count).reverse
end
end
......@@ -5,3 +5,4 @@
</ul>
</tbody>
</table>
<%= paginate @companies %>
<li class="list-group-item"><%= industry.name %></li>
<div class="col-md-3">
<div class="col-show">
<%= industry.name %> (<%= (industry.job_count) %>)
</div>
</div>
<%= render partial: "industries/industry", collection: @industries %>
<div class="row row-cols-5">
<%= render partial: "industries/industry", collection: @industries %>
</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-primary" %>
<%= link_to "All cities", cities_path, class: "btn btn-lg btn-info" %>
</div>
<h3>Top industries</h3>
<div class="container">
<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" %>
</div>
......@@ -2,9 +2,11 @@
<div class="center jumbotron">
<div class="banner">
<img src="banner.png" alt="Banner">
<%= image_tag ("skyline_darker.jpg") %>
</div>
<h2>Total jobs: <%= Job.count %></h2>
<div class="search"></div>
<div class="lastest_jobs">
......@@ -17,14 +19,10 @@
</div>
<div class="top_cities">
<%= render partial: "shared/top_cities" %>
<%= render "shared/top_cities" %>
</div>
<div class="top_industries">
<h3>Top industries</h3>
<ul class="list-group list-group-horizontal">
<%= render partial: "industries/industry", collection: @industries %>
</ul>
<%= render "shared/top_industries"%>
</div>
</div>
<p>Welcome <%= @email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
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