Commit 785ef9b6 by Hoang Nam Nguyen

'Fix pages'

parent 56be2f14
...@@ -39,6 +39,7 @@ gem 'jbuilder', '~> 2.5' ...@@ -39,6 +39,7 @@ gem 'jbuilder', '~> 2.5'
# Use Capistrano for deployment # Use Capistrano for deployment
# gem 'capistrano-rails', group: :development # gem 'capistrano-rails', group: :development
gem 'rsolr'
group :development, :test do group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console
......
...@@ -23,16 +23,6 @@ ...@@ -23,16 +23,6 @@
/* content */ /* content */
input[type=text] {
width: 130px;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
}
input[type=text]:focus {
width: 100%;
}
#image_height { #image_height {
width: 99.5%; width: 99.5%;
} }
...@@ -106,11 +96,8 @@ input[type=text]:focus { ...@@ -106,11 +96,8 @@ input[type=text]:focus {
margin-left: 30%; margin-left: 30%;
margin-top: 5%; margin-top: 5%;
} }
/* city list */
#international_city {
} /* city list */
.ct_local { .ct_local {
width: 100%; width: 100%;
......
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
protect_from_forgery with: :exception protect_from_forgery with: :exception
def hello
render html: "hello, world"
end
end end
class TopPagesController < ApplicationController class TopPagesController < ApplicationController
def cities def cities
@vn_cities = City.where(is_vietnam: true) @vn_cities = City.where.not(is_vietnam: :acchived )
@international_cities = City.where(is_vietnam: false) @international_cities = City.where(is_vietnam: :active)
end end
def industries def industries
...@@ -12,7 +12,7 @@ class TopPagesController < ApplicationController ...@@ -12,7 +12,7 @@ class TopPagesController < ApplicationController
end end
def top_page def top_page
@jobs = Job.order(short_description: :desc, job_title: :desc,salary: :desc).limit(ENV["Number_top_page_jobs"]) @jobs = Job.recent.limit(ENV["Number_top_page_jobs"])
@total_job = Job.count @total_job = Job.count
@industries = Industry.limit(ENV["Number_top_page"]) @industries = Industry.limit(ENV["Number_top_page"])
@cities = City.limit(ENV["Number_top_page"]) @cities = City.limit(ENV["Number_top_page"])
......
...@@ -3,4 +3,6 @@ class Job < ApplicationRecord ...@@ -3,4 +3,6 @@ class Job < ApplicationRecord
has_many :cities, through: :job_cities has_many :cities, through: :job_cities
has_many :job_industries has_many :job_industries
has_many :industries, through: :job_industries has_many :industries, through: :job_industries
scope :recent, -> { order(id: :desc) }
end end
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="navbar-header"> <div class="navbar-header">
<a href="http://zigexn.vn"> <a href="http://zigexn.vn">
<img src="/assets/logo-de7018dbfd264fe7911d4f13f8ae89a4697a4624ae01a49de6e8df3f8e507041.png"" class="navbar-brand" id="logo"> <%= image_tag("logo.png", class: "navbar-brand", id: "logo") %>
</a> </a>
</div> </div>
<ul class="nav navbar-nav" id="slide"> <ul class="nav navbar-nav" id="slide">
......
<div class="container"> <div class="container">
<div class=" row align-items-start"> <div class=" row align-items-start">
<%= render partial: "city",collection: @cities, as: :city %> <%= render partial: "city",collection: @cities, as: :city %>
</div>
</div> </div>
</div>
<div> <div>
<%= link_to '<button type="button" class="btn btn-success" id="cities_button" >All Cities</button>'.html_safe, cities_path %> <%= link_to 'All Cities', cities_path, { class: 'btn btn-success', id: 'cities_button' } %>
</div> </div>
\ No newline at end of file
<div class="col-md-4 list-group-item"> <% if city.job_cities_count != 0 %>
<div class="col-md-4 list-group-item">
<ul> <ul>
<li> <li>
<a href=""><%= city.location %></a> <a href=""><%= city.location %></a>
(<%= city.job_cities_count %>) (<%= city.job_cities_count %>)
</li> </li>
</ul> </ul>
</div> </div>
\ No newline at end of file <% end %>
\ No newline at end of file
<%= render partial: "industry",collection: @industries, as: :industry %> <%= render partial: "industry",collection: @industries, as: :industry %>
<div> <div>
<%= link_to'<button type="button" class="btn btn-success" id="industries_button">All Industry</button>'.html_safe, industries_path %> <%= link_to 'All Industry', industries_path, { class: 'btn btn-success', id: 'industries_button' } %>
</div> </div>
\ No newline at end of file
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
<p> <p>
<%= industry.industry_name %> <%= industry.industry_name %>
</a> </a>
(<%= industry.jobs.count unless industry.jobs.count.zero? %>) (<%= industry.job_industries_count %>)
</p> </p>
</div> </div>
\ No newline at end of file
<div class="col-md-4 list-group-item"> <% if industry.job_industries_count !=0 %>
<div class="col-md-4 list-group-item">
<ul> <ul>
<li> <li>
<a href=""><%= industry.industry_name %></a> <a href=""><%= industry.industry_name %></a>
(<%= industry.jobs.count %>) (<%= industry.job_industries_count %>)
</li> </li>
</ul> </ul>
</div> </div>
\ No newline at end of file <% end %>
\ No newline at end of file
...@@ -6,14 +6,10 @@ ...@@ -6,14 +6,10 @@
<p class="text-success line_job">Viet Nam</p> <p class="text-success line_job">Viet Nam</p>
<div class="row"> <div class="row">
<% @vn_cities.each do |vn_ct| %> <%= render partial: "city_list",collection: @vn_cities, as: :city %>
<%= render partial: "city_list",locals: {city: vn_ct} unless vn_ct.jobs.count.zero? %>
<% end %>
</div> </div>
<p class="text-success line_job">International</p> <p class="text-success line_job">International</p>
<div class="row"> <div class="row">
<% @international_cities.each do |inter_ct| %> <%= render partial: "city_list",collection: @international_cities, as: :city %>
<%= render partial: "city_list",locals: {city: inter_ct} unless inter_ct.jobs.count.zero? %>
<% end %>
</div> </div>
\ No newline at end of file
<p class="text-success line_job">Industry List</p> <p class="text-success line_job">Industry List</p>
<div class="row"> <div class="row">
<% @industries_page.each do |industry| %> <%= render partial: "industry_list", collection: @industries_page, as: :industry %>
<%= render partial: "industry_list", locals: {industry: industry} unless industry.jobs.count.zero?%>
<% end %>
</div> </div>
<img src="/assets/home_page-92e377f3edbb7945c7f7dc0ff74c6eec72b0d154f7fe3e301043af8c6fc58312.jpg" id="image_height"> <%= image_tag("home_page.jpg", id: "image_height") %>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<h1 id="fontwords">Total jobs: <em> <%= @total_job %> </em>job</h1> <h1 id="fontwords">Total jobs: <em> <%= @total_job %> </em>job</h1>
......
class AddBooleanToCities < ActiveRecord::Migration[5.1] class AddBooleanToCities < ActiveRecord::Migration[5.1]
def change def change
add_column :cities, :is_vietnam, :boolean add_column :cities, :is_vietnam, :boolean
enum is_vietnam: {active: 0, acchived: 1}
end end
end end
File added
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