Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VeNJOB
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
0
Merge Requests
0
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
Nguyen Hoang Mai Phuong
VeNJOB
Commits
407d8972
Commit
407d8972
authored
Jul 27, 2021
by
Nguyen Hoang Mai Phuong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
07c58858
Pipeline
#1366
failed with stages
in 0 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
77 additions
and
50 deletions
+77
-50
Gemfile
+0
-3
Gemfile.lock
+0
-4
app/assets/stylesheets/custom.scss
+19
-13
app/controllers/top_controller.rb
+3
-3
app/helpers/top_helper.rb
+0
-2
app/models/city.rb
+3
-0
app/models/industry.rb
+2
-0
app/models/job.rb
+2
-0
app/views/top/home.html.slim
+17
-24
db/schema.rb
+31
-1
No files found.
Gemfile
View file @
407d8972
...
...
@@ -7,10 +7,7 @@ ruby '3.0.1'
gem
'
rails
'
,
'~> 6.1.3'
,
'>= 6.1.3.2'
gem
'
bootstrap
'
,
'~> 5.0.1'
gem
'
nokogiri
'
,
'~> 1.11'
,
'>= 1.11.7'
gem
'
html2slim
'
gem
'
slim-rails
'
# Use sqlite3 as the database for Active Record
gem
'
mysql2
'
,
'~> 0.5.3'
# Use Puma as the app server
...
...
Gemfile.lock
View file @
407d8972
...
...
@@ -90,9 +90,6 @@ GEM
ffi (1.15.3)
globalid (0.4.2)
activesupport (>= 4.2.0)
hpricot (0.8.6)
html2slim (0.2.0)
hpricot
i18n (1.8.10)
concurrent-ruby (~> 1.0)
jbuilder (2.11.2)
...
...
@@ -226,7 +223,6 @@ DEPENDENCIES
bootstrap (~> 5.0.1)
byebug
capybara (>= 3.26)
html2slim
jbuilder (~> 2.7)
listen (~> 3.3)
mysql2 (~> 0.5.3)
...
...
app/assets/stylesheets/custom.scss
View file @
407d8972
...
...
@@ -7,22 +7,25 @@
margin-left
:
80px
;
padding-top
:
10px
;
padding-bottom
:
10px
;
}
.navbar
ul
li
a
{
color
:
rgb
(
255
,
255
,
255
);
font-size
:
18px
;
font-weight
:
bold
;
padding
:
4px
15px
;
color
:
#fff
;
font-size
:
18px
;
font-weight
:
bold
;
padding
:
4px
15px
;
text-decoration
:
none
;
&
:hover
{
color
:
rgb
(
107
,
107
,
107
);
text-decoration
:
none
;
&
:hover
{
color
:
rgb
(
107
,
107
,
107
);
text-decoration
:
none
;
}
}
.container
a
{
.container
p
{
font-weight
:
400
;
font-size
:
medium
;
}
a
{
color
:
rgb
(
14
,
14
,
14
);
text-decoration
:
none
;
&
:hover
{
...
...
@@ -30,7 +33,9 @@
}
}
.more
{
color
:
rgb
(
52
,
119
,
219
);
text-align
:
right
;
font-weight
:
500
;
font-size
:
20px
;
}
\ No newline at end of file
app/controllers/top_controller.rb
View file @
407d8972
class
TopController
<
ApplicationController
def
home
@job
=
Job
.
join
s
(
:cities
).
order
(
'created_at DESC'
).
limit
(
5
)
@city
=
City
.
join
s
(
:jobs
).
group
(
:name
).
order
(
'count_all DESC'
).
count
.
take
(
9
)
@industry
=
Industry
.
join
s
(
:jobs
).
group
(
:name
).
order
(
'count_all DESC'
).
count
.
take
(
9
)
@job
=
Job
.
join
_order
@city
=
City
.
join
_group
@industry
=
Industry
.
join
_group
end
end
app/helpers/top_helper.rb
deleted
100644 → 0
View file @
07c58858
module
TopHelper
end
app/models/city.rb
View file @
407d8972
...
...
@@ -2,4 +2,7 @@ class City < ApplicationRecord
belongs_to
:region
has_and_belongs_to_many
:jobs
has_and_belongs_to_many
:companies
LATEST_CITY_NUMBER
=
9
scope
:join_group
,
->
{
joins
(
:jobs
).
group
(
:name
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_CITY_NUMBER
)
}
end
app/models/industry.rb
View file @
407d8972
class
Industry
<
ApplicationRecord
has_and_belongs_to_many
:jobs
LATEST_INDUSTRY_NUMBER
=
9
scope
:join_group
,
->
{
joins
(
:jobs
).
group
(
:name
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_INDUSTRY_NUMBER
)
}
end
app/models/job.rb
View file @
407d8972
...
...
@@ -5,4 +5,6 @@ class Job < ApplicationRecord
has_many
:history_jobs
has_and_belongs_to_many
:industries
has_and_belongs_to_many
:cities
LATEST_JOB_NUMBER
=
5
scope
:join_order
,
->
{
joins
(
:cities
).
order
(
'created_at DESC'
).
limit
(
LATEST_JOB_NUMBER
)
}
end
app/views/top/home.html.slim
View file @
407d8972
...
...
@@ -4,8 +4,7 @@
.input-group.py-3
input
.form-control.rounded
[
type
=
"search"
placeholder
=
"Search . . ."
aria-label
=
"Search"
aria-describedby
=
"search-addon"
]
button
.btn.btn-outline-primary
[
type
=
"button"
]
|
search
|
search
h4
.py-4
|
Latest Jobs
-
@job
.
each
do
|
job
|
...
...
@@ -13,40 +12,33 @@
.card-body.text-dark
h5
.mb-1
=
link_to
job
.
title
,
"#"
h6
.mb-1
p
.mb-1
=
link_to
job
.
company
.
name
,
"#"
h6
.mb-1
p
.mb-1
i
.fas.fa-dollar-sign.m-1
|
Lương:
=
job
.
salary
h6
.mb-1
p
.mb-1
i
.fas.fa-map-marker-alt.m-1
-
job
.
cities
.
each
do
|
city
|
=
city
.
name
h4
|
Top Cities
.row.my-3.text-center
-
@city
.
each
do
|
name
,
amount
|
.col-4.p-2.border.mb-1
.row.my-3.text-center
.fs-5
-
@city
.
each
do
|
name
,
amount
|
.col-4.p-2.border.mb-1
.fw-normal
=
link_to
name
,
"#"
p
.mb-1
=
amount
.d-flex.flex-row-reverse.p-2
=
link_to
'All Cities'
,
"#"
.d-flex.flex-row-reverse.
=
link_to
'All Cities'
,
"#"
,
class:
"more"
h4
|
Top Industries
.row.my-3.text-center
-
@industry
.
each
do
|
name
,
amount
|
.col-4.p-2.border.mb-1
.row.my-3.text-center
.fs-5
-
@industry
.
each
do
|
name
,
amount
|
.col-4.p-2.border.mb-1
.fw-normal
=
link_to
name
,
"#"
p
.mb-1
=
amount
.d-flex.flex-row-reverse.p-2
=
link_to
'All Industries'
,
"#"
.d-flex.flex-row-reverse
=
link_to
'All Industries'
,
"#"
,
class:
"more"
\ No newline at end of file
db/schema.rb
View file @
407d8972
...
...
@@ -10,7 +10,35 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2021_07_23_035105
)
do
ActiveRecord
::
Schema
.
define
(
version:
2021_07_26_154353
)
do
create_table
"active_storage_attachments"
,
charset:
"utf8mb4"
,
collation:
"utf8mb4_0900_ai_ci"
,
force: :cascade
do
|
t
|
t
.
string
"name"
,
null:
false
t
.
string
"record_type"
,
null:
false
t
.
bigint
"record_id"
,
null:
false
t
.
bigint
"blob_id"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
t
.
index
[
"blob_id"
],
name:
"index_active_storage_attachments_on_blob_id"
t
.
index
[
"record_type"
,
"record_id"
,
"name"
,
"blob_id"
],
name:
"index_active_storage_attachments_uniqueness"
,
unique:
true
end
create_table
"active_storage_blobs"
,
charset:
"utf8mb4"
,
collation:
"utf8mb4_0900_ai_ci"
,
force: :cascade
do
|
t
|
t
.
string
"key"
,
null:
false
t
.
string
"filename"
,
null:
false
t
.
string
"content_type"
t
.
text
"metadata"
t
.
string
"service_name"
,
null:
false
t
.
bigint
"byte_size"
,
null:
false
t
.
string
"checksum"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
t
.
index
[
"key"
],
name:
"index_active_storage_blobs_on_key"
,
unique:
true
end
create_table
"active_storage_variant_records"
,
charset:
"utf8mb4"
,
collation:
"utf8mb4_0900_ai_ci"
,
force: :cascade
do
|
t
|
t
.
bigint
"blob_id"
,
null:
false
t
.
string
"variation_digest"
,
null:
false
t
.
index
[
"blob_id"
,
"variation_digest"
],
name:
"index_active_storage_variant_records_uniqueness"
,
unique:
true
end
create_table
"apply_jobs"
,
charset:
"utf8mb4"
,
collation:
"utf8mb4_0900_ai_ci"
,
force: :cascade
do
|
t
|
t
.
bigint
"user_id"
,
null:
false
...
...
@@ -121,6 +149,8 @@ ActiveRecord::Schema.define(version: 2021_07_23_035105) do
t
.
datetime
"updated_at"
,
precision:
6
,
null:
false
end
add_foreign_key
"active_storage_attachments"
,
"active_storage_blobs"
,
column:
"blob_id"
add_foreign_key
"active_storage_variant_records"
,
"active_storage_blobs"
,
column:
"blob_id"
add_foreign_key
"apply_jobs"
,
"jobs"
add_foreign_key
"apply_jobs"
,
"users"
add_foreign_key
"cities"
,
"regions"
...
...
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