Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venjob_nth
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ngô Trung Hưng
venjob_nth
Commits
6d4d7392
Commit
6d4d7392
authored
Aug 05, 2020
by
Ngô Trung Hưng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
..
parent
4036163b
Pipeline
#816
canceled with stages
in 0 seconds
Changes
12
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
39 additions
and
21 deletions
+39
-21
app/common/slug.rb
+1
-1
app/controllers/job_controller.rb
+1
-1
app/models/city.rb
+5
-0
app/models/company.rb
+5
-0
app/models/industry.rb
+5
-0
app/views/city/_block_city_jobs.html.erb
+1
-1
app/views/home/_box_nine_city.html.erb
+2
-2
app/views/home/_box_nine_industries.html.erb
+2
-2
app/views/industry/_block_industry.html.erb
+1
-1
config/routes.rb
+1
-1
db/schema.rb
+14
-11
lib/tasks/crawler.rake
+1
-1
No files found.
app/
service
/slug.rb
→
app/
common
/slug.rb
View file @
6d4d7392
module
Slug
def
to_slug
(
str
)
def
self
.
to_slug
(
str
)
str
=
str
.
to_s
.
strip
.
downcase
accents
=
{
%w[à á ạ ả ã â ầ ấ ậ ẩ ẫ ă ằ ắ ặ ẳ ẵ]
=>
'a'
,
...
...
app/controllers/job_controller.rb
View file @
6d4d7392
...
...
@@ -6,7 +6,7 @@ class JobController < ApplicationController
def
index
model
=
params
[
:model
].
classify
.
constantize
obj
=
model
.
find
(
params
[
:id
])
obj
=
model
.
find
_by
(
slug:
params
[
:slug
])
result
(
obj
)
end
...
...
app/models/city.rb
View file @
6d4d7392
...
...
@@ -2,6 +2,7 @@
# Description/Explanation of Person class
class
City
<
ApplicationRecord
before_save
:convert_to_slug
RANGE
=
69
has_many
:city_jobs
has_many
:jobs
,
through: :city_jobs
...
...
@@ -14,4 +15,8 @@ class City < ApplicationRecord
.
order
(
Arel
.
sql
(
'count(jobs.id) DESC'
))
.
take
(
number
)
end
def
convert_to_slug
self
.
slug
=
Slug
.
to_slug
(
self
.
name
)
end
end
app/models/company.rb
View file @
6d4d7392
...
...
@@ -3,5 +3,10 @@
# Description/Explanation of Person class
class
Company
<
ApplicationRecord
COMPANY_SECURITY
=
1
before_save
:convert_to_slug
has_many
:jobs
def
convert_to_slug
self
.
slug
=
Slug
.
to_slug
(
self
.
name
)
end
end
app/models/industry.rb
View file @
6d4d7392
...
...
@@ -2,6 +2,7 @@
# Description/Explanation of Person class
class
Industry
<
ApplicationRecord
before_save
:convert_to_slug
has_many
:industry_jobs
has_many
:jobs
,
through: :industry_jobs
scope
:top_industries
,
->
(
number
)
do
joins
(
:jobs
)
...
...
@@ -9,4 +10,8 @@ class Industry < ApplicationRecord
.
order
(
Arel
.
sql
(
'count(jobs.id) DESC'
))
.
take
(
number
)
end
def
convert_to_slug
self
.
slug
=
Slug
.
to_slug
(
self
.
name
)
end
end
app/views/city/_block_city_jobs.html.erb
View file @
6d4d7392
...
...
@@ -2,7 +2,7 @@
<div
class=
"col-lg-3 col-md-4"
>
<div
class=
"box_cityjobs"
>
<div
class=
"box_cityjobs_name"
>
<%=
link_to
city
.
name
,
jobs_path
(
model:
'city'
,
id:
city
.
id
),
class:
'cityjobs_link'
%>
<%=
link_to
city
.
name
,
jobs_path
(
model:
'city'
,
slug:
city
.
slug
),
class:
'cityjobs_link'
%>
</div>
<div
class=
"box_cityjobs_count"
>
<span>
<%=
city
.
jobs
.
count
%>
Công việc
</span>
...
...
app/views/home/_box_nine_city.html.erb
View file @
6d4d7392
...
...
@@ -9,10 +9,10 @@
<div
class=
"box_info_city"
>
<div
class=
"ct_name"
>
<!--
<%=
link_to
city
.
name
,
"/jobs/city/
#{
city
.
id
}
"
,
class:
'link_ct'
%>
-->
<%=
link_to
city
.
name
,
jobs_path
(
model:
'city'
,
id:
city
.
id
),
class:
'link_ct'
%>
<%=
link_to
city
.
name
,
jobs_path
(
model:
'city'
,
slug:
city
.
slug
),
class:
'link_ct'
%>
</div>
<div
class=
"ct_jobs_count"
>
<%=
link_to
"
#{
city
.
jobs
.
count
}
công việc"
,
jobs_path
(
model:
'city'
,
id:
city
.
id
),
class:
'link_ct'
%>
<%=
link_to
"
#{
city
.
jobs
.
count
}
công việc"
,
jobs_path
(
model:
'city'
,
slug:
city
.
slug
),
class:
'link_ct'
%>
</div>
</div>
</div>
...
...
app/views/home/_box_nine_industries.html.erb
View file @
6d4d7392
...
...
@@ -8,10 +8,10 @@
<div
class=
"col-lg-4 col-md-4 col-sm-6 col-xs-12"
>
<div
class=
"box_info_city"
>
<div
class=
"ct_name"
>
<%=
link_to
industry
.
name
,
jobs_path
(
model:
'industry'
,
id:
industry
.
id
),
class:
'link_ct'
%>
<%=
link_to
industry
.
name
,
jobs_path
(
model:
'industry'
,
slug:
industry
.
slug
),
class:
'link_ct'
%>
</div>
<div
class=
"ct_jobs_count"
>
<%=
link_to
"
#{
industry
.
jobs
.
count
}
công việc"
,
jobs_path
(
model:
'industry'
,
id:
industry
.
id
),
class:
'link_ct'
%>
<%=
link_to
"
#{
industry
.
jobs
.
count
}
công việc"
,
jobs_path
(
model:
'industry'
,
slug:
industry
.
slug
),
class:
'link_ct'
%>
</div>
</div>
</div>
...
...
app/views/industry/_block_industry.html.erb
View file @
6d4d7392
<div
class=
"col-lg-3 col-md-4"
>
<div
class=
"box_cityjobs"
>
<div
class=
"box_cityjobs_name"
>
<%=
link_to
industry
.
name
,
jobs_path
(
model:
'industry'
,
id:
industry
.
id
),
class:
'cityjobs_link'
%>
<%=
link_to
industry
.
name
,
jobs_path
(
model:
'industry'
,
slug:
industry
.
slug
),
class:
'cityjobs_link'
%>
</div>
<div
class=
"box_cityjobs_count"
>
<span>
<%=
industry
.
jobs
.
count
%>
Công việc
</span>
...
...
config/routes.rb
View file @
6d4d7392
...
...
@@ -6,5 +6,5 @@ Rails.application.routes.draw do
get
'city/index'
# Search
get
'jobs/:model/:
id
'
,
to:
'job#index'
,
as: :jobs
get
'jobs/:model/:
slug
'
,
to:
'job#index'
,
as: :jobs
end
db/schema.rb
View file @
6d4d7392
...
...
@@ -10,9 +10,9 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2020_0
7_29_064551
)
do
ActiveRecord
::
Schema
.
define
(
version:
2020_0
8_05_075807
)
do
create_table
"applied_jobs"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"applied_jobs"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8
mb4
"
,
force: :cascade
do
|
t
|
t
.
bigint
"user_id"
t
.
bigint
"job_id"
t
.
string
"name"
...
...
@@ -24,14 +24,15 @@ ActiveRecord::Schema.define(version: 2020_07_29_064551) do
t
.
index
[
"user_id"
],
name:
"index_applied_jobs_on_user_id"
end
create_table
"cities"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"cities"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8
mb4
"
,
force: :cascade
do
|
t
|
t
.
string
"name"
t
.
integer
"area"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
string
"slug"
end
create_table
"city_jobs"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"city_jobs"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8
mb4
"
,
force: :cascade
do
|
t
|
t
.
bigint
"job_id"
t
.
bigint
"city_id"
t
.
datetime
"created_at"
,
null:
false
...
...
@@ -40,35 +41,37 @@ ActiveRecord::Schema.define(version: 2020_07_29_064551) do
t
.
index
[
"job_id"
],
name:
"index_city_jobs_on_job_id"
end
create_table
"companies"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"companies"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8
mb4
"
,
force: :cascade
do
|
t
|
t
.
string
"name"
t
.
string
"address"
t
.
text
"short_description"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
string
"slug"
end
create_table
"favorites"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"favorites"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8
mb4
"
,
force: :cascade
do
|
t
|
t
.
integer
"user_id"
t
.
integer
"job_id"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
create_table
"histories"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"histories"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8
mb4
"
,
force: :cascade
do
|
t
|
t
.
integer
"user_id"
t
.
integer
"job_id"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
create_table
"industries"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"industries"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8
mb4
"
,
force: :cascade
do
|
t
|
t
.
string
"name"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
string
"slug"
end
create_table
"industry_jobs"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"industry_jobs"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8
mb4
"
,
force: :cascade
do
|
t
|
t
.
bigint
"industry_id"
t
.
bigint
"job_id"
t
.
datetime
"created_at"
,
null:
false
...
...
@@ -77,7 +80,7 @@ ActiveRecord::Schema.define(version: 2020_07_29_064551) do
t
.
index
[
"job_id"
],
name:
"index_industry_jobs_on_job_id"
end
create_table
"jobs"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"jobs"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8
mb4
"
,
force: :cascade
do
|
t
|
t
.
string
"name"
t
.
integer
"company_id"
t
.
string
"level"
...
...
@@ -90,7 +93,7 @@ ActiveRecord::Schema.define(version: 2020_07_29_064551) do
t
.
datetime
"updated_at"
,
null:
false
end
create_table
"users"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"users"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8
mb4
"
,
force: :cascade
do
|
t
|
t
.
string
"email"
t
.
string
"name"
t
.
string
"password_digest"
...
...
lib/tasks/crawler.rake
View file @
6d4d7392
...
...
@@ -5,7 +5,7 @@ require 'open-uri'
# rake task
namespace
:crawler
do
task
populate: :environment
do
NUMBER_LINK_WILL_BE_CRAWLER
=
4
NUMBER_LINK_WILL_BE_CRAWLER
=
7
Company
.
find_or_create_by
(
name:
'Bảo mật'
)
do
|
company
|
company
.
address
=
'Vui lòng xem trong mô tả công việc'
company
.
short_description
=
'Vui lòng xem trong mô tả công việc'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment