Commit 5aa84058 by Thanh Hung Pham

Merge branch 'page_ID2/ID3' into 'master'

page ID2/ID3

See merge request !4
parents efd46ea4 86b7a4ee
Pipeline #1375 failed with stages
in 0 seconds
class CityController < ApplicationController
def list_city
@cities_vietnam = City.cities_by_region(City::REGION_VN_ID)
@cities_international = City.cities_by_region(City::REGION_INTERNATIONAL_ID)
end
end
\ No newline at end of file
class IndustryController < ApplicationController
def list_industry
@industry_list = Industry.industry_list
end
end
\ No newline at end of file
...@@ -3,5 +3,8 @@ class City < ApplicationRecord ...@@ -3,5 +3,8 @@ class City < ApplicationRecord
has_and_belongs_to_many :jobs has_and_belongs_to_many :jobs
has_and_belongs_to_many :companies has_and_belongs_to_many :companies
LATEST_CITY_NUMBER = 9 LATEST_CITY_NUMBER = 9
REGION_VN_ID = 1
REGION_INTERNATIONAL_ID = 2
scope :top_cities, -> { joins(:jobs).group(:name).order('count_all DESC').count.take(LATEST_CITY_NUMBER) } scope :top_cities, -> { joins(:jobs).group(:name).order('count_all DESC').count.take(LATEST_CITY_NUMBER) }
scope :cities_by_region, ->(value) { joins(:jobs).group(:name).having('count_all >= ?', 1).where('region_id = ?', value).order('count_all DESC').count }
end end
\ No newline at end of file
...@@ -2,4 +2,5 @@ class Industry < ApplicationRecord ...@@ -2,4 +2,5 @@ class Industry < ApplicationRecord
has_and_belongs_to_many :jobs has_and_belongs_to_many :jobs
LATEST_INDUSTRY_NUMBER = 9 LATEST_INDUSTRY_NUMBER = 9
scope :top_industries, -> { joins(:jobs).group(:name).order('count_all DESC').count.take(LATEST_INDUSTRY_NUMBER) } scope :top_industries, -> { joins(:jobs).group(:name).order('count_all DESC').count.take(LATEST_INDUSTRY_NUMBER) }
scope :industry_list, -> { joins(:jobs).group(:name).having('count_all >= ?', 1).order('count_all DESC').count }
end end
\ No newline at end of file
- provide :title, 'City List'
.container
h3.p-3
| City list
.row.my-3.text-center.fs-3
.col-6.p-2.mb-1.fw-normal
= link_to 'Việt Nam', anchor: 'vietnam'
.col-6.p-2.mb-1.fw-normal
= link_to 'International', anchor: 'international'
#vietnam
h3
| Việt Nam
.row.my-3.text-center.fs-5
- @cities_vietnam.each do |name, amount|
.col-3.p-2.border.mb-1.fw-normal.bg-white
= link_to name, "#"
p.mb-1
= amount
#international
h3
| International
.row.my-3.text-center.fs-5
- @cities_international.each do |name, amount|
.col-3.p-2.border.mb-1.fw-normal.bg-white
= link_to name, "#"
p.mb-1
= amount
\ No newline at end of file
- provide :title, 'Industry List'
.container
h3.p-3
| Industries List
.row.my-3.text-center.fs-5
- @industry_list.each do |name, amount|
.col-3.p-2.border.mb-1.fw-normal.bg-white
= link_to name, "#"
p.mb-1
= amount
\ No newline at end of file
header header
nav.navbar.navbar-expand-lg.navbar-light.bg-dark nav.navbar.navbar-expand-lg.navbar-light.bg-dark
.container-fluid .container-fluid
= image_tag "logo.png", alt: "logo", id: "logo" = link_to (image_tag "logo.png", alt: "logo"), root_path, id: "logo"
#navbarExample01.collapse.navbar-collapse #navbarExample01.collapse.navbar-collapse
ul.navbar-nav.ms-auto.mb-2.mb-lg-0 ul.navbar-nav.ms-auto.mb-2.mb-lg-0
li.nav-item.active li.nav-item.active
......
...@@ -24,25 +24,23 @@ h3.p-2 ...@@ -24,25 +24,23 @@ h3.p-2
p.mb-1 p.mb-1
i.fas.fa-map-marker-alt.m-1 i.fas.fa-map-marker-alt.m-1
= link_to job.cities.map(&:name).join(', '), "#" = link_to job.cities.map(&:name).join(', '), "#"
h4 h4
| Top Cities | Top Cities
.row.my-3.text-center.fs-5 .row.my-3.text-center.fs-5
- @cities.each do |name, amount| - @cities.each do |name, amount|
.col-4.p-2.border.mb-1.fw-normal .col-4.p-2.border.mb-1.fw-normal.bg-white
= link_to name, "#" = link_to name, "#"
p.mb-1 p.mb-1
= amount = amount
.d-flex.flex-row-reverse. .d-flex.flex-row-reverse.
= link_to 'All Cities', "#", class: "more" = link_to 'All Cities', cities_path, class: "more"
h4 h4
| Top Industries | Top Industries
.row.my-3.text-center.fs-5 .row.my-3.text-center.fs-5
- @industries.each do |name, amount| - @industries.each do |name, amount|
.col-4.p-2.border.mb-1.fw-normal .col-4.p-2.border.mb-1.fw-normal.bg-white
= link_to name, "#" = link_to name, "#"
p.mb-1 p.mb-1
= amount = amount
.d-flex.flex-row-reverse .d-flex.flex-row-reverse
= link_to 'All Industries', "#", class: "more" = link_to 'All Industries', industries_path, class: "more"
\ No newline at end of file \ No newline at end of file
Rails.application.routes.draw do Rails.application.routes.draw do
root 'top#home' root 'top#home'
get 'cities', to: 'city#list_city'
get 'industries', to: 'industry#list_industry'
end end
\ No newline at end of file
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