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
Tô Ngọc Ánh
VeNJob
Commits
7a3fadae
Commit
7a3fadae
authored
Aug 03, 2020
by
Tô Ngọc Ánh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
id2 cities list
parent
28ad2bf6
Pipeline
#762
failed with stages
in 0 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
10 deletions
+57
-10
app/assets/stylesheets/application.scss
+6
-0
app/controllers/home_controller.rb
+2
-2
app/controllers/locations_controller.rb
+6
-0
app/models/location.rb
+2
-0
app/views/home/index.html.erb
+9
-7
app/views/locations/_city.html.erb
+2
-0
app/views/locations/index.html.erb
+28
-0
app/views/shared/_header.html.erb
+1
-1
config/routes.rb
+1
-0
No files found.
app/assets/stylesheets/application.scss
View file @
7a3fadae
...
...
@@ -25,4 +25,9 @@
height
:
50px
;
background-color
:
$main-color
;
}
hr
{
width
:
100px
;
border-top
:
2px
solid
$main-color
}
\ No newline at end of file
app/controllers/home_controller.rb
View file @
7a3fadae
class
HomeController
<
ApplicationController
def
index
@total_jobs
=
Job
.
count
@locations
=
Location
.
all
@industries
=
Industry
.
all
@locations
=
Location
.
select
(
:id
,
:city
)
@industries
=
Industry
.
select
(
:id
,
:name
)
@jobs
=
Job
.
order
(
created_at: :desc
).
limit
(
Job
::
NUMBER_LATEST_JOB
)
@top_cities
=
Location
.
top_locations
(
9
)
@top_industries
=
Industry
.
top_industries
(
9
)
...
...
app/controllers/locations_controller.rb
0 → 100644
View file @
7a3fadae
class
LocationsController
<
ApplicationController
def
index
@vn_cities_lists
=
Location
.
vietnam
@internal_cities_lists
=
Location
.
international
end
end
app/models/location.rb
View file @
7a3fadae
...
...
@@ -3,6 +3,8 @@ class Location < ApplicationRecord
.
group
(
:location_id
)
.
order
(
Arel
.
sql
(
'count(jobs.id) DESC'
))
.
take
(
number
)
}
scope
:international
,
->
{
where
(
oversea:
true
)
}
scope
:vietnam
,
->
{
where
(
oversea:
false
)
}
CITY_VIETNAM_NUMBER
=
70
...
...
app/views/home/index.html.erb
View file @
7a3fadae
...
...
@@ -6,22 +6,24 @@
<%=
render
'shared/searchbar'
%>
</div>
</div>
<div
id=
'latest-job'
class=
'my-4 text-center'
>
<h1>
Latest Job
</h1>
<div
id=
'latest-jobs'
class=
'my-4 text-center'
>
<h1>
Latest Jobs
</h1>
<hr>
<div
class=
'row'
>
<%=
render
partial:
'home/job'
,
collection:
@jobs
%>
</div>
<a
href=
'#'
>
All jobs
</a>
</div>
<div
id=
'top-cit
y
'
class=
'my-4 text-center'
>
<div
id=
'top-cit
ies
'
class=
'my-4 text-center'
>
<h1>
Top Cities
</h1>
<hr>
<div
class=
'row'
>
<%=
render
partial:
'
home
/city'
,
collection:
@top_cities
,
as: :location
%>
<%=
render
partial:
'
locations
/city'
,
collection:
@top_cities
,
as: :location
%>
</div>
<a
href=
'
#
'
>
All Cities
</a>
<a
href=
'
<%=
cities_path
%>
'
>
All Cities
</a>
</div>
<div
id=
'top-industr
y
'
class=
'my-4 text-center'
>
<div
id=
'top-industr
ies
'
class=
'my-4 text-center'
>
<h1>
Top Industries
</h1>
<hr>
<div
class=
'row'
>
<%=
render
partial:
'home/industry'
,
collection:
@top_industries
,
as: :industry
%>
</div>
...
...
app/views/
home
/_city.html.erb
→
app/views/
locations
/_city.html.erb
View file @
7a3fadae
<%
if
location
.
jobs
.
size
.
positive?
%>
<div
class=
'col-4 my-2'
>
<div
class=
'card'
>
<%=
link_to
'#'
,
class:
'card-body text-decoration-none'
do
%>
...
...
@@ -6,3 +7,4 @@
<%
end
%>
</div>
</div>
<%
end
%>
app/views/locations/index.html.erb
0 → 100644
View file @
7a3fadae
<div
class=
'list my-3 text-center'
>
<h2>
Area List
</h2>
<hr>
<ul
class=
'list-group list-group-horizontal'
>
<li
class=
'list-group-item'
>
<a
href=
'#vietnam'
>
Việt Nam
</a>
<span
class=
'badge badge-primary badge-pill'
>
<%=
@vn_cities_lists
.
size
%>
</span>
</li>
<li
class=
'list-group-item'
>
<a
href=
'#international'
>
International
</a>
<span
class=
'badge badge-primary badge-pill'
>
<%=
@internal_cities_lists
.
size
%>
</span>
</li>
</ul>
</div>
<div
id=
'vietnam'
class=
'text-center'
>
<h2>
Vietnam
</h2>
<hr>
<div
class=
'row'
>
<%=
render
partial:
'locations/city'
,
collection:
@vn_cities_lists
,
as: :location
%>
</div>
</div>
<div
id=
'international'
class=
'text-center'
>
<h2>
International
</h2>
<hr>
<div
class=
"row"
>
<%=
render
partial:
'locations/city'
,
collection:
@internal_cities_lists
,
as: :location
%>
</div>
</div>
app/views/shared/_header.html.erb
View file @
7a3fadae
<nav
class=
'navbar navbar-expand-lg navbar-light sticky-top'
>
<a
class=
'navbar-brand'
href=
'
#
'
>
<a
class=
'navbar-brand'
href=
'
<%=
root_path
%>
'
>
<%=
image_tag
'venjob-logo.png'
,
alt:
'VeNJob'
,
size:
'120x50'
%>
</a>
<button
class=
'navbar-toggler'
type=
'button'
data-toggle=
'collapse'
data-target=
'#navbarSupportedContent'
aria-controls=
'navbarSupportedContent'
aria-expanded=
'false'
aria-label=
'Toggle navigation'
>
...
...
config/routes.rb
View file @
7a3fadae
Rails
.
application
.
routes
.
draw
do
root
to:
'home#index'
get
'cities'
,
to:
'locations#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
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