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
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
61 additions
and
77 deletions
+61
-77
app/assets/stylesheets/custom.scss
+31
-54
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
+7
-2
app/views/layouts/_header.html.erb
+7
-10
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 */
/* universal */
$font-stack
:
Arial
,
Helvetica
,
sans-serif
;
$primary-color
:
#B6B6B6
;
$sub-color
:
gainsboro
;
body
{
body
{
margin
:
0
;
margin
:
0
;
font-family
:
Arial
,
Helvetica
,
sans-serif
;
font-family
:
$font-stack
;
}
}
/* typography */
/* typography */
h1
,
h2
,
h3
,
h4
,
h5
,
h6
{
h1
,
h2
,
h3
,
h4
,
h5
,
h6
{
line-height
:
1
;
line-height
:
1
;
}
h1
{
h1
{
font-size
:
3em
;
font-size
:
3em
;
letter-spacing
:
-2px
;
letter-spacing
:
-2px
;
margin-bottom
:
30px
;
margin-bottom
:
30px
;
text-align
:
center
;
text-align
:
center
;
}
}
h2
{
h2
{
font-size
:
1
.2em
;
font-size
:
1
.2em
;
letter-spacing
:
-1px
;
letter-spacing
:
-1px
;
margin-bottom
:
30px
;
margin-bottom
:
30px
;
text-align
:
center
;
text-align
:
center
;
font-weight
:
normal
;
font-weight
:
normal
;
color
:
#777
;
}
}
p
{
font-size
:
1.1em
;
line-height
:
1.7em
;
}
}
/* header */
/* header */
...
@@ -39,59 +35,40 @@ p {
...
@@ -39,59 +35,40 @@ p {
width
:
50%
;
width
:
50%
;
}
}
#logo
:hover
{
color
:
#fff
;
text-decoration
:
none
;
}
#banner
{
#banner
{
width
:
100%
;
width
:
100%
;
padding
:
0px
;
padding
:
0px
;
}
}
.inverse
{
.btn-outline-success
{
overflow
:
hidden
;
color
:
$sub-color
;
background-color
:
gray
;
border-color
:blue
;
}
background
:
#01548c
;
ul
{
float
:
right
;
list-style
:
none
;
list-style-type
:
none
;
margin
:
0
;
padding
:
0
;
width
:
100px
;
background-color
:
whitesmoke
;
}
}
li
{
.count-total
{
float
:
left
;
margin-right
:
500px
;
color
:
black
;
text-align
:
center
;
padding
:
12px
;
text-decoration
:
none
;
font-size
:
18px
;
line-height
:
25px
;
border-radius
:
4px
;
}
}
li
.btn-navbar
{
.col
{
display
:
block
;
padding
:
5px
;
padding
:
10px
10px
;
margin
:
5px
;
background-color
:
$primary-color
;
}
}
li
.btn-navbar
:hover
{
.row
{
background-color
:
aquamarine
;
padding
:
5px
;
text-decoration
:
none
;
margin
:
5px
;
text-align
:
cente
r
;
background-color
:
$sub-colo
r
;
}
}
.Job
{
display
:
block
;
.col-sm
{
margin
:
5px
;
padding
:
5px
;
background-color
:
$primary-color
;
}
}
div
.col
{
.form-inline-city
{
border
:
solid
1px
;
margin-left
:
1000px
;
padding
:
10px
;
padding
:
5px
;
margin
:
10px
;
background-color
:
gainsboro
;
}
}
app/controllers/jobs_controller.rb
View file @
a18a5d62
class
JobsController
<
ApplicationController
class
JobsController
<
ApplicationController
def
index
def
home
@latest_jobs
=
Job
.
latest_
city
.
take
(
5
)
@latest_jobs
=
Job
.
latest_
jobs
.
take
(
5
)
@top_cities
=
City
.
sort_top_cities
.
take
(
9
)
@top_cities
=
City
.
sort_top_cities
.
take
(
9
)
end
end
end
end
app/models/city.rb
View file @
a18a5d62
...
@@ -3,10 +3,10 @@ class City < ApplicationRecord
...
@@ -3,10 +3,10 @@ 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
).
reverse
@cities
||=
all
.
sort_by
(
&
:jobs_count
).
reverse
end
end
def
jobs_count
def
jobs_count
@jobs_count
=
jobs
.
count
@jobs_count
||
=
jobs
.
count
end
end
end
end
app/models/job.rb
View file @
a18a5d62
...
@@ -2,7 +2,7 @@ class Job < ApplicationRecord
...
@@ -2,7 +2,7 @@ class Job < ApplicationRecord
has_many
:user_jobs
has_many
:user_jobs
has_many
:city_jobs
has_many
:city_jobs
def
self
.
latest_
city
def
self
.
latest_
jobs
@latest
=
Job
.
order
(
created_at: :desc
)
@latest
=
Job
.
order
(
created_at: :desc
)
end
end
end
end
app/views/cities/_city.html.erb
View file @
a18a5d62
<div
class=
"col-md-3"
>
<div
class=
"container"
>
<div
class=
"col"
><h5>
<%=
city
.
name
%>
(
<%=
city
.
jobs
.
count
%>
)
</h5></div>
<div
class=
"row justify-content-md-center"
>
<div
class=
"col-sm"
>
<%=
city
.
name
%>
(
<%=
city
.
jobs
.
count
%>
)
</div>
</div>
</div>
</div>
app/views/jobs/_job.html.erb
View file @
a18a5d62
<div
class=
"row align-items-center"
>
<div
class=
"row align-items-center"
>
<div
class=
"col"
>
<div
class=
"col"
>
<
h5>
<%=
job
.
title
%>
</h5
>
<
%=
job
.
title
%
>
</div>
</div>
</div>
</div>
</br>
</br>
app/views/jobs/
index
.html.erb
→
app/views/jobs/
home
.html.erb
View file @
a18a5d62
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
<title>
<%=
yield
(
:title
)
%>
Venjob
</title>
<title>
<%=
yield
(
:title
)
%>
Venjob
</title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
</head>
</head>
</div>
<h4
class=
"count-total"
>
Total Jobs:
<%=
Job
.
count
%>
</h4>
<!-- 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"
>
...
@@ -15,14 +17,17 @@
...
@@ -15,14 +17,17 @@
</div>
</div>
</br>
</br>
<!--List of top cities-->
<!--List of top cities-->
<div
class=
"City list"
>
<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=
"City-content-wrapper"
>
<div
class=
"City-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"
>
<button
class=
"btn btn-outline-success"
type=
"button"
>
All cities
</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
app/views/layouts/_header.html.erb
View file @
a18a5d62
<header
class=
"navbar navbar-fixed-top navbar-inverse"
>
<header
class=
"navbar navbar-fixed-top navbar-inverse"
>
<div
class=
"container"
>
<div
class=
"container"
>
<%=
link_to
image_tag
(
"zigexn_logo.png"
,
id:
"logo"
,
alt:
"Venjob logo"
)
%>
<%=
link_to
image_tag
(
"zigexn_logo.png"
,
id:
"logo"
,
alt:
"Venjob logo"
)
%>
<nav>
<nav
class=
"navbar navbar-light bg-light"
>
<ul>
<form
class=
"form-inline"
>
<li
class=
"btn-navbar"
>
<%=
link_to
"Login"
,
'#'
%>
</li>
<button
class=
"btn btn-outline-success"
type=
"button"
>
Login
</button>
<li
class=
"btn-navbar"
>
<%=
link_to
"Register"
,
'#'
%>
</li>
<button
class=
"btn btn-outline-success"
type=
"button"
>
Register
</button>
</ul>
<button
class=
"btn btn-outline-success"
type=
"button"
>
Favorite
</button>
<ul>
<button
class=
"btn btn-outline-success"
type=
"button"
>
History
</button>
<ul>
</form>
<li
class=
"btn-navbar"
>
<%=
link_to
"Favorite"
,
'#'
%>
</li>
<li
class=
"btn-navbar"
>
<%=
link_to
"History"
,
'#'
%>
</li>
</ul>
</nav>
</nav>
<%=
link_to
image_tag
(
"banner.jpg"
,
id:
"banner"
,
alt:
"Venjob banner"
)
%>
<%=
link_to
image_tag
(
"banner.jpg"
,
id:
"banner"
,
alt:
"Venjob banner"
)
%>
</div>
</div>
...
...
config/routes.rb
View file @
a18a5d62
Rails
.
application
.
routes
.
draw
do
Rails
.
application
.
routes
.
draw
do
root
"jobs#
index
"
root
"jobs#
home
"
resource
:jobs
resource
:jobs
devise_for
:users
devise_for
:users
end
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"
...
@@ -22,8 +22,8 @@ require "csv"
job
=
Job
.
find_or_initialize_by
(
title:
row
[
"name"
],
company_id:
company
.
id
)
job
=
Job
.
find_or_initialize_by
(
title:
row
[
"name"
],
company_id:
company
.
id
)
job
.
update
(
job_params
)
job
.
update
(
job_params
)
city_params
=
{
region:
row
[
"
company provin
ce"
]
}
city_params
=
{
region:
row
[
"
work pla
ce"
]
}
city
=
City
.
find_or_initialize_by
(
name:
row
[
"
work pla
ce"
])
city
=
City
.
find_or_initialize_by
(
name:
row
[
"
company provin
ce"
])
city
.
update
(
city_params
)
city
.
update
(
city_params
)
city_job_params
=
{
city_id:
city
.
id
}
city_job_params
=
{
city_id:
city
.
id
}
city_job
=
CityJob
.
find_or_initialize_by
(
job_id:
job
.
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