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
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xuan Trung Le
venjob
Commits
c7bffa9a
Commit
c7bffa9a
authored
Oct 27, 2017
by
Xuan Trung Le
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
39066c52
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
10 deletions
+7
-10
app/controllers/application_controller.rb
+0
-1
app/controllers/applies_controller.rb
+1
-0
app/controllers/favorites_controller.rb
+3
-6
app/controllers/jobs_controller.rb
+0
-2
app/models/user.rb
+2
-0
app/views/jobs/show.html.erb
+1
-1
No files found.
app/controllers/application_controller.rb
View file @
c7bffa9a
class
ApplicationController
<
ActionController
::
Base
class
ApplicationController
<
ActionController
::
Base
protect_from_forgery
with: :exception
protect_from_forgery
with: :exception
before_action
:authenticate_user!
helper_method
:clear_session_candidate
helper_method
:clear_session_candidate
def
clear_session_candidate
def
clear_session_candidate
...
...
app/controllers/applies_controller.rb
View file @
c7bffa9a
class
AppliesController
<
ApplicationController
class
AppliesController
<
ApplicationController
before_action
:authenticate_user!
def
apply
def
apply
session
[
:job_id
]
=
params
[
:job_id
]
if
params
[
:job_id
]
session
[
:job_id
]
=
params
[
:job_id
]
if
params
[
:job_id
]
if
session
[
:candidate
].
present?
if
session
[
:candidate
].
present?
...
...
app/controllers/favorites_controller.rb
View file @
c7bffa9a
class
FavoritesController
<
ApplicationController
class
FavoritesController
<
ApplicationController
before_action
:authenticate_user!
def
index
def
index
@jobs
=
current_user
.
liked_jobs
.
includes
(
:company
)
@jobs
=
current_user
.
liked_jobs
.
includes
(
:company
)
end
end
def
user_like_job
def
user_like_job
job
=
Job
.
find
(
params
[
:job_id
])
job
=
Job
.
find
(
params
[
:job_id
])
flash
[
:notice
]
=
'You have favorited this job already'
flash
[
:notice
]
=
'Successfully favorited...'
flash
[
:notice
]
=
'You have favorited this job already'
unless
current_user
.
like_job
(
job
)
unless
current_user
.
liked?
(
job
)
current_user
.
like_job
(
job
)
flash
[
:notice
]
=
'Successfully favorited...'
end
redirect_back
(
fallback_location:
root_path
)
redirect_back
(
fallback_location:
root_path
)
end
end
...
...
app/controllers/jobs_controller.rb
View file @
c7bffa9a
class
JobsController
<
ApplicationController
class
JobsController
<
ApplicationController
before_action
:set_job
,
only:
[
:show
]
before_action
:set_job
,
only:
[
:show
]
skip_before_action
:authenticate_user!
,
only:
[
:index
,
:city
,
:industry
,
:company
,
:show
]
def
index
def
index
@jobs
=
Job
.
top_list
.
includes
(
:company
)
@jobs
=
Job
.
top_list
.
includes
(
:company
)
@cities
=
City
.
top_cities
.
includes
(
:country
)
@cities
=
City
.
top_cities
.
includes
(
:country
)
...
...
app/models/user.rb
View file @
c7bffa9a
...
@@ -20,7 +20,9 @@ class User < ApplicationRecord
...
@@ -20,7 +20,9 @@ class User < ApplicationRecord
validates_size_of
:cv
,
maximum:
5
.
megabytes
,
message:
'size should be less than 5MB'
validates_size_of
:cv
,
maximum:
5
.
megabytes
,
message:
'size should be less than 5MB'
def
like_job
(
job
)
def
like_job
(
job
)
return
false
if
liked?
(
job
)
liked_jobs
<<
job
liked_jobs
<<
job
true
end
end
def
unlike_job
(
job
)
def
unlike_job
(
job
)
...
...
app/views/jobs/show.html.erb
View file @
c7bffa9a
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"container"
>
<div
class=
"container"
>
<ol
class=
"breadcrumb"
>
<ol
class=
"breadcrumb"
>
<li>
<%=
link_to
"TOP"
,
root_path
,
class:
"btn btn-primary"
%>
</li>
<li>
<%=
link_to
"TOP"
,
root_path
%>
</li>
<li>
<li>
<%-
@job
.
cities
.
each_with_index
do
|
city
,
index
|
-%>
<%-
@job
.
cities
.
each_with_index
do
|
city
,
index
|
-%>
<%=
"
#{
index
>
0
?
','
:
''
}
"
%>
<%=
"
#{
index
>
0
?
','
:
''
}
"
%>
...
...
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