Commit 785ef9b6 by Hoang Nam Nguyen

'Fix pages'

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