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
0
Merge Requests
0
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
Huỳnh Thiên Phước
venjob
Commits
76330296
Commit
76330296
authored
Sep 01, 2020
by
Huỳnh Thiên Phước
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created favorite job
parent
3d6a158c
Pipeline
#1048
canceled with stages
in 0 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
11 deletions
+22
-11
app/controllers/favorite_jobs_controller.rb
+11
-3
app/views/favorite_jobs/_my_favorite_jobs.html.erb
+1
-3
app/views/favorite_jobs/create.js.erb
+0
-0
app/views/favorite_jobs/destroy.js.erb
+0
-0
app/views/favorite_jobs/show.html.erb
+6
-1
config/routes.rb
+4
-4
No files found.
app/controllers/
job_favorite
s_controller.rb
→
app/controllers/
favorite_job
s_controller.rb
View file @
76330296
class
JobFavoritesController
<
ApplicationController
before_action
:sign_in_validation
,
only:
%i[create destroy show]
class
FavoriteJobsController
<
ApplicationController
before_action
:sign_in_favorite_validation
,
only:
%i[create destroy]
before_action
:sign_in_validation
,
only:
[
:show
]
def
show
@count
=
current_user
.
favorite_jobs
.
count
...
...
@@ -32,10 +33,17 @@ class JobFavoritesController < ApplicationController
private
def
sign_in_validation
def
sign_in_
favorite_
validation
return
if
signed_in?
session
[
:return_to
]
=
request
.
referer
flash
[
:warning
]
=
Settings
.
user
.
warning_signin
redirect_to
login_path
end
def
sign_in_validation
return
if
signed_in?
store_location
flash
[
:warning
]
=
Settings
.
user
.
warning_signin
redirect_to
login_path
end
end
app/views/
job_favorite
s/_my_favorite_jobs.html.erb
→
app/views/
favorite_job
s/_my_favorite_jobs.html.erb
View file @
76330296
...
...
@@ -21,9 +21,7 @@
<div
class=
"salary col-3"
>
Salary:
<%=
favorited_job
.
job
.
salary
%>
</div>
<%=
form_for
(
:job_favorite
,
url:
unfavorite_job_path
(
job_id:
favorited_job
.
job
.
id
),
method: :delete
,
remote:
true
)
do
|
f
|
%>
<%=
f
.
submit
"Remove"
,
class:
"btn btn-danger"
,
id:
"button-remove"
%>
<%
end
%>
<%=
link_to
"Remove"
,
unfavorite_job_path
(
job_id:
favorited_job
.
job
.
id
),
method: :delete
,
remote:
true
,
class:
"btn btn-danger"
,
id:
"button-remove"
%>
</div>
</div>
</div>
...
...
app/views/
job_favorite
s/create.js.erb
→
app/views/
favorite_job
s/create.js.erb
View file @
76330296
File moved
app/views/
job_favorite
s/destroy.js.erb
→
app/views/
favorite_job
s/destroy.js.erb
View file @
76330296
File moved
app/views/
job_favorite
s/show.html.erb
→
app/views/
favorite_job
s/show.html.erb
View file @
76330296
...
...
@@ -3,7 +3,12 @@
<h1
class=
"text-center my-job-label"
>
My Favorite Job (
<span
class=
"count-favorite-jobs"
>
<%=
@count
%>
</span>
jobs)
</h1>
<%=
paginate
@favorited_jobs
,
outer_window:
2
,
window:
1
%>
<div
class=
"favorite-page"
>
<%=
render
partial:
"job_favorites/my_favorite_jobs"
,
collection:
@favorited_jobs
,
as: :favorited_job
%>
<%=
form_tag
apply_job_path
(
job_id:
params
[
:job_id
]),
method: :get
,
enforce_utf8:
false
do
%>
<%=
render
partial:
"favorite_jobs/my_favorite_jobs"
,
collection:
@favorited_jobs
,
as: :favorited_job
%>
<div
class=
"row justify-content-center"
>
<%=
submit_tag
'Apply Job'
,
name:
nil
,
class:
'btn btn-lg btn-danger'
%>
</div>
<%
end
%>
</div>
<%=
paginate
@favorited_jobs
,
outer_window:
2
,
window:
1
%>
<%
else
%>
...
...
config/routes.rb
View file @
76330296
...
...
@@ -33,11 +33,11 @@ Rails.application.routes.draw do
get
'jobs/industry/:converted_name'
,
to:
'jobs#industry_jobs'
,
as: :industry_jobs
get
'jobs/company/:converted_name'
,
to:
'jobs#company_jobs'
,
as: :company_jobs
post
'favorite_job'
,
to:
'
job_favorite
s#create'
,
as: :favorite_job
delete
'unfavorite_job'
,
to:
'
job_favorite
s#destroy'
,
as: :unfavorite_job
get
'favorite'
,
to:
'
job_favorite
s#show'
,
as: :my_favorite_job
post
'favorite_job'
,
to:
'
favorite_job
s#create'
,
as: :favorite_job
delete
'unfavorite_job'
,
to:
'
favorite_job
s#destroy'
,
as: :unfavorite_job
get
'favorite'
,
to:
'
favorite_job
s#show'
,
as: :my_favorite_job
resources
:
job_favorites
,
only:
[
:create
,
:destroy
]
resources
:
favorite_jobs
,
only:
[
:create
,
:destroy
,
:show
]
resources
:job_applieds
,
only:
[
:new
,
:create
]
resources
:reset_passwords
,
only:
[
:edit
,
:update
]
resources
:confirmations
,
only:
[
:new
]
...
...
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