fix page ID4

parent ef78d223
Pipeline #1377 failed with stages
in 0 seconds
...@@ -8,7 +8,7 @@ gem 'rails', '~> 6.1.3', '>= 6.1.3.2' ...@@ -8,7 +8,7 @@ gem 'rails', '~> 6.1.3', '>= 6.1.3.2'
gem 'bootstrap', '~> 5.0.1' gem 'bootstrap', '~> 5.0.1'
gem 'nokogiri', '~> 1.11', '>= 1.11.7' gem 'nokogiri', '~> 1.11', '>= 1.11.7'
gem 'slim-rails' gem 'slim-rails'
gem 'kaminari', '~> 1.2', '>= 1.2.1', :git => 'https://github.com/kaminari/kaminari' gem 'kaminari', '~> 1.2', '>= 1.2.1'
gem 'friendly_id', '~> 5.4', '>= 5.4.2' gem 'friendly_id', '~> 5.4', '>= 5.4.2'
gem 'babosa' gem 'babosa'
# Use sqlite3 as the database for Active Record # Use sqlite3 as the database for Active Record
......
GIT
remote: https://github.com/kaminari/kaminari
revision: 45f13dbdaa98be3733ffe6b0e8e948da6919f116
specs:
kaminari (1.2.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1)
kaminari-activerecord (= 1.2.1)
kaminari-core (= 1.2.1)
kaminari-actionview (1.2.1)
actionview
kaminari-core (= 1.2.1)
kaminari-activerecord (1.2.1)
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
...@@ -114,6 +97,18 @@ GEM ...@@ -114,6 +97,18 @@ GEM
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
jbuilder (2.11.2) jbuilder (2.11.2)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
kaminari (1.2.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1)
kaminari-activerecord (= 1.2.1)
kaminari-core (= 1.2.1)
kaminari-actionview (1.2.1)
actionview
kaminari-core (= 1.2.1)
kaminari-activerecord (1.2.1)
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
listen (3.5.1) listen (3.5.1)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
...@@ -246,7 +241,7 @@ DEPENDENCIES ...@@ -246,7 +241,7 @@ DEPENDENCIES
capybara (>= 3.26) capybara (>= 3.26)
friendly_id (~> 5.4, >= 5.4.2) friendly_id (~> 5.4, >= 5.4.2)
jbuilder (~> 2.7) jbuilder (~> 2.7)
kaminari (~> 1.2, >= 1.2.1)! kaminari (~> 1.2, >= 1.2.1)
listen (~> 3.3) listen (~> 3.3)
mysql2 (~> 0.5.3) mysql2 (~> 0.5.3)
nokogiri (~> 1.11, >= 1.11.7) nokogiri (~> 1.11, >= 1.11.7)
......
class CityController < ApplicationController class CitiesController < ApplicationController
def list_city def show
@cities_vietnam = City.cities_by_region(City::REGION_VN_ID) @cities_vietnam = City.cities_by_region(City::REGION_VN_ID)
@cities_international = City.cities_by_region(City::REGION_INTERNATIONAL_ID) @cities_international = City.cities_by_region(City::REGION_INTERNATIONAL_ID)
end end
def show
@city = City.find(params[:slug])
@jobs = @city.jobs.order(created_at: :desc).page(params[:page]).per(20)
end
end end
\ No newline at end of file
class IndustriesController < ApplicationController
def show
@industry_list = Industry.industry_list
end
end
\ No newline at end of file
class IndustryController < ApplicationController
def list_industry
@industry_list = Industry.industry_list
end
def show
@industry = Industry.find(params[:slug])
@jobs = @industry.jobs.order(created_at: :desc).page(params[:page]).per(20)
end
end
\ No newline at end of file
class JobsController < ApplicationController class JobsController < ApplicationController
def search def show
@search = Job.search do if params[:city_slug].present?
keywords(params[:search]) @city = City.find_by(slug: params[:city_slug])
@jobs = @city.jobs.order(created_at: :desc).page(params[:page]).per(20)
elsif params[:industry_slug].present?
@industry = Industry.find_by(slug: params[:industry_slug])
@jobs = @industry.jobs.order(created_at: :desc).page(params[:page]).per(20)
end end
end end
end end
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
.row.my-3.text-center.fs-5 .row.my-3.text-center.fs-5
- @cities_vietnam.each do |name, amount| - @cities_vietnam.each do |name, amount|
.col-3.p-2.border.mb-1.fw-normal.bg-white .col-3.p-2.border.mb-1.fw-normal.bg-white
= link_to name, city_path(City.find_by(name: name)) = link_to name, city_slug_path(City.find_by(name: name))
p.mb-1 p.mb-1
= amount = amount
#international #international
...@@ -23,6 +23,6 @@ ...@@ -23,6 +23,6 @@
.row.my-3.text-center.fs-5 .row.my-3.text-center.fs-5
- @cities_international.each do |name, amount| - @cities_international.each do |name, amount|
.col-3.p-2.border.mb-1.fw-normal.bg-white .col-3.p-2.border.mb-1.fw-normal.bg-white
= link_to name, city_path(City.find_by(name: name)) = link_to name, city_slug_path(City.find_by(name: name))
p.mb-1 p.mb-1
= amount = amount
\ No newline at end of file
- provide :title, 'Jobs'
= render 'jobs/search'
= render 'jobs/job_list'
\ No newline at end of file
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
.row.my-3.text-center.fs-5 .row.my-3.text-center.fs-5
- @industry_list.each do |name, amount| - @industry_list.each do |name, amount|
.col-3.p-2.border.mb-1.fw-normal.bg-white .col-3.p-2.border.mb-1.fw-normal.bg-white
= link_to name, industry_path(Industry.friendly.find_by(name: name)) = link_to name, industry_slug_path(Industry.friendly.find_by(name: name))
p.mb-1 p.mb-1
= amount = amount
\ No newline at end of file
- provide :title, 'Jobs'
= render 'jobs/search'
= render 'jobs/job_list'
\ No newline at end of file
- provide :title, 'Job List'
= render 'search'
.container .container
h6.offset-md-4 h6.offset-md-4
= paginate @jobs, window: 1 = paginate @jobs, window: 1
...@@ -21,4 +24,4 @@ ...@@ -21,4 +24,4 @@
h6.offset-md-4.px-5 h6.offset-md-4.px-5
= page_entries_info @jobs = page_entries_info @jobs
h6.offset-md-4 h6.offset-md-4
= paginate @jobs, window: 1 = paginate @jobs, window: 1
\ No newline at end of file
...@@ -26,7 +26,7 @@ h3.p-2 ...@@ -26,7 +26,7 @@ h3.p-2
.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.bg-white .col-4.p-2.border.mb-1.fw-normal.bg-white
= link_to name, city_path(City.find_by(name: name)) = link_to name, city_slug_path(City.find_by(name: name))
p.mb-1 p.mb-1
= amount = amount
.d-flex.flex-row-reverse. .d-flex.flex-row-reverse.
...@@ -36,7 +36,7 @@ h3.p-2 ...@@ -36,7 +36,7 @@ h3.p-2
.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.bg-white .col-4.p-2.border.mb-1.fw-normal.bg-white
= link_to name, industry_path(Industry.find_by(name: name)) = link_to name, industry_slug_path(Industry.find_by(name: name))
p.mb-1 p.mb-1
= amount = amount
.d-flex.flex-row-reverse .d-flex.flex-row-reverse
......
Rails.application.routes.draw do Rails.application.routes.draw do
root 'top#home' root 'top#home'
get 'cities', to: 'city#list_city' get 'cities', to: 'cities#show'
get 'industries', to: 'industry#list_industry' get 'industries', to: 'industries#show'
scope '/jobs' do get 'jobs/city/:city_slug', to: 'jobs#show', as: 'city_slug'
resources :city, :industry, param: :slug get 'jobs/industry/:industry_slug', to: 'jobs#show', as: 'industry_slug'
end
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