Commit 364b38c6 by Xuan Trung Le

Create the TOP, industry_list, city_list, job_detail pages.

parent 28eda34d
class Industry < ApplicationRecord class Industry < ApplicationRecord
<<<<<<< 28eda34d875adbaa9af263755cbdb98465bc5939
has_many :industries_jobs has_many :industries_jobs
has_many :jobs, through: :industries_jobs has_many :jobs, through: :industries_jobs
...@@ -10,4 +11,19 @@ class Industry < ApplicationRecord ...@@ -10,4 +11,19 @@ class Industry < ApplicationRecord
order(jobs_count: :desc) } order(jobs_count: :desc) }
scope :availble_job, -> { where('jobs_count > 0')} scope :availble_job, -> { where('jobs_count > 0')}
=======
has_and_belongs_to_many :jobs
scope :top_industries, -> { select('industries.id, industries.name AS name, COUNT(jobs.id) AS jobs_count').
joins(:jobs).
group('industries.id').
order('jobs_count DESC, name').
limit(9) }
scope :industry_list, -> { select('industries.id, industries.name AS name, COUNT(jobs.id) AS jobs_count').
joins(:jobs).
# where('jobs_count >= 1').
group('industries.id').
order('jobs_count DESC, name') }
>>>>>>> Create the TOP, industry_list, city_list, job_detail pages.
end end
<div class="col-md-<%= column %> maxH109"> <div class="col-md-<%= column %> maxH109">
<div class="job-intro well mr0 mrBot20 maxH89"> <div class="job-intro well mr0 mrBot20 maxH89">
<<<<<<< 28eda34d875adbaa9af263755cbdb98465bc5939
<h4 class="mr0"><%= link_to industry.name, industry_jobs_path(industry) %></h4> <h4 class="mr0"><%= link_to industry.name, industry_jobs_path(industry) %></h4>
=======
<h4 class="mr0"><%= link_to industry.name, "#{jobs_path}/industry/#{industry.id}" %></h4>
>>>>>>> Create the TOP, industry_list, city_list, job_detail pages.
<p>Jobs: <span class="badge"><%= industry.jobs_count %></span></p> <p>Jobs: <span class="badge"><%= industry.jobs_count %></span></p>
</div> </div>
</div> </div>
...@@ -3,11 +3,35 @@ ...@@ -3,11 +3,35 @@
<head> <head>
<title>Venjob</title> <title>Venjob</title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<<<<<<< 28eda34d875adbaa9af263755cbdb98465bc5939
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head> </head>
=======
<link
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel="stylesheet"
integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN"
crossorigin="anonymous">
<script
src="https://code.jquery.com/jquery-3.2.1.js"
integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE="
crossorigin="anonymous"></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
>>>>>>> Create the TOP, industry_list, city_list, job_detail pages.
<body> <body>
<%= render "layouts/menu" %> <%= render "layouts/menu" %>
<%= yield %> <%= yield %>
......
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