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'
gem 'bootstrap', '~> 5.0.1'
gem 'nokogiri', '~> 1.11', '>= 1.11.7'
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 'babosa'
# 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
remote: https://rubygems.org/
specs:
......@@ -114,6 +97,18 @@ GEM
concurrent-ruby (~> 1.0)
jbuilder (2.11.2)
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)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
......@@ -246,7 +241,7 @@ DEPENDENCIES
capybara (>= 3.26)
friendly_id (~> 5.4, >= 5.4.2)
jbuilder (~> 2.7)
kaminari (~> 1.2, >= 1.2.1)!
kaminari (~> 1.2, >= 1.2.1)
listen (~> 3.3)
mysql2 (~> 0.5.3)
nokogiri (~> 1.11, >= 1.11.7)
......
class CityController < ApplicationController
def list_city
class CitiesController < ApplicationController
def show
@cities_vietnam = City.cities_by_region(City::REGION_VN_ID)
@cities_international = City.cities_by_region(City::REGION_INTERNATIONAL_ID)
end
def show
@city = City.find(params[:slug])
@jobs = @city.jobs.order(created_at: :desc).page(params[:page]).per(20)
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
def search
@search = Job.search do
keywords(params[:search])
def show
if params[:city_slug].present?
@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
......@@ -14,7 +14,7 @@
.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, city_path(City.find_by(name: name))
= link_to name, city_slug_path(City.find_by(name: name))
p.mb-1
= amount
#international
......@@ -23,6 +23,6 @@
.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, city_path(City.find_by(name: name))
= link_to name, city_slug_path(City.find_by(name: name))
p.mb-1
= 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 @@
.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, industry_path(Industry.friendly.find_by(name: name))
= link_to name, industry_slug_path(Industry.friendly.find_by(name: name))
p.mb-1
= 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
h6.offset-md-4
= paginate @jobs, window: 1
......@@ -21,4 +24,4 @@
h6.offset-md-4.px-5
= page_entries_info @jobs
h6.offset-md-4
= paginate @jobs, window: 1
\ No newline at end of file
= paginate @jobs, window: 1
......@@ -26,7 +26,7 @@ h3.p-2
.row.my-3.text-center.fs-5
- @cities.each do |name, amount|
.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
= amount
.d-flex.flex-row-reverse.
......@@ -36,7 +36,7 @@ h3.p-2
.row.my-3.text-center.fs-5
- @industries.each do |name, amount|
.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
= amount
.d-flex.flex-row-reverse
......
Rails.application.routes.draw do
root 'top#home'
get 'cities', to: 'city#list_city'
get 'industries', to: 'industry#list_industry'
scope '/jobs' do
resources :city, :industry, param: :slug
end
get 'cities', to: 'cities#show'
get 'industries', to: 'industries#show'
get 'jobs/city/:city_slug', to: 'jobs#show', as: 'city_slug'
get 'jobs/industry/:industry_slug', to: 'jobs#show', as: 'industry_slug'
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