Commit 2874f419 by nnnghia98

render partial indsutries

parent f4629fed
......@@ -109,3 +109,11 @@ footer {
html {
scroll-behavior: smooth;
}
/* banner */
.banner {
img {
width: 75%;
}
}
class IndustriesController < ApplicationController
def index
@industries = Industry.page(params[:page]).per(Settings.col.page.per)
@industries = Industry.all
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
<div class="col-show"><%= industry.name %></div>
<div class="col-md-3">
<div class="col-show">
<%= industry.name %> (<%= (industry.job_count) %>)
</div>
</div>
......@@ -3,4 +3,3 @@
<%= render partial: "industries/industry", collection: @industries %>
</div>
</div>
<%= paginate @industries %>
<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-primary" %>
</div>
......@@ -23,13 +23,6 @@
</div>
<div class="top_industries">
<h3>Top industries</h3>
<div class="container">
<div class="row row-cols-5">
<%= render partial: "industries/industry", collection: @industries %>
</div>
</div>
<%= paginate @industries %>
<%= render partial: "shared/top_industries"%>
</div>
</div>
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