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
319449c8
Commit
319449c8
authored
Nov 15, 2017
by
Xuan Trung Le
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs: admin can apply or favorite job
parent
48aecf01
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletions
+10
-1
app/controllers/application_controller.rb
+8
-1
app/controllers/applies_controller.rb
+1
-0
app/controllers/favorites_controller.rb
+1
-0
No files found.
app/controllers/application_controller.rb
View file @
319449c8
class
ApplicationController
<
ActionController
::
Base
class
ApplicationController
<
ActionController
::
Base
protect_from_forgery
with: :exception
protect_from_forgery
with: :exception
helper_method
:clear_session_candidate
helper_method
:clear_session_candidate
,
:admin_can_not_do_this
def
clear_session_candidate
def
clear_session_candidate
session
[
:candidate
]
=
{}
session
[
:candidate
]
=
{}
...
@@ -14,4 +14,11 @@ class ApplicationController < ActionController::Base
...
@@ -14,4 +14,11 @@ class ApplicationController < ActionController::Base
super
super
end
end
end
end
def
admin_can_not_do_this
if
current_admin
flash
[
:notice
]
=
"Admin can't do this"
redirect_back
(
fallback_location:
root_path
)
end
end
end
end
app/controllers/applies_controller.rb
View file @
319449c8
class
AppliesController
<
ApplicationController
class
AppliesController
<
ApplicationController
before_action
:admin_can_not_do_this
before_action
:authenticate_user!
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
]
...
...
app/controllers/favorites_controller.rb
View file @
319449c8
class
FavoritesController
<
ApplicationController
class
FavoritesController
<
ApplicationController
before_action
:admin_can_not_do_this
before_action
:authenticate_user!
before_action
:authenticate_user!
def
index
def
index
@jobs
=
current_user
.
liked_jobs
.
includes
(
:company
)
@jobs
=
current_user
.
liked_jobs
.
includes
(
:company
)
...
...
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