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
1
Merge Requests
1
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 Sỹ Hoàng
VenJob
Commits
152daa6c
Commit
152daa6c
authored
Dec 20, 2019
by
Đường Sỹ Hoàng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First commit
parent
bfdd8fe0
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
95 additions
and
26 deletions
+95
-26
app/assets/stylesheets/custom.scss
+4
-4
app/controllers/top_controller.rb
+7
-3
app/models/city.rb
+1
-1
app/models/industry.rb
+1
-1
app/models/job.rb
+2
-1
app/views/cities/_cities_list.html.erb
+10
-0
app/views/cities/_city.html.erb
+4
-2
app/views/cities/_international_list.html.erb
+6
-0
app/views/industries/_industry.html.erb
+4
-2
app/views/top/_job.html.erb
+1
-1
app/views/top/cities.html.erb
+41
-0
app/views/top/index.html.erb
+13
-11
config/routes.rb
+1
-0
No files found.
app/assets/stylesheets/custom.scss
View file @
152daa6c
...
@@ -53,14 +53,14 @@ h1, h2, h3, h4, h5, h6 {
...
@@ -53,14 +53,14 @@ h1, h2, h3, h4, h5, h6 {
}
}
.row
{
.row
{
padding
:
5
px
;
padding
:
10
px
;
margin
:
5
px
;
margin
:
10
px
;
background-color
:
$sub-color
;
background-color
:
$sub-color
;
}
}
.col-sm
{
.col-sm
{
margin
:
5
px
;
margin
:
10
px
;
padding
:
5
px
;
padding
:
10
px
;
background-color
:
$primary-color
;
background-color
:
$primary-color
;
}
}
...
...
app/controllers/top_controller.rb
View file @
152daa6c
class
TopController
<
ApplicationController
class
TopController
<
ApplicationController
def
index
def
index
@latest_jobs
=
Job
.
latest_jobs
.
take
(
Settings
.
top
.
job
.
limit
)
@latest_jobs
=
Job
.
latest_jobs
@top_cities
=
City
.
sort_top_cities
.
take
(
Settings
.
top
.
city
.
limit
)
@top_cities
=
City
.
sort_top_cities
@top_industries
=
Industry
.
sort_top_industries
.
take
(
Settings
.
top
.
industry
.
limit
)
@top_industries
=
Industry
.
sort_top_industries
end
def
cities
@top_cities
=
City
.
sort_top_cities
end
end
end
end
app/models/city.rb
View file @
152daa6c
...
@@ -3,7 +3,7 @@ class City < ApplicationRecord
...
@@ -3,7 +3,7 @@ class City < ApplicationRecord
has_many
:jobs
,
through: :city_jobs
has_many
:jobs
,
through: :city_jobs
def
self
.
sort_top_cities
def
self
.
sort_top_cities
@cities
||=
all
.
sort_by
(
&
:jobs_count
).
re
verse
@cities
||=
all
.
sort_by
(
&
:jobs_count
).
re
ject
{
|
city
|
city
.
jobs_count
==
0
}.
reverse
.
take
(
Settings
.
top
.
city
.
limit
)
end
end
def
jobs_count
def
jobs_count
...
...
app/models/industry.rb
View file @
152daa6c
...
@@ -3,7 +3,7 @@ class Industry < ApplicationRecord
...
@@ -3,7 +3,7 @@ class Industry < ApplicationRecord
has_many
:jobs
,
through: :industry_jobs
has_many
:jobs
,
through: :industry_jobs
def
self
.
sort_top_industries
def
self
.
sort_top_industries
@industries
||=
all
.
sort_by
(
&
:jobs_count
).
reverse
@industries
||=
all
.
sort_by
(
&
:jobs_count
).
reverse
.
take
(
Settings
.
top
.
industry
.
limit
)
end
end
def
jobs_count
def
jobs_count
...
...
app/models/job.rb
View file @
152daa6c
...
@@ -3,6 +3,7 @@ class Job < ApplicationRecord
...
@@ -3,6 +3,7 @@ class Job < ApplicationRecord
has_many
:city_jobs
has_many
:city_jobs
def
self
.
latest_jobs
def
self
.
latest_jobs
@latest
||=
Job
.
order
(
created_at: :desc
)
@latest
||=
order
(
created_at: :desc
).
take
(
Settings
.
top
.
job
.
limit
)
end
end
end
end
app/views/cities/_cities_list.html.erb
0 → 100644
View file @
152daa6c
<div
class=
"container"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"col-sm"
>
<div
class=
"text-center"
>
<%=
cities_list
.
name
%>
(
<%=
cities_list
.
jobs_count
%>
)
</div>
</div>
</div>
</div>
app/views/cities/_city.html.erb
View file @
152daa6c
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"col-sm"
>
<div
class=
"col"
>
<div
class=
"text-center"
>
<%=
city
.
name
%>
<%=
city
.
name
%>
(
<%=
city
.
jobs
.
count
%>
)
(
<%=
city
.
jobs_count
%>
)
</div>
</div>
</div>
</div>
</div>
</div>
</div>
app/views/cities/_international_list.html.erb
0 → 100644
View file @
152daa6c
<div
class=
"container"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"col-sm"
>
</div>
</div>
</div>
app/views/industries/_industry.html.erb
View file @
152daa6c
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"col-sm"
>
<div
class=
"col"
>
<div
class=
"text-center"
>
<%=
industry
.
name
%>
<%=
industry
.
name
%>
(
<%=
industry
.
jobs
.
count
%>
)
(
<%=
industry
.
jobs_count
%>
)
</div>
</div>
</div>
</div>
</div>
</div>
</div>
app/views/top/_job.html.erb
View file @
152daa6c
<div
class=
"row align-items-center"
>
<div
class=
"row align-items-center"
>
<div
class=
"col"
>
<div
class=
"col"
>
<
%=
job
.
title
%
>
<
div
class=
"text-center"
>
<%=
job
.
title
%>
</div
>
</div>
</div>
</div>
</div>
</br>
</br>
app/views/top/cities.html.erb
0 → 100644
View file @
152daa6c
<div
class=
"center jumbotron"
>
<head>
<title>
<%=
yield
(
:title
)
%>
Venjob
</title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
</head>
</div>
<!--Display regions list-->
<div
class=
"area-title-wrapper"
>
<h3>
City List
</h3>
</div>
<div
class=
"area-content-wrapper"
>
<div
class=
"row row-cols-2"
>
<div><h5><a
href=
"#vietnam"
>
Viet Nam
</a></h5></div>
<div><h5><a
href=
"#international"
>
International
</a></h5></div>
</div>
</div>
</br>
<!--Display cities of Vietnam-->
<div
class=
"area-title-wrapper"
>
<h3>
Viet Nam
</h3>
</div>
<div
id=
"vietnam"
>
<div
class=
"row row-cols-3"
>
<%=
render
partial:
"cities/cities_list"
,
collection:
@top_cities
%>
</div>
</div>
</br>
<!--Display cities of International-->
<div
class=
"area-title-wrapper"
>
<h3>
International
</h3>
</div>
<div
id=
"international"
>
<div
class=
"row row-cols-3"
>
<%=
render
partial:
"cities/international_list"
%>
</div>
</div>
app/views/top/index.html.erb
View file @
152daa6c
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
</div>
</div>
</head>
</head>
</div>
</div>
<!-- List of latest jobs-->
<!-- List of latest jobs-->
<div
class=
"Job list"
>
<div
class=
"Job list"
>
<div
class=
"Job-title-wrapper"
>
<div
class=
"Job-title-wrapper"
>
...
@@ -17,27 +18,29 @@
...
@@ -17,27 +18,29 @@
<%=
render
partial:
"top/job"
,
collection:
@latest_jobs
%>
<%=
render
partial:
"top/job"
,
collection:
@latest_jobs
%>
</div>
</div>
</div>
</div>
</br>
</br>
<!--List of top cities-->
<!--List of top cities-->
<div
class=
"City list"
>
<div
class=
"City-title-wrapper"
>
<div
class=
"City-title-wrapper"
>
<h3>
Top Cities
</h3>
<h3>
Top Cities
</h3>
</div>
</div>
<div
class=
"C
ity-content-wrapper"
>
<div
class=
"c
ity-content-wrapper"
>
<div
class=
"row row-cols-3"
>
<div
class=
"row row-cols-3"
>
<%=
render
partial:
"cities/city"
,
collection:
@top_cities
%>
<%=
render
partial:
"cities/city"
,
collection:
@top_cities
%>
<form
class=
"form-inline-city"
>
<form
class=
"form-inline-city"
>
<button
class=
"btn btn-outline-success"
type=
"button"
>
All cities
</button
>
<%=
link_to
"All cties"
,
cities_path
,
class
:"btn btn-outline-success"
%
>
</form>
</form>
</div>
</div>
</div>
</div>
</div>
</br>
</br>
<div
class=
"Industry list"
>
<div
class=
"Industry-title-wrapper"
>
<!--List of top industries-->
<div
class=
"industry-title-wrapper"
>
<h3>
Top Industries
</h3>
<h3>
Top Industries
</h3>
</div>
</div>
<div
class=
"I
ndustry-content-wrapper"
>
<div
class=
"i
ndustry-content-wrapper"
>
<div
class=
"row row-cols-3"
>
<div
class=
"row row-cols-3"
>
<%=
render
partial:
"industries/industry"
,
collection:
@top_industries
%>
<%=
render
partial:
"industries/industry"
,
collection:
@top_industries
%>
<form
class=
"form-inline-industry"
>
<form
class=
"form-inline-industry"
>
...
@@ -45,5 +48,4 @@
...
@@ -45,5 +48,4 @@
</form>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
config/routes.rb
View file @
152daa6c
Rails
.
application
.
routes
.
draw
do
Rails
.
application
.
routes
.
draw
do
root
"top#index"
root
"top#index"
get
"/cities"
,
to:
"top#cities"
resource
:top
,
only: :index
resource
:top
,
only: :index
devise_for
:users
devise_for
:users
end
end
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