Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venjob_thanhnd
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
3
Merge Requests
3
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
thanhnd
venjob_thanhnd
Commits
1dd5543f
Commit
1dd5543f
authored
Feb 24, 2020
by
thanhnd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toppage 20200224
parent
163cba16
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
13 deletions
+78
-13
app/assets/stylesheets/application.css
+29
-0
app/controllers/toppage_controller.rb
+4
-2
app/models/industry.rb
+1
-0
app/views/layouts/application.html.erb
+1
-1
app/views/toppage/index.html.erb
+40
-10
lib/tasks/crawler.rake
+3
-0
No files found.
app/assets/stylesheets/application.css
View file @
1dd5543f
...
@@ -21,6 +21,34 @@ body {
...
@@ -21,6 +21,34 @@ body {
margin
:
0
;
margin
:
0
;
background
:
#f2f6e9
;
background
:
#f2f6e9
;
}
}
.rowtp
{
color
:
red
;
text-transform
:
uppercase
;
text-align
:
center
;
margin
:
auto
;
width
:
50%
;
border
:
3px
solid
green
;
padding
:
10px
;
}
ul
.class-name
li
{
float
:
left
;
width
:
50%
;
}
.text
{
display
:
block
;
overflow
:
hidden
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
}
#banner
{
overflow
:
hidden
;
background-image
:
url(https://ads.careerbuilder.vn/www/images/64ad182ac0b52d0f4c9bcc2bc24beb6b.jpg)
;
background-size
:
100%
100%
;
}
/*--- navigation bar ---*/
/*--- navigation bar ---*/
.navbar
{
.navbar
{
background
:
#262626
background
:
#262626
...
@@ -39,3 +67,4 @@ body {
...
@@ -39,3 +67,4 @@ body {
.navbar-collapse
{
.navbar-collapse
{
justify-content
:
flex-end
;
justify-content
:
flex-end
;
}
}
app/controllers/toppage_controller.rb
View file @
1dd5543f
class
ToppageController
<
ApplicationController
class
ToppageController
<
ApplicationController
def
index
def
index
end
@totaljob
=
Job
.
all
.
count
@latestjobs
=
Job
.
order
(
:last_updated
).
first
(
5
)
def
new
@topjobbyindustry
=
Job
.
select
(
"industry_id, job_name"
)
.
#@topindustry = Industry.where(INNER JOIN Job ON Job.industry_id = Industry.id).count(industry_name).order("orders_count DESC")
end
end
end
end
app/models/industry.rb
View file @
1dd5543f
class
Industry
<
ApplicationRecord
class
Industry
<
ApplicationRecord
has_many
:industry_jobs
has_many
:industry_jobs
has_many
:jobs
validates_presence_of
:industry_name
validates_presence_of
:industry_name
end
end
app/views/layouts/application.html.erb
View file @
1dd5543f
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<body>
<body>
<div
class=
"container p-0 my-2 "
>
<div
class=
"container p-0 my-2 "
>
<nav
class=
"navbar navbar-expand-md"
>
<nav
class=
"navbar navbar-expand-md"
>
<a
class=
"navbar-brand"
href=
"#"
>
Logo
</a>
<a
class=
"navbar-brand"
href=
"#"
>
<img
src=
"https://www.w3schools.com/images/w3schools_green.jpg"
alt=
"W3Schools.com"
style=
"width:104px;height:142px;"
>
</a>
<button
class=
"navbar-toggler navbar-dark"
type=
"button"
data-toggle=
"collapse"
data-target=
"#main-navigation"
>
<button
class=
"navbar-toggler navbar-dark"
type=
"button"
data-toggle=
"collapse"
data-target=
"#main-navigation"
>
</button>
</button>
<div
class=
"collapse navbar-collapse"
id=
"main-navigation"
>
<div
class=
"collapse navbar-collapse"
id=
"main-navigation"
>
...
...
app/views/toppage/index.html.erb
View file @
1dd5543f
<div
class=
"container p-5 my-2 bg-secondary text-white"
>
<div
id=
"banner"
class=
"container p-5 my-2 bg-secondary text-white"
>
<img
src=
"/app/assets/images/workspace.jpg"
class=
"img-fluid"
alt=
"Responsive image"
>
<div
class=
"rowtp"
)
>
<label>
Total Jobs:
<%=
@totaljob
%>
</label>
</div>
</div>
</div>
<div
class=
"container p-5 my-2 bg-secondary text-white"
>
<div
id=
"search"
class=
"container p-5 my-2 bg-secondary text-white"
>
<h1>
My First Bootstrap Page
</h1>
</div>
</div>
<div
class=
"container p-5 my-2 bg-secondary text-white"
>
<div
id=
"latestjobs"
class=
"container p-5 my-2 bg-secondary text-white"
>
<h1>
My First Bootstrap Page
</h1>
<font
color=
"red"
><b><label
>
Latest Jobs:
</label></b></font>
<%
@latestjobs
.
each
do
|
j
|
%>
<ul>
<li>
<%=
j
.
job_name
%>
</li>
<li>
<%=
j
.
salary
.
to_s
%>
</li>
<li>
<%=
j
.
experience
%>
</li>
<li>
<%=
j
.
last_updated
%>
</li>
<li
><span
class=
"text"
>
<%=
j
.
description
%>
</span></li>
</ul>
<%
end
%>
</div>
</div>
<div
class=
"container p-5 my-2 bg-secondary text-white"
>
<div
id=
"topcity"
class=
"container p-5 my-2 bg-secondary text-white"
>
<h1>
My First Bootstrap Page
</h1>
<font
color=
"red"
><b><label
>
Top Cities:
</label></b></font>
</div>
</div>
<div
class=
"container p-5 my-2 bg-secondary text-white"
>
<div
id=
"topindustry"
class=
"container p-5 my-2 bg-secondary text-white"
>
<h1>
My First Bootstrap Page
</h1>
<font
color=
"red"
><b><label
>
Top Industries:
</label></b></font>
<%
@topjobbyindustry
.
each
do
|
j
|
%>
<ul>
<li>
<%=
j
.
industry_id
%>
</li>
</ul>
<%
end
%>
</div>
</div>
</div>
lib/tasks/crawler.rake
View file @
1dd5543f
...
@@ -60,6 +60,9 @@ namespace :crawler do
...
@@ -60,6 +60,9 @@ namespace :crawler do
#insert data to Jobs table
#insert data to Jobs table
Job
.
find_or_create_by
(
area_id:
area
.
id
,
city_id:
city
.
id
,
industry_id:
industry
.
id
,
company_id:
company
.
id
,
job_name:
title
.
text
,
salary:
salary
.
text
,
deadline:
deadline
.
text
,
level:
level
.
text
,
experience:
experience
.
text
.
strip
,
last_updated:
updated_date
.
text
.
strip
,
description:
description
.
text
)
Job
.
find_or_create_by
(
area_id:
area
.
id
,
city_id:
city
.
id
,
industry_id:
industry
.
id
,
company_id:
company
.
id
,
job_name:
title
.
text
,
salary:
salary
.
text
,
deadline:
deadline
.
text
,
level:
level
.
text
,
experience:
experience
.
text
.
strip
,
last_updated:
updated_date
.
text
.
strip
,
description:
description
.
text
)
#industryjob = IndustryJob.find_or_create_by(industry_id: industry.industry_id , job_id: job.job_id)
end
end
list_url
=
nextpage
[
0
][
"href"
]
list_url
=
nextpage
[
0
][
"href"
]
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