page ID2/ID3

parent efd46ea4
Pipeline #1372 failed with stages
in 0 seconds
class CityController < ApplicationController
def list_city
@city_vietnam = City.city_vietnam
@city_inter = City.city_inter
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
......@@ -4,4 +4,6 @@ class City < ApplicationRecord
has_and_belongs_to_many :companies
LATEST_CITY_NUMBER = 9
scope :top_cities, -> { joins(:jobs).group(:name).order('count_all DESC').count.take(LATEST_CITY_NUMBER) }
scope :city_vietnam, -> { joins(:jobs).group(:name).having('count_all >= ?', 1).where('region_id = 1').order('count_all DESC').count }
scope :city_inter, -> { joins(:jobs).group(:name).having('count_all >= ?', 1).where('region_id = 2').order('count_all DESC').count }
end
\ No newline at end of file
......@@ -2,4 +2,5 @@ class Industry < ApplicationRecord
has_and_belongs_to_many :jobs
LATEST_INDUSTRY_NUMBER = 9
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
\ No newline at end of file
- provide :title, 'Cities'
.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
- @city_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
- @city_inter.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, 'Industries'
.container
h3.p-3
| Industries
.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
nav.navbar.navbar-expand-lg.navbar-light.bg-dark
.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
ul.navbar-nav.ms-auto.mb-2.mb-lg-0
li.nav-item.active
......
......@@ -24,25 +24,23 @@ h3.p-2
p.mb-1
i.fas.fa-map-marker-alt.m-1
= link_to job.cities.map(&:name).join(', '), "#"
h4
| Top Cities
.row.my-3.text-center.fs-5
- @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, "#"
p.mb-1
= amount
.d-flex.flex-row-reverse.
= link_to 'All Cities', "#", class: "more"
= link_to 'All Cities', cities_path, class: "more"
h4
| Top Industries
.row.my-3.text-center.fs-5
- @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, "#"
p.mb-1
= amount
.d-flex.flex-row-reverse
= link_to 'All Industries', "#", class: "more"
\ No newline at end of file
= link_to 'All Industries', industries_path, class: "more"
\ No newline at end of file
Rails.application.routes.draw do
root 'top#home'
get '/cities', to: 'city#list_city'
get '/industries', to: 'industry#list_industry'
resource :cities
resource :industries
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