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
Nguyen Ngoc Nghia
VeNJOB
Commits
04a4e0b4
Commit
04a4e0b4
authored
Dec 31, 2019
by
nnnghia98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix draper
parent
a3d65929
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletions
+16
-1
app/decorators/job_decorator.rb
+5
-0
app/decorators/user_decorator.rb
+10
-0
app/views/jobs/show.html.erb
+1
-1
No files found.
app/decorators/job_decorator.rb
View file @
04a4e0b4
...
@@ -3,6 +3,7 @@ class JobDecorator < ApplicationDecorator
...
@@ -3,6 +3,7 @@ class JobDecorator < ApplicationDecorator
delegate_all
delegate_all
decorates_association
:city
decorates_association
:city
decorates_association
:user
def
city_name
def
city_name
object
.
cities
&
.
first
&
.
name
object
.
cities
&
.
first
&
.
name
...
@@ -19,4 +20,8 @@ class JobDecorator < ApplicationDecorator
...
@@ -19,4 +20,8 @@ class JobDecorator < ApplicationDecorator
def
display_description
def
display_description
simple_format
object
.
description
simple_format
object
.
description
end
end
def
apply_available
(
user
)
object
.
users
.
find_by
(
id:
user
.
id
)
end
end
end
app/decorators/user_decorator.rb
0 → 100644
View file @
04a4e0b4
class
UserDecorator
<
ApplicationDecorator
include
ActionView
::
Helpers
::
TextHelper
delegate_all
decorates_association
:jobs
def
apply_available
object
.
jobs
.
find_by
(
job_id:
jobs
.
id
)
end
end
app/views/jobs/show.html.erb
View file @
04a4e0b4
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
<div
class=
"job_detail_button"
>
<div
class=
"job_detail_button"
>
<%=
link_to
"Favorite"
,
"#"
,
class:
"btn btn-primary float-right"
%>
<%=
link_to
"Favorite"
,
"#"
,
class:
"btn btn-primary float-right"
%>
<%
if
user_signed_in?
&&
UserJob
.
find_by
(
user_id:
current_user
.
id
,
job_id:
@job
.
id
)
%>
<%
if
user_signed_in?
&&
@job
.
apply_available
(
current_user
)
%>
<button
type=
"button"
class=
"btn btn-primary float-right mx-3"
disabled
>
Apply
</button>
<button
type=
"button"
class=
"btn btn-primary float-right mx-3"
disabled
>
Apply
</button>
<%
else
%>
<%
else
%>
<%=
link_to
"Apply"
,
apply_path
(
job_id:
@job
.
id
),
class:
"btn btn-primary float-right mx-3"
%>
<%=
link_to
"Apply"
,
apply_path
(
job_id:
@job
.
id
),
class:
"btn btn-primary float-right mx-3"
%>
...
...
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