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
0c9a14c9
Commit
0c9a14c9
authored
Jul 27, 2021
by
Nguyen Hoang Mai Phuong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix page-ID1
parent
407d8972
Pipeline
#1367
failed with stages
in 0 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
25 additions
and
50 deletions
+25
-50
app/controllers/top_controller.rb
+3
-3
app/models/city.rb
+1
-1
app/models/industry.rb
+1
-1
app/models/job.rb
+1
-1
app/views/layouts/_shim.html.slim
+4
-1
app/views/top/home.html.slim
+15
-11
config/routes.rb
+0
-2
db/schema.rb
+0
-30
No files found.
app/controllers/top_controller.rb
View file @
0c9a14c9
class
TopController
<
ApplicationController
def
home
@job
=
Job
.
join_order
@cit
y
=
City
.
join_group
@industr
y
=
Industry
.
join_group
@job
s
=
Job
.
latest_jobs
@cit
ies
=
City
.
top_cities
@industr
ies
=
Industry
.
top_industries
end
end
app/models/city.rb
View file @
0c9a14c9
...
...
@@ -3,6 +3,6 @@ class City < ApplicationRecord
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
)
}
scope
:
top_cities
,
->
{
joins
(
:jobs
).
group
(
:name
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_CITY_NUMBER
)
}
end
app/models/industry.rb
View file @
0c9a14c9
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
)
}
scope
:
top_industries
,
->
{
joins
(
:jobs
).
group
(
:name
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_INDUSTRY_NUMBER
)
}
end
app/models/job.rb
View file @
0c9a14c9
...
...
@@ -6,5 +6,5 @@ class Job < ApplicationRecord
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
)
}
scope
:
latest_jobs
,
->
{
includes
(
:cities
,
:company
).
order
(
'created_at DESC'
).
limit
(
LATEST_JOB_NUMBER
)
}
end
app/views/layouts/_shim.html.slim
View file @
0c9a14c9
<!
-
-
[
if
lt
IE
9
]
>
<
script
src
=
"//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js"
>
</script>
<![
endif
]--
>
app/views/top/home.html.slim
View file @
0c9a14c9
-
provide
:title
,
'Jobs'
h3
.p-2
|
Total
Jobs:
=
Job
.
all
.
count
.container
.input-group.py-3
input
.form-control.rounded
[
type
=
"search"
placeholder
=
"Search
. . .
"
aria-label
=
"Search"
aria-describedby
=
"search-addon"
]
input
.form-control.rounded
[
type
=
"search"
placeholder
=
"Search"
aria-label
=
"Search"
aria-describedby
=
"search-addon"
]
button
.btn.btn-outline-primary
[
type
=
"button"
]
|
search
h4
.py-4
|
Latest Jobs
-
@job
.
each
do
|
job
|
-
@job
s
.
each
do
|
job
|
.card.my-3
.card-body.text-dark
h5
.mb-1
...
...
@@ -20,25 +23,25 @@
=
job
.
salary
p
.mb-1
i
.fas.fa-map-marker-alt.m-1
-
job
.
cities
.
each
do
|
city
|
=
city
.
name
-
job
.
cities
.
each
do
|
job
|
=
job
.
name
h4
|
Top Cities
.row.my-3.text-center.fs-5
-
@cit
y
.
each
do
|
name
,
amount
|
-
@cit
ies
.
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.
=
link_to
'All Cities'
,
"#"
,
class:
"more"
=
link_to
'All Cities'
,
"#"
,
class:
"more"
h4
|
Top Industries
.row.my-3.text-center.fs-5
-
@industr
y
.
each
do
|
name
,
amount
|
.col-4.p-2.border.mb-1.fw-normal
=
link_to
name
,
"#"
p
.mb-1
=
amount
-
@industr
ies
.
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
=
link_to
'All Industries'
,
"#"
,
class:
"more"
\ No newline at end of file
config/routes.rb
View file @
0c9a14c9
Rails
.
application
.
routes
.
draw
do
root
'top#home'
get
'/'
,
to:
'top#home'
resources
:jobs
end
db/schema.rb
View file @
0c9a14c9
...
...
@@ -12,34 +12,6 @@
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
t
.
bigint
"job_id"
,
null:
false
...
...
@@ -149,8 +121,6 @@ ActiveRecord::Schema.define(version: 2021_07_26_154353) 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