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
a18a5d62
Commit
a18a5d62
authored
Dec 18, 2019
by
Đường Sỹ Hoàng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed scss& import_csv
parent
c0d06082
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
78 additions
and
94 deletions
+78
-94
app/assets/stylesheets/custom.scss
+40
-63
app/controllers/jobs_controller.rb
+2
-2
app/models/city.rb
+2
-2
app/models/job.rb
+1
-1
app/views/cities/_city.html.erb
+7
-2
app/views/jobs/_job.html.erb
+1
-1
app/views/jobs/home.html.erb
+13
-8
app/views/layouts/_header.html.erb
+9
-12
config/routes.rb
+1
-1
db/Venjob.csv
+0
-0
lib/tasks/import_job_csv.rake
+2
-2
No files found.
app/assets/stylesheets/custom.css
→
app/assets/stylesheets/custom.
s
css
View file @
a18a5d62
/* universal */
$font-stack
:
Arial
,
Helvetica
,
sans-serif
;
$primary-color
:
#B6B6B6
;
$sub-color
:
gainsboro
;
body
{
margin
:
0
;
font-family
:
Arial
,
Helvetica
,
sans-serif
;
font-family
:
$font-stack
;
}
/* typography */
h1
,
h2
,
h3
,
h4
,
h5
,
h6
{
line-height
:
1
;
}
h1
{
font-size
:
3em
;
letter-spacing
:
-2px
;
margin-bottom
:
30px
;
text-align
:
center
;
}
h2
{
font-size
:
1.2em
;
letter-spacing
:
-1px
;
margin-bottom
:
30px
;
text-align
:
center
;
font-weight
:
normal
;
color
:
#777
;
}
p
{
font-size
:
1.1em
;
line-height
:
1.7em
;
h1
{
font-size
:
3em
;
letter-spacing
:
-2px
;
margin-bottom
:
30px
;
text-align
:
center
;
}
h2
{
font-size
:
1
.2em
;
letter-spacing
:
-1px
;
margin-bottom
:
30px
;
text-align
:
center
;
font-weight
:
normal
;
}
}
/* header */
...
...
@@ -39,59 +35,40 @@ p {
width
:
50%
;
}
#logo
:hover
{
color
:
#fff
;
text-decoration
:
none
;
}
#banner
{
width
:
100%
;
padding
:
0px
;
}
.inverse
{
overflow
:
hidden
;
background-color
:
gray
;
}
ul
{
float
:
right
;
list-style
:
none
;
list-style-type
:
none
;
margin
:
0
;
padding
:
0
;
width
:
100px
;
background-color
:
whitesmoke
;
.btn-outline-success
{
color
:
$sub-color
;
border-color
:blue
;
background
:
#01548c
;
}
li
{
float
:
left
;
color
:
black
;
text-align
:
center
;
padding
:
12px
;
text-decoration
:
none
;
font-size
:
18px
;
line-height
:
25px
;
border-radius
:
4px
;
.count-total
{
margin-right
:
500px
;
}
li
.btn-navbar
{
display
:
block
;
padding
:
10px
10px
;
.col
{
padding
:
5px
;
margin
:
5px
;
background-color
:
$primary-color
;
}
li
.btn-navbar
:hover
{
background-color
:
aquamarine
;
text-decoration
:
none
;
text-align
:
cente
r
;
.row
{
padding
:
5px
;
margin
:
5px
;
background-color
:
$sub-colo
r
;
}
.Job
{
display
:
block
;
.col-sm
{
margin
:
5px
;
padding
:
5px
;
background-color
:
$primary-color
;
}
div
.col
{
border
:
solid
1px
;
padding
:
10px
;
margin
:
10px
;
background-color
:
gainsboro
;
.form-inline-city
{
margin-left
:
1000px
;
padding
:
5px
;
}
app/controllers/jobs_controller.rb
View file @
a18a5d62
class
JobsController
<
ApplicationController
def
index
@latest_jobs
=
Job
.
latest_
city
.
take
(
5
)
def
home
@latest_jobs
=
Job
.
latest_
jobs
.
take
(
5
)
@top_cities
=
City
.
sort_top_cities
.
take
(
9
)
end
end
app/models/city.rb
View file @
a18a5d62
...
...
@@ -3,10 +3,10 @@ class City < ApplicationRecord
has_many
:jobs
,
through: :city_jobs
def
self
.
sort_top_cities
@cities
||=
all
.
sort_by
(
&
:jobs_count
).
reverse
@cities
||=
all
.
sort_by
(
&
:jobs_count
).
reverse
end
def
jobs_count
@jobs_count
=
jobs
.
count
@jobs_count
||
=
jobs
.
count
end
end
app/models/job.rb
View file @
a18a5d62
...
...
@@ -2,7 +2,7 @@ class Job < ApplicationRecord
has_many
:user_jobs
has_many
:city_jobs
def
self
.
latest_
city
def
self
.
latest_
jobs
@latest
=
Job
.
order
(
created_at: :desc
)
end
end
app/views/cities/_city.html.erb
View file @
a18a5d62
<div
class=
"col-md-3"
>
<div
class=
"col"
><h5>
<%=
city
.
name
%>
(
<%=
city
.
jobs
.
count
%>
)
</h5></div>
<div
class=
"container"
>
<div
class=
"row justify-content-md-center"
>
<div
class=
"col-sm"
>
<%=
city
.
name
%>
(
<%=
city
.
jobs
.
count
%>
)
</div>
</div>
</div>
app/views/jobs/_job.html.erb
View file @
a18a5d62
<div
class=
"row align-items-center"
>
<div
class=
"col"
>
<
h5>
<%=
job
.
title
%>
</h5
>
<
%=
job
.
title
%
>
</div>
</div>
</br>
app/views/jobs/
index
.html.erb
→
app/views/jobs/
home
.html.erb
View file @
a18a5d62
...
...
@@ -3,6 +3,8 @@
<title>
<%=
yield
(
:title
)
%>
Venjob
</title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
</head>
</div>
<h4
class=
"count-total"
>
Total Jobs:
<%=
Job
.
count
%>
</h4>
<!-- List of latest jobs-->
<div
class=
"Job list"
>
<div
class=
"Job-title-wrapper"
>
...
...
@@ -15,14 +17,17 @@
</div>
</br>
<!--List of top cities-->
<div
class=
"City list"
>
<div
class=
"City-title-wrapper"
>
<h3>
Top Cities
</h3>
</div>
<div
class=
"City-content-wrapper"
>
<div
class=
"row row-cols-3"
>
<%=
render
partial:
"cities/city"
,
collection:
@top_cities
%>
<div
class=
"City list"
>
<div
class=
"City-title-wrapper"
>
<h3>
Top Cities
</h3>
</div>
<div
class=
"City-content-wrapper"
>
<div
class=
"row row-cols-3"
>
<%=
render
partial:
"cities/city"
,
collection:
@top_cities
%>
<form
class=
"form-inline-city"
>
<button
class=
"btn btn-outline-success"
type=
"button"
>
All cities
</button>
</form>
</div>
</div>
</div>
</div>
</div>
app/views/layouts/_header.html.erb
View file @
a18a5d62
<header
class=
"navbar navbar-fixed-top navbar-inverse"
>
<div
class=
"container"
>
<%=
link_to
image_tag
(
"zigexn_logo.png"
,
id:
"logo"
,
alt:
"Venjob logo"
)
%>
<nav>
<ul>
<li
class=
"btn-navbar"
>
<%=
link_to
"Login"
,
'#'
%>
</li>
<li
class=
"btn-navbar"
>
<%=
link_to
"Register"
,
'#'
%>
</li>
</ul>
<ul>
<ul>
<li
class=
"btn-navbar"
>
<%=
link_to
"Favorite"
,
'#'
%>
</li>
<li
class=
"btn-navbar"
>
<%=
link_to
"History"
,
'#'
%>
</li>
</ul>
</nav>
<nav
class=
"navbar navbar-light bg-light"
>
<form
class=
"form-inline"
>
<button
class=
"btn btn-outline-success"
type=
"button"
>
Login
</button>
<button
class=
"btn btn-outline-success"
type=
"button"
>
Register
</button>
<button
class=
"btn btn-outline-success"
type=
"button"
>
Favorite
</button>
<button
class=
"btn btn-outline-success"
type=
"button"
>
History
</button>
</form>
</nav>
<%=
link_to
image_tag
(
"banner.jpg"
,
id:
"banner"
,
alt:
"Venjob banner"
)
%>
</div>
<div
class=
"container"
>
<%=
yield
%>
<%=
yield
%>
</div>
</header>
config/routes.rb
View file @
a18a5d62
Rails
.
application
.
routes
.
draw
do
root
"jobs#
index
"
root
"jobs#
home
"
resource
:jobs
devise_for
:users
end
db/Venjob.csv
View file @
a18a5d62
This source diff could not be displayed because it is too large. You can
view the blob
instead.
lib/tasks/import_job_csv.rake
View file @
a18a5d62
...
...
@@ -22,8 +22,8 @@ require "csv"
job
=
Job
.
find_or_initialize_by
(
title:
row
[
"name"
],
company_id:
company
.
id
)
job
.
update
(
job_params
)
city_params
=
{
region:
row
[
"
company provin
ce"
]
}
city
=
City
.
find_or_initialize_by
(
name:
row
[
"
work pla
ce"
])
city_params
=
{
region:
row
[
"
work pla
ce"
]
}
city
=
City
.
find_or_initialize_by
(
name:
row
[
"
company provin
ce"
])
city
.
update
(
city_params
)
city_job_params
=
{
city_id:
city
.
id
}
city_job
=
CityJob
.
find_or_initialize_by
(
job_id:
job
.
id
)
...
...
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