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
2
Merge Requests
2
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
Hoang Nam Nguyen
Venjob
Commits
be5a251e
Commit
be5a251e
authored
Oct 06, 2017
by
Hoang Nam Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'finished history_page'
parent
1d758282
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
154 additions
and
70 deletions
+154
-70
app/controllers/applies_controller.rb
+18
-6
app/controllers/job_controller.rb
+4
-2
app/controllers/top_pages_controller.rb
+5
-0
app/models/history.rb
+3
-1
app/models/job.rb
+1
-0
app/models/user.rb
+1
-0
app/views/applies/confirm_apply.html.erb
+1
-1
app/views/applies/new.html.erb
+47
-42
app/views/layouts/_header.html.erb
+13
-5
app/views/top_pages/_history.html.erb
+35
-0
app/views/top_pages/history.html.erb
+11
-0
app/views/top_pages/top_page.html.erb
+9
-9
app/views/users/_my_jobs.html.erb
+3
-2
config/routes.rb
+3
-2
No files found.
app/controllers/applies_controller.rb
View file @
be5a251e
class
AppliesController
<
ApplicationController
class
AppliesController
<
ApplicationController
before_action
:set_job_id
,
only: :new
before_action
:redirect_to_root
,
unless: :logged_in?
,
only: :create
def
new
def
new
@user_apply
=
Apply
.
new
(
session
[
:apply
]
||
{})
@user_apply
=
Apply
.
new
(
session
[
:apply
]
||
{})
@apply_job
=
Job
.
find_by
(
id:
session
[
:job_id
])
end
end
def
create
def
create
return
if
current_user
.
nil?
@user_apply
=
Apply
.
new
(
user_apply_job
)
@user_apply
=
Apply
.
new
(
user_apply_job
)
@user_apply
.
job
_id
=
Job
.
find
(
params
[
:id
]).
id
@user_apply
.
job
=
Job
.
find_by
(
id:
session
[
:job_id
])
@user_apply
.
user_id
=
@current_user
.
id
@user_apply
.
user_id
=
@current_user
.
id
if
@user_apply
.
valid?
if
@user_apply
.
valid?
session
[
:apply
]
=
@user_apply
.
as_json
session
[
:apply
]
=
@user_apply
redirect_to
confirm_apply_path
redirect_to
confirm_apply_path
else
else
@apply_job
=
Job
.
find_by
(
id:
session
[
:job_id
])
render
'new'
render
'new'
end
end
end
end
def
confirm_apply
def
confirm_apply
@user_apply
=
Apply
.
new
(
session
[
:apply
])
@user_apply
=
Apply
.
new
(
session
[
:apply
])
@apply_job
=
Job
.
find_by
(
id:
session
[
:job_id
])
end
end
def
finish
def
finish
...
@@ -30,8 +34,16 @@ class AppliesController < ApplicationController
...
@@ -30,8 +34,16 @@ class AppliesController < ApplicationController
private
private
def
user_apply_job
def
redirect_to_root
params
.
require
(
:apply
).
permit
(
:email
,
:name
)
redirect_to
root_path
end
end
def
set_job_id
session
[
:job_id
]
=
params
[
:job_history_id
]
||
params
[
:job_id
]
end
def
user_apply_job
params
.
require
(
:apply
).
permit
(
:email
,
:name
)
end
end
end
app/controllers/job_controller.rb
View file @
be5a251e
...
@@ -10,7 +10,9 @@ class JobController < ApplicationController
...
@@ -10,7 +10,9 @@ class JobController < ApplicationController
def
detail
def
detail
@job
=
Job
.
find
(
params
[
:id
])
@job
=
Job
.
find
(
params
[
:id
])
@history
=
History
.
find_or_create_by
(
job_id:
@job
.
id
,
user_id:
current_user
.
id
)
if
logged_in?
@history
.
touch
(
:updated_at
)
@history
=
History
.
find_or_create_by
(
job_id:
@job
.
id
,
user_id:
current_user
.
id
)
@history
.
touch
(
:updated_at
)
end
end
end
end
end
app/controllers/top_pages_controller.rb
View file @
be5a251e
...
@@ -16,6 +16,11 @@ class TopPagesController < ApplicationController
...
@@ -16,6 +16,11 @@ class TopPagesController < ApplicationController
end
end
def
history
def
history
@user
=
current_user
@job
=
@user
.
histories
.
new_list_history
(
ENV
[
"NUMBER_HISTORY_PAGE"
])
end
def
favorite_job
end
end
def
index
def
index
...
...
app/models/history.rb
View file @
be5a251e
class
History
<
ApplicationRecord
class
History
<
ApplicationRecord
belongs_to
:user
belongs_to
:user
has_many
:jobs
belongs_to
:job
scope
:new_list_history
,
->
(
num
)
{
order
(
id: :desc
).
limit
(
num
)}
end
end
app/models/job.rb
View file @
be5a251e
...
@@ -5,6 +5,7 @@ class Job < ApplicationRecord
...
@@ -5,6 +5,7 @@ class Job < ApplicationRecord
has_many
:industries
,
through: :job_industries
has_many
:industries
,
through: :job_industries
belongs_to
:company
belongs_to
:company
has_many
:applies
has_many
:applies
has_many
:histories
scope
:recent
,
->
(
num
)
{
order
(
id: :desc
).
limit
(
num
)
}
scope
:recent
,
->
(
num
)
{
order
(
id: :desc
).
limit
(
num
)
}
end
end
app/models/user.rb
View file @
be5a251e
class
User
<
ApplicationRecord
class
User
<
ApplicationRecord
has_many
:applies
has_many
:applies
has_many
:histories
has_secure_password
(
validations:
false
)
has_secure_password
(
validations:
false
)
...
...
app/views/applies/confirm_apply.html.erb
View file @
be5a251e
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
<!--set button update -->
<!--set button update -->
<div
class=
"row ml-5 pb-5 pl-5"
>
<div
class=
"row ml-5 pb-5 pl-5"
>
<div
class=
"col-md-4 text-center "
>
<div
class=
"col-md-4 text-center "
>
<%=
link_to
form_apply_path
(
id:
@user_apply
.
job
.
id
),
class:
'btn btn-danger'
do
%>
<%=
link_to
form_apply_path
(
job_
id:
@user_apply
.
job
.
id
),
class:
'btn btn-danger'
do
%>
<i
class=
"fa fa-wrench"
></i>
Edit
<i
class=
"fa fa-wrench"
></i>
Edit
<%
end
%>
<%
end
%>
</div>
</div>
...
...
app/views/applies/new.html.erb
View file @
be5a251e
...
@@ -15,59 +15,64 @@
...
@@ -15,59 +15,64 @@
</div>
</div>
<h1
class=
"text-center text-danger"
>
Apply Form
</h1>
<h1
class=
"text-center text-danger"
>
Apply Form
</h1>
<h2
class=
"text-center"
>
<%=
@apply_job
.
try
(
:job_title
)
%>
</h2>
<%
if
current_user
.
applied_job?
(
@apply_job
)
%>
<h2
class=
"text-center text-danger mt-5"
>
You applied this job
</h2>
<%
else
%>
<div
class=
"row ml-5 mt-5"
>
<div
class=
"row ml-5 mt-5"
>
<div
class=
"col-md-10 col-md-offset-3"
>
<div
class=
"col-md-10 col-md-offset-3"
>
<!--set message errors -->
<!--set message errors -->
<!--end set -->
<!--end set -->
<!--set field all -->
<!--set field all -->
<%=
form_for
(
@user_apply
,
url:
new_info_path
)
do
|
f
|
%>
<%=
form_for
(
@user_apply
,
url:
new_info_path
)
do
|
f
|
%>
<%=
render
'shared/error_user_apply'
%>
<%=
render
'shared/error_user_apply'
%>
<div
class=
"row mt-3"
>
<div
class=
"row mt-3"
>
<!--set field password -->
<!--set field password -->
<div
class=
"col-md-2 mb-5"
>
<div
class=
"col-md-2 mb-5"
>
<strong><i
class=
"text-danger"
>
<%=
f
.
label
:name
,
"Full Name"
,
class:
'form-label'
%>
</i></strong>
<strong><i
class=
"text-danger"
>
<%=
f
.
label
:name
,
"Full Name"
,
class:
'form-label'
%>
</i></strong>
</div>
<!--set field password -->
<div
class=
"col-md-10"
>
<div
class=
"input-group"
>
<span
class=
"input-group-addon"
><i
class=
"fa fa-user fa"
aria-hidden=
"true"
></i></span>
<%=
f
.
text_field
:name
,
class:
'form-control'
%>
</div>
</div>
</div>
<!--set field password -->
<!--end set field password -->
<div
class=
"col-md-10"
>
<!--set field email -->
<div
class=
"input-group"
>
<div
class=
"col-md-2"
>
<span
class=
"input-group-addon"
><i
class=
"fa fa-user fa"
aria-hidden=
"true"
></i></span>
<strong><i
class=
"text-danger"
>
<%=
f
.
label
:email
%>
</i></strong>
<%=
f
.
text_field
:name
,
class:
'form-control'
%>
</div>
</div>
<!--set field email -->
<div
class=
"col-md-10"
>
<div
class=
"input-group"
>
<span
class=
"input-group-addon mb-5"
><i
class=
"fa fa-envelope"
aria-hidden=
"true"
></i></span>
<%=
f
.
email_field
:email
,
class:
'form-control mb-5'
%>
</div>
</div>
</div>
<!--end set field password -->
<!--end field email -->
<!--set field email -->
<div
class=
"col-md-2"
>
<div
class=
"col-md-2"
>
<strong><i
class=
"text-danger"
>
My CV
</i></strong>
<strong><i
class=
"text-danger"
>
<%=
f
.
label
:email
%>
</i></strong>
</div>
</div>
<%
if
current_user
.
cv?
%>
<!--set field email -->
<div
class=
"col-md-10 mb-5 text-center"
>
<div
class=
"col-md-10"
>
<%=
link_to
'Download cv'
,
downloadcv_path
(
id:
@current_user
.
id
)
%>
<div
class=
"input-group"
>
<span
class=
"input-group-addon mb-5"
><i
class=
"fa fa-envelope"
aria-hidden=
"true"
></i></span>
<%=
f
.
email_field
:email
,
class:
'form-control mb-5'
%>
</div>
</div>
</div>
<
%
else
%
>
<
!--end field email --
>
<div
class
=
"col-md-10 mb-5
"
>
<div
class
=
"col-md-2
"
>
<
%=
link_to
'Upload here'
,
edit_account_activation_path
(
id:
@current_user
.
id
)
%
>
<
strong><i
class=
"text-danger"
>
My CV
</i></strong
>
</div>
</div>
<%
end
%>
<%
if
current_user
.
cv?
%>
<!--end set field all -->
<div
class=
"col-md-10 mb-5 text-center"
>
<div
class=
"col-sm-2"
></div>
<%=
link_to
'Download cv'
,
downloadcv_path
(
id:
@current_user
.
id
)
%>
<div
class=
"col-sm-10"
>
</div>
<%=
button_tag
(
type:
"submit"
,
class:
"btn btn-danger btn-block"
)
do
%>
<%
else
%>
<i
class=
"fa fa-check 4px"
></i>
Confirm
<div
class =
"col-md-10 mb-5"
>
<%=
link_to
'Upload here'
,
edit_account_activation_path
(
id:
@current_user
.
id
)
%>
</div>
<%
end
%>
<%
end
%>
<!--end set field all -->
<div
class=
"col-sm-2"
></div>
<div
class=
"col-sm-10"
>
<%=
button_tag
(
type:
"submit"
,
class:
"btn btn-danger btn-block"
)
do
%>
<i
class=
"fa fa-check 4px"
></i>
Confirm
<%
end
%>
</div>
</div>
</div>
</div
>
<!--end set button --
>
<
!--end set button --
>
<
%
end
%
>
<%
end
%>
<%
end
%>
</div>
</div>
</div>
</div>
app/views/layouts/_header.html.erb
View file @
be5a251e
...
@@ -51,11 +51,19 @@
...
@@ -51,11 +51,19 @@
</li>
</li>
<%
end
%>
<%
end
%>
<li>
<%
if
logged_in?
%>
<%=
link_to
history_path
,
class:
'btn btn-info distance mt-1 no-gutters'
do
%>
<li>
<i
class=
"fa fa-history"
></i>
History
<%=
link_to
history_path
,
class:
'btn btn-info distance mt-1 no-gutters'
do
%>
<%
end
%>
<i
class=
"fa fa-history"
></i>
History
</li>
<%
end
%>
</li>
<%
else
%>
<li>
<%=
link_to
root_path
,
class:
'btn btn-info distance mt-1 no-gutters'
do
%>
<i
class=
"fa fa-history"
></i>
History
<%
end
%>
</li>
<%
end
%>
</ul>
</ul>
</div>
</div>
</div>
</div>
...
...
app/views/top_pages/_history.html.erb
0 → 100644
View file @
be5a251e
<div
class=
"container mt-5"
>
<div
class=
"row mb-5 ml-5"
>
<div
class=
"search_list titlejob col-md-10"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-1 mt-5"
>
<%=
radio_button_tag
'job_history_id'
,
history
.
job
.
id
%>
</div>
<div
class=
"col-11"
>
<%=
link_to
history
.
job
.
job_title
,
job_detail_path
(
history
.
job
.
id
),
class:
'search_list_jobs_title'
%>
<%
unless
history
.
job
.
short_description
.
nil?
%>
<li
class=
"detail_description"
>
<%=
truncate
history
.
job
.
short_description
,
length:
250
%>
<%=
link_to
'read more'
,
job_detail_path
(
history
.
job
.
id
)
%>
</li>
</li>
<%
end
%>
<div
class=
"row ml-0"
>
<li
class=
"detail_description col-md-5"
>
<%=
history
.
job
.
cities
.
map
(
&
:location
).
join
(
','
)
%>
</li>
<%
unless
history
.
job
.
salary
.
nil?
%>
<li
class=
" detail_description float-right text-success col-md-5"
>
<%=
history
.
job
.
salary
%>
</li>
<%
end
-%>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
app/views/top_pages/history.html.erb
View file @
be5a251e
<%=
provide
(
:title
,
"History"
)
%>
<%=
provide
(
:title
,
"History"
)
%>
<h1
class=
"text-danger text-center mt-5"
>
History
</h1>
<h1
class=
"text-danger text-center mt-5"
>
History
</h1>
<%=
form_tag
(
form_apply_path
,
method: :get
)
do
%>
<%=
render
partial:
"history"
,
collection:
@job
,
as: :history
%>
<div
class=
"row"
>
<div
class=
"col-sm-1"
></div>
<div
class=
"col-sm-9"
>
<%=
button_tag
(
type:
"submit"
,
class:
"btn btn-danger btn-block"
)
do
%>
<i
class=
"fa fa-key 4px"
></i>
Apply
<%
end
%>
</div>
</div>
<%
end
%>
app/views/top_pages/top_page.html.erb
View file @
be5a251e
...
@@ -6,16 +6,16 @@
...
@@ -6,16 +6,16 @@
</div>
</div>
</div>
</div>
<%=
form_tag
job_index_path
,
method: :get
do
%>
<%=
form_tag
job_index_path
,
method: :get
do
%>
<div
class=
"row search_field mt-3"
>
<div
class=
"row search_field mt-3"
>
<%=
search_field_tag
's'
,
nil
,
placeholder:
'Search...'
,
class:
'col-10 form-control'
%>
<%=
search_field_tag
's'
,
nil
,
placeholder:
'Search...'
,
class:
'col-10 form-control'
%>
<%=
submit_tag
'Search'
,
class:
'col-1 btn btn-success form-control ml-4'
%>
<%=
submit_tag
'Search'
,
class:
'col-1 btn btn-success form-control ml-4'
%>
</div>
</div>
<%
end
%>
<%
end
%>
<%
flash
.
each
do
|
key
,
value
|
%>
<%
flash
.
each
do
|
key
,
value
|
%>
<div
class=
"alert alert-
<%=
key
%>
"
>
<%=
value
%>
</div>
<div
class=
"alert alert-
<%=
key
%>
"
>
<%=
value
%>
</div>
<%
end
%>
<%
end
%>
<h1
class=
"text-success line_job"
>
Latest Jobs
</h1>
<h1
class=
"text-success line_job"
>
Latest Jobs
</h1>
<div
class=
"row"
>
<div
class=
"row"
>
...
...
app/views/users/_my_jobs.html.erb
View file @
be5a251e
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
<div
class=
"search_list titlejob col-md-10"
>
<div
class=
"search_list titlejob col-md-10"
>
<%=
link_to
apply
.
job
.
job_title
,
job_detail_path
(
apply
.
job
.
id
),
class:
'search_list_jobs_title'
%>
<%=
link_to
apply
.
job
.
job_title
,
job_detail_path
(
apply
.
job
.
id
),
class:
'search_list_jobs_title'
%>
<%
unless
apply
.
job
.
short_description
.
nil?
%>
<%
if
apply
.
job
.
short_description
.
present?
%>
<%=
binding
.
pry
%>
<li
class=
"detail_description"
>
<li
class=
"detail_description"
>
<%=
truncate
apply
.
job
.
short_description
,
length:
250
%>
<%=
truncate
apply
.
job
.
short_description
,
length:
250
%>
<%=
link_to
'read more'
,
job_detail_path
(
apply
.
job
.
id
)
%>
</li>
<%=
link_to
'read more'
,
job_detail_path
(
apply
.
job
.
id
)
%>
</li>
...
@@ -14,7 +15,7 @@
...
@@ -14,7 +15,7 @@
<li
class=
"detail_description col-md-5"
>
<li
class=
"detail_description col-md-5"
>
<%=
apply
.
job
.
cities
.
map
(
&
:location
).
join
(
','
)
%>
<%=
apply
.
job
.
cities
.
map
(
&
:location
).
join
(
','
)
%>
</li>
</li>
<%
unless
apply
.
job
.
salary
.
nil
?
%>
<%
if
apply
.
job
.
salary
.
present
?
%>
<li
class=
" detail_description float-right text-success col-md-5"
>
<li
class=
" detail_description float-right text-success col-md-5"
>
<%=
apply
.
job
.
salary
%>
<%=
apply
.
job
.
salary
%>
</li>
</li>
...
...
config/routes.rb
View file @
be5a251e
...
@@ -8,6 +8,7 @@ Rails.application.routes.draw do
...
@@ -8,6 +8,7 @@ Rails.application.routes.draw do
get
'/cities'
,
to:
'top_pages#cities'
get
'/cities'
,
to:
'top_pages#cities'
get
'/industries'
,
to:
'top_pages#industries'
get
'/industries'
,
to:
'top_pages#industries'
get
'/history'
,
to:
'top_pages#history'
get
'/history'
,
to:
'top_pages#history'
get
'/favorite'
,
to:
'top_pages#favorite_job'
get
'top_pages/cities'
get
'top_pages/cities'
get
'top_pages/industries'
get
'top_pages/industries'
get
'top_pages/top_page'
get
'top_pages/top_page'
...
@@ -29,8 +30,8 @@ Rails.application.routes.draw do
...
@@ -29,8 +30,8 @@ Rails.application.routes.draw do
resources
:account_activations
,
only:
[
:edit
]
resources
:account_activations
,
only:
[
:edit
]
resources
:password_resets
,
only:
[
:new
,
:create
,
:edit
,
:update
]
resources
:password_resets
,
only:
[
:new
,
:create
,
:edit
,
:update
]
get
'apply
/job/:id
'
,
controller: :applies
,
action: :new
,
as: :form_apply
get
'apply'
,
controller: :applies
,
action: :new
,
as: :form_apply
post
'apply
/job/:id
'
,
controller: :applies
,
action: :create
,
as: :new_info
post
'apply'
,
controller: :applies
,
action: :create
,
as: :new_info
get
'apply/confirm'
,
controller: :applies
,
action: :confirm_apply
,
as: :confirm_apply
get
'apply/confirm'
,
controller: :applies
,
action: :confirm_apply
,
as: :confirm_apply
get
'apply/finish'
,
controller: :applies
,
action: :finish
,
as: :finish_apply
get
'apply/finish'
,
controller: :applies
,
action: :finish
,
as: :finish_apply
mount
Sidekiq
::
Web
=>
'/sidekiq'
mount
Sidekiq
::
Web
=>
'/sidekiq'
...
...
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