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
1
Merge Requests
1
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
Đường Sỹ Hoàng
VenJob
Commits
191a806f
Commit
191a806f
authored
Jan 17, 2020
by
Đường Sỹ Hoàng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add remove method to remove button,add applied_job index page, add pagination
parent
7b418aec
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
77 additions
and
17 deletions
+77
-17
app/controllers/apply_controller.rb
+6
-1
app/models/apply.rb
+1
-0
app/views/apply/_applied.html.erb
+37
-0
app/views/apply/confirm.html.erb
+2
-0
app/views/apply/index.html.erb
+10
-0
app/views/favorites/_favorite.html.erb
+9
-13
app/views/favorites/_favorite_job.html.erb
+3
-1
app/views/favorites/destroy.js.erb
+1
-0
app/views/jobs/show.html.erb
+2
-2
app/views/layouts/_header.html.erb
+1
-0
config/routes.rb
+1
-0
config/settings.yml
+4
-0
No files found.
app/controllers/apply_controller.rb
View file @
191a806f
class
ApplyController
<
ApplicationController
before_action
:check_user_logged_in?
before_action
:load_job
,
only:
[
:new
,
:done
,
:confirm
]
before_action
:load_job
,
only:
[
:new
,
:done
,
:confirm
,
:index
]
def
index
@applies
=
current_user
.
applies
.
includes
(
:job
)
@applies
=
@applies
.
page
(
params
[
:page
]).
per
(
Settings
.
apply
.
job
.
limit
)
end
def
new
@apply
=
if
params
[
:apply
].
present?
...
...
app/models/apply.rb
View file @
191a806f
class
Apply
<
UserJob
# delegate :title, :applied_at, :description, :salary, :position, :requirement, to: :user_jobs, prefix: :true
end
app/views/apply/_applied.html.erb
0 → 100644
View file @
191a806f
<%
job
=
applied
.
job
%>
<dl
class=
"row-cols"
>
<dt
class=
"col-sm-6"
>
Job Title:
</dt>
<dd
class=
"col-sm-12"
<%
link_to
job_detail_path
(
job
.
id
)
%>
>
<%=
link_to
job
.
title
,
job_detail_path
(
job
.
id
)
%>
</dd>
<dt
class=
"col-sm-6"
>
Position:
</dt>
<dd
class=
"col-sm-6"
>
<%=
job
.
position
%>
</dd>
<dt
class=
"col-sm-6"
>
Salary:
</dt>
<dd
class=
"col-sm-6"
>
<%=
job
.
salary
%>
</dd>
<dt
class=
"col-sm-6"
>
Applied at:
</dt>
<dd
class=
"col-sm-9"
>
<%=
job
.
updated_at
%>
</dd>
</dl>
<dl
class=
"row-cols"
>
<dt
class=
"col-sm-6"
>
Description:
</dt>
<dd
class=
"col-sm-9"
>
<%=
truncate
(
simple_format
(
job
.
description
),
escape:
false
,
length:
250
)
%>
</dd>
</dt>
</dl>
<dl
class=
"row-cols"
>
<dt
class=
"col-sm-6"
>
Requirement:
</dt>
<dd
class=
"col-sm-9"
>
<%=
truncate
(
simple_format
(
job
.
requirement
),
escape:
false
,
length:
250
)
%>
</dd>
</dt>
</dl>
</br>
app/views/apply/confirm.html.erb
View file @
191a806f
...
...
@@ -38,6 +38,8 @@
<%=
f
.
hidden_field
:cv_url
,
value:
@apply
.
cv_url
%>
</div>
</br>
<%=
@apply
.
applied_at
%>
<%=
f
.
hidden_field
:applied_at
,
value:
@apply
.
applied_at
%>
<div
class =
"form-group"
>
<div
class =
"actions"
>
...
...
app/views/apply/index.html.erb
0 → 100644
View file @
191a806f
<div
class=
"area-title-wrapper"
>
<h3>
Applied Jobs List
</h3>
</div>
<div>
<%=
paginate
@applies
%>
<div
class=
"row row-cols-3"
>
<%=
render
partial:
"apply/applied"
,
collection:
@applies
%>
</div>
</div>
<%=
paginate
@applies
%>
app/views/favorites/_favorite.html.erb
View file @
191a806f
<%
job
=
favorite
.
job
%>
<dl
class=
"row-cols
-3"
id=
"favorite_job_
<%=
job
.
id
%>
"
>
<dt
class=
"col-sm-
9
"
>
Job Title:
</dt>
<dl
class=
"row-cols
"
id =
"favorite_job_
<%=
job
.
id
%>
"
>
<dt
class=
"col-sm-
6
"
>
Job Title:
</dt>
<dd
class=
"col-sm-9"
>
<%=
job
.
title
%>
</dd>
...
...
@@ -10,25 +10,21 @@
</dd>
<dt
class=
"col-sm-6"
>
Salary:
</dt>
<dd
class=
"col-sm-9"
>
<%=
job
.
salary
%>
</dd>
</dl>
<dl
class=
"row-cols-1"
>
<dt
class=
"col-sm-6"
>
Description:
</dt>
<dd
class=
"col-sm-9"
>
<%=
truncate
(
simple_format
(
job
.
description
),
escape:
false
,
length:
250
)
%>
</dd>
</dl>
<dl
class=
"row-cols-1"
>
<dt
class=
"col-sm-6"
>
Requirement:
</dt>
<dd
class=
"col-sm-9"
>
<%=
truncate
(
simple_format
(
job
.
requirement
),
escape:
false
,
length:
250
)
%>
</dd>
</dl>
<dd
class=
"col-sm-9"
>
<%=
link_to
"Remove"
,
job_favorite_path
(
job
,
favorite
),
method: :delete
,
remote:
true
,
class:
"btn btn-outline-secondary"
%>
</dd>
<dd
class=
"col-sm-9"
>
<%=
link_to
"Remove"
,
job_favorite_path
(
job
,
favorite
),
method: :delete
,
remote:
true
,
class:
"btn btn-danger"
%>
</dd>
</dl>
app/views/favorites/_favorite_job.html.erb
View file @
191a806f
<dd>
<%=
link_to
"Favorite"
,
job_favorites_path
(
job
,
current_user
.
favorites
.
build
),
method: :post
,
remote:
true
,
class:
"btn btn-outline-secondary"
%>
class:
"btn btn-warning text-center"
%>
</dd>
app/views/favorites/destroy.js.erb
View file @
191a806f
$("#favorite_form").html("
<%=
escape_javascript
(
render
(
'favorites/favorite_job'
,
job:
@job
))
%>
");
$("#favorite_job_
<%=
@job
.
id
%>
").remove();
app/views/jobs/show.html.erb
View file @
191a806f
...
...
@@ -49,7 +49,7 @@
<dt
class=
"col-sm-3"
>
Requirement:
</dt>
<dd
class=
"col-sm-9"
>
<%=
simple_format
@job
.
requirement
%>
</dd>
</dl>
<%=
link_to
"Apply"
,
apply_path
,
class:
"btn btn-primary"
%>
<%=
render
"favorites/favorite_form"
,
job:
@job
%>
<%=
link_to_if
(
current_user
.
applies
.
find_by
(
job_id:
@job
.
id
).
nil?
,
"Apply"
,
apply_path
,
class:
"btn btn-primary"
)
{
link_to
"Apply"
,
apply_path
,
class:
"btn btn-primary disabled"
}
%>
<%=
render
"favorites/favorite_form"
,
job:
@job
%>
</div>
</div
app/views/layouts/_header.html.erb
View file @
191a806f
...
...
@@ -7,6 +7,7 @@
<%
if
user_signed_in?
%>
<%=
link_to
"Log out"
,
destroy_user_session_path
,
method: :delete
,
class:
"btn btn-outline-success"
%>
<%=
link_to
"Favorite"
,
favorites_path
,
method: :get
,
class:
"btn btn-outline-success"
%>
<%=
link_to
"Applied jobs"
,
applied_path
,
method: :get
,
class:
"btn btn-outline-success"
%>
<button
class=
"btn btn-outline-success"
type=
"button"
>
History
</button>
<%
else
%>
<form
class=
"form-inline"
>
...
...
config/routes.rb
View file @
191a806f
...
...
@@ -35,4 +35,5 @@ Rails.application.routes.draw do
get
"apply/:job_id"
,
to:
"apply#new"
,
as:
"apply"
post
"confirm/:job_id"
,
to:
"apply#confirm"
,
as:
"confirm"
post
"done/:job_id"
,
to:
"apply#done"
,
as:
"done"
get
"applied"
,
to:
"apply#index"
,
as:
"applied"
end
config/settings.yml
View file @
191a806f
...
...
@@ -12,3 +12,7 @@ top:
all
:
job
:
limit
:
20
apply
:
job
:
limit
:
5
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