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
51d1709a
Commit
51d1709a
authored
Dec 26, 2019
by
nnnghia98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit model users and jobs
parent
c24a7643
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
14 deletions
+18
-14
app/controllers/jobs_controller.rb
+5
-7
app/models/job.rb
+3
-0
app/models/user.rb
+3
-0
app/views/jobs/confirm_apply.html.erb
+7
-7
No files found.
app/controllers/jobs_controller.rb
View file @
51d1709a
...
@@ -28,16 +28,14 @@ class JobsController < ApplicationController
...
@@ -28,16 +28,14 @@ class JobsController < ApplicationController
end
end
def
finish_apply
def
finish_apply
@apply_first_name
=
params
[
"confirm_apply_info"
][
"first_name"
]
@apply_info
=
params
[
:confirm_apply_info
]
@apply_last_name
=
params
[
"confirm_apply_info"
][
"last_name"
]
@job_id
=
params
[
:confirm_apply_info
][
:job_id
]
@apply_email
=
params
[
"confirm_apply_info"
][
"email"
]
@job_id
=
params
[
"confirm_apply_info"
][
"job_id"
]
if
params
[
:commit
]
==
"Edit"
if
params
[
:commit
]
==
"Edit"
re
nder
"jobs/apply"
re
direct_to
apply_path
(
job_id:
@job_id
)
else
else
UserJob
.
find_by
(
user_id:
current_user
.
id
,
job_id:
@job_id
)
||
current_user
.
user_jobs
.
find_by
(
user_id:
current_user
.
id
,
job_id:
@job_id
)
||
UserJob
.
create!
(
user_id:
current_user
.
id
,
job_id:
@job_id
,
applied_at:
Time
.
current
)
current_user
.
user_jobs
.
create!
(
user_id:
current_user
.
id
,
job_id:
@job_id
,
applied_at:
Time
.
current
)
end
end
end
end
end
end
app/models/job.rb
View file @
51d1709a
...
@@ -37,6 +37,9 @@ class Job < ApplicationRecord
...
@@ -37,6 +37,9 @@ class Job < ApplicationRecord
has_many
:industry_jobs
has_many
:industry_jobs
has_many
:industries
,
through: :industry_jobs
has_many
:industries
,
through: :industry_jobs
has_many
:user_jobs
has_many
:users
,
through: :user_jobs
def
self
.
latest_job
def
self
.
latest_job
@latest_job
||=
order
(
updated_at: :desc
).
take
(
Settings
.
top
.
job
.
limit
)
@latest_job
||=
order
(
updated_at: :desc
).
take
(
Settings
.
top
.
job
.
limit
)
end
end
...
...
app/models/user.rb
View file @
51d1709a
...
@@ -28,6 +28,9 @@
...
@@ -28,6 +28,9 @@
#
#
class
User
<
ApplicationRecord
class
User
<
ApplicationRecord
has_many
:user_jobs
has_many
:jobs
,
through: :user_jobs
# Include default devise modules. Others available are:
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise
:database_authenticatable
,
:registerable
,
devise
:database_authenticatable
,
:registerable
,
...
...
app/views/jobs/confirm_apply.html.erb
View file @
51d1709a
...
@@ -8,21 +8,21 @@
...
@@ -8,21 +8,21 @@
<h3>
Confirmation
</h3>
<h3>
Confirmation
</h3>
<%=
form_for
"confirm_apply_info"
,
url:
done_path
,
method: :post
do
|
f
|
%>
<%=
form_for
"confirm_apply_info"
,
url:
done_path
,
method: :post
do
|
f
|
%>
<%=
f
.
hidden_field
:job_id
,
value:
params
[
"apply_info"
][
"job_id"
]
%>
<%=
f
.
hidden_field
:job_id
,
value:
params
[
:apply_info
][
:job_id
]
%>
<%=
f
.
hidden_field
:first_name
,
value:
params
[
"apply_info"
][
"first_name"
]
%>
<%=
f
.
hidden_field
:first_name
,
value:
params
[
:apply_info
][
:first_name
]
%>
<%=
f
.
hidden_field
:last_name
,
value:
params
[
"apply_info"
][
"last_name"
]
%>
<%=
f
.
hidden_field
:last_name
,
value:
params
[
:apply_info
][
:last_name
]
%>
<%=
f
.
hidden_field
:email
,
value:
params
[
"apply_info"
][
"email"
]
%>
<%=
f
.
hidden_field
:email
,
value:
params
[
:apply_info
][
:email
]
%>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
First name:
<%=
f
.
label
:first_name
,
params
[
"apply_info"
][
"first_name"
]
%>
First name:
<%=
f
.
label
:first_name
,
params
[
:apply_info
][
:first_name
]
%>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
Last name:
<%=
f
.
label
:last_name
,
params
[
"apply_info"
][
"last_name"
]
%>
Last name:
<%=
f
.
label
:last_name
,
params
[
:apply_info
][
:last_name
]
%>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
Email:
<%=
f
.
label
:email
,
params
[
"apply_info"
][
"email"
]
%>
Email:
<%=
f
.
label
:email
,
params
[
:apply_info
][
:email
]
%>
</div>
</div>
<div
class=
"actions text-center"
>
<div
class=
"actions text-center"
>
...
...
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