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 { ...@@ -109,3 +109,17 @@ footer {
html { html {
scroll-behavior: smooth; scroll-behavior: smooth;
} }
/* banner */
.banner {
img {
width: 75%;
}
}
/* top page */
.top_cities {
margin: 20px;
}
class CompaniesController < ApplicationController class CompaniesController < ApplicationController
def index def index
@companies = Company.all @companies = Company.page(params[:page]).per(Settings.table.page.per)
end end
end end
class TopsController < ApplicationController class TopsController < ApplicationController
def index def index
@vn_cities = City.city_order.take(Settings.top.city.limit) @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) @jobs = Job.page(params[:page]).per(Settings.job.per_page)
end end
end end
...@@ -15,4 +15,12 @@ ...@@ -15,4 +15,12 @@
class Industry < ApplicationRecord class Industry < ApplicationRecord
has_many :industry_jobs has_many :industry_jobs
has_many :jobs, through: :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 end
...@@ -5,3 +5,4 @@ ...@@ -5,3 +5,4 @@
</ul> </ul>
</tbody> </tbody>
</table> </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 @@ ...@@ -4,5 +4,5 @@
<div class="row row-cols-4"> <div class="row row-cols-4">
<%= render partial: "cities/city", collection: @vn_cities %> <%= render partial: "cities/city", collection: @vn_cities %>
</div> </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> </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 @@ ...@@ -2,9 +2,11 @@
<div class="center jumbotron"> <div class="center jumbotron">
<div class="banner"> <div class="banner">
<img src="banner.png" alt="Banner"> <%= image_tag ("skyline_darker.jpg") %>
</div> </div>
<h2>Total jobs: <%= Job.count %></h2>
<div class="search"></div> <div class="search"></div>
<div class="lastest_jobs"> <div class="lastest_jobs">
...@@ -17,14 +19,10 @@ ...@@ -17,14 +19,10 @@
</div> </div>
<div class="top_cities"> <div class="top_cities">
<%= render partial: "shared/top_cities" %> <%= render "shared/top_cities" %>
</div> </div>
<div class="top_industries"> <div class="top_industries">
<h3>Top industries</h3> <%= render "shared/top_industries"%>
<ul class="list-group list-group-horizontal">
<%= render partial: "industries/industry", collection: @industries %>
</ul>
</div> </div>
</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