Commit 1245c7f2 by Hoang Phuc

Show data home, jobs, cities, industries, job detail page

parent 6146f29f
Pipeline #547 failed with stages
in 0 seconds
......@@ -29,6 +29,9 @@ gem 'jbuilder', '~> 2.7'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
# Pagination
gem 'kaminari'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
......
......@@ -88,6 +88,18 @@ GEM
concurrent-ruby (~> 1.0)
jbuilder (2.10.0)
activesupport (>= 5.0.0)
kaminari (1.2.0)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.0)
kaminari-activerecord (= 1.2.0)
kaminari-core (= 1.2.0)
kaminari-actionview (1.2.0)
actionview
kaminari-core (= 1.2.0)
kaminari-activerecord (1.2.0)
activerecord
kaminari-core (= 1.2.0)
kaminari-core (1.2.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
......@@ -124,6 +136,10 @@ GEM
pry (0.13.0)
coderay (~> 1.1)
method_source (~> 1.0)
pry (0.13.0-java)
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
public_suffix (4.0.3)
puma (4.3.3)
nio4r (~> 2.0)
......@@ -184,6 +200,8 @@ GEM
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
spoon (0.0.6)
ffi
spring (2.1.0)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
......@@ -240,6 +258,7 @@ DEPENDENCIES
byebug
capybara (>= 2.15)
jbuilder (~> 2.7)
kaminari
listen (>= 3.0.5, < 3.2)
mysql2
pry
......
......@@ -6041,10 +6041,10 @@ ul.resumes .listing-favorited h3:before {
}
.companies-overview .company-group {
padding: 0 10px;
padding: 5px 10px;
width: 25%;
float: left;
display: inline
display: inline;
}
.company-letter {
......
......@@ -353,6 +353,19 @@ body {
visibility: visible;
}
nav.pagination span a, nav.pagination span.current{
text-decoration: none;
font: 400 13px/normal Montserrat, sans-serif;
text-align: center;
padding: 8px 13px;
border: 1px solid #ccc;
border-radius: 4px;
margin: 20px 5px;
display: inline-block;
}
nav.pagination span.current{
color: #7dc246;
}
@media screen and (min-width: 1200px) {
.job_listing-about, .resume-about {
width: 90%;
......
class CityController < ApplicationController
def index
@cities = City.all
end
end
class IndustryController < ApplicationController
def index
@industries = Industry.all
end
end
class JobController < ApplicationController
def index
if params[:city]
@jobs = Job.includes(:cities).where("cities.id = #{params[:city]}").references(:cities).page(params[:page])
@amount_job = Job.includes(:cities).where("cities.id = #{params[:city]}").references(:cities).count
elsif params[:industry]
@jobs = Job.includes(:industries).where("industries.id = #{params[:industry]}").references(:industries).page(params[:page])
@amount_job = Job.includes(:industries).where("industries.id = #{params[:industry]}").references(:industries).count
else
@jobs = Job.order("id DESC").page(params[:page])
@amount_job = Job.count
end
end
def show
@title = "Job Detail Page"
@job = Job.find(params[:id])
@relate_jobs = Job.where("company_id = #{@job.company_id} and id != #{@job.id}").limit(3).order("id DESC")
end
end
......@@ -6,19 +6,11 @@
<article id="post-2064" class="post-2064 page type-page status-publish hentry">
<div class="entry-content">
<ul class="companies-overview">
<li class="company-group">
<a href="https://jobify-demos.astoundify.com/classic/company/AdRoll/">AdRoll (1)</a>
</li>
<li class="company-group">
<a href="https://jobify-demos.astoundify.com/classic/company/AdRoll/">AdRoll (1)</a>
</li>
<li class="company-group">
<a href="https://jobify-demos.astoundify.com/classic/company/AdRoll/">AdRoll (1)</a>
</li>
<li class="company-group">
<a href="https://jobify-demos.astoundify.com/classic/company/AdRoll/">AdRoll (1)</a>
</li>
<% @cities.each do |city| %>
<li class="company-group">
<a href="/jobs?city=<%= city.id %>"><%= city.title %> (<%= city.jobs.length %>)</a>
</li>
<% end %>
</ul>
</div>
</article>
......
......@@ -48,33 +48,38 @@
<ul class="job_listings">
<% @latest_10_jobs.each do |job| %>
<li class="job_listing job-type-part-time post-3354 type-job_listing status-publish has-post-thumbnail hentry job_listing_category-design job_listing_type-part-time">
<a href="/job/<%= job.id %>" class="job_listing-clickbox"></a>
<div class="job_listing-logo">
<img class="company_logo" src="<%= job.company.logo %>" alt="<%= job.company.title %>" />
<a href="/job/<%= job.id %>">
<img class="company_logo" src="<%= job.company.logo != "" ? job.company.logo : "https://via.placeholder.com/66x38?text=Logo" %>" alt="<%= job.company.title %>" />
</a>
</div>
<div class="job_listing-about">
<div class="job_listing-position job_listing__column">
<h3 class="job_listing-title"><%= job.title %></h3>
<h3 class="job_listing-title">
<a href="/job/<%= job.id %>">
<%= job.title %>
</a>
</h3>
<div class="job_listing-company">
<strong><%= job.company.title%></strong>
</div>
</div>
<div class="job_listing-location job_listing__column">
<a class="google_map_link" href="#" target="_blank">
<% job.cities.each do |city| %>
<%= city.title %>
<% end %>
</a>
<% job.cities.each_with_index do |city, index| %>
<a class="google_map_link" href="/jobs?city=<%= city.id %>">
<%= city.title %><%= ", " if index != job.cities.length - 1 %>
</a>
<% end %>
</div>
<ul class="job_listing-meta job_listing__column">
<li class="job_listing-type job-type part-time"><%= job.salary %></li>
<li class="job_listing-date"><%= job.updated_date_job %></li>
<li class="job_listing-date"><%= job.expiration_date %></li>
</ul>
</div>
</li>
<% end %>
</ul>
<a class="load_more_jobs" href="#"><strong>Load more listings</strong></a>
<a class="load_more_jobs" href="/jobs"><strong>Load more listings</strong></a>
</div>
</div>
</div>
......@@ -107,11 +112,11 @@
<% @latest_8_cities.each do |city| %>
<li class="job-stat col-md-3 col-sm-6 col-xs-12">
<strong><%= city.jobs.length %></strong>
<%= city.title %>
<a href="/jobs?city=<%= city.id %>"><%= city.title %></a>
</li>
<% end %>
</ul>
<a class="load_more_jobs" href="#"><strong>Load more listings</strong></a>
<a class="load_more_jobs" href="/cities"><strong>Load more listings</strong></a>
</div>
</section>
<section id="jobify_widget_feature_callout-3" class="widget widget--home widget--home--no-margin jobify_widget_feature_callout widget--home-feature-callout">
......@@ -138,11 +143,11 @@
<% @latest_8_industries.each do |industry| %>
<li class="job-stat col-md-3 col-sm-6 col-xs-12">
<strong><%= industry.jobs.length %></strong>
<%= industry.title %>
<a href="/jobs?industry=<%= industry.id %>"><%= industry.title %></a>
</li>
<% end %>
</ul>
<a class="load_more_jobs" href="#"><strong>Load more listings</strong></a>
<a class="load_more_jobs" href="/industries"><strong>Load more listings</strong></a>
</div>
</section>
</div>
\ No newline at end of file
......@@ -6,19 +6,11 @@
<article id="post-2064" class="post-2064 page type-page status-publish hentry">
<div class="entry-content">
<ul class="companies-overview">
<% @industries.each do |industry| %>
<li class="company-group">
<a href="https://jobify-demos.astoundify.com/classic/company/AdRoll/">AdRoll (1)</a>
<a href="/jobs?industry=<%= industry.id %>"><%= industry.title %> (<%= industry.jobs.length %>)</a>
</li>
<li class="company-group">
<a href="https://jobify-demos.astoundify.com/classic/company/AdRoll/">AdRoll (1)</a>
</li>
<li class="company-group">
<a href="https://jobify-demos.astoundify.com/classic/company/AdRoll/">AdRoll (1)</a>
</li>
<li class="company-group">
<a href="https://jobify-demos.astoundify.com/classic/company/AdRoll/">AdRoll (1)</a>
</li>
<% end %>
</ul>
</div>
</article>
......
<%# Link to the "First" page
- available local variables
url: url to the first page
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="first">
<%= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, remote: remote %>
</span>
<%# Non-link tag that stands for skipped pages...
- available local variables
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="page gap"><%= t('views.pagination.truncate').html_safe %></span>
<%# Link to the "Last" page
- available local variables
url: url to the last page
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="last">
<%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, remote: remote %>
</span>
<%# Link to the "Next" page
- available local variables
url: url to the next page
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="next">
<%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, rel: 'next', remote: remote %>
</span>
<%# Link showing page number
- available local variables
page: a page object for "this" page
url: url to this page
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="page<%= ' current' if page.current? %>">
<%= link_to_unless page.current?, page, url, {remote: remote, rel: page.rel} %>
</span>
<%# The container tag
- available local variables
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
paginator: the paginator that renders the pagination tags inside
-%>
<%= paginator.render do -%>
<nav class="pagination" role="navigation" aria-label="pager">
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%>
<% if page.display_tag? -%>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<% end -%>
<% end -%>
<% unless current_page.out_of_range? %>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
<% end %>
</nav>
<% end -%>
<%# Link to the "Previous" page
- available local variables
url: url to the previous page
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="prev">
<%= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, rel: 'prev', remote: remote %>
</span>
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