Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venjob_nth
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
3
Merge Requests
3
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ô Trung Hưng
venjob_nth
Commits
67ac663b
Commit
67ac663b
authored
Aug 18, 2020
by
Ngô Trung Hưng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move render_errors to helper & update method set_lang
parent
ec82d046
Pipeline
#949
canceled with stages
in 0 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
app/controllers/apply_job_controller.rb
+1
-3
app/controllers/users_controller.rb
+4
-9
app/helpers/apply_job_helper.rb
+7
-0
No files found.
app/controllers/apply_job_controller.rb
View file @
67ac663b
...
...
@@ -21,9 +21,7 @@ class ApplyJobController < ApplicationController
@apply_job
.
cv
=
current_user
.
cv
if
@apply_job
.
cv
.
blank?
session
[
:cache_name
]
=
@apply_job
.
cv
.
cache_name
if
@apply_job
.
invalid?
errors
=
[]
@apply_job
.
errors
.
full_messages
.
each
{
|
mess
|
errors
<<
"
#{
mess
}
<br>"
}
flash
[
:error
]
=
errors
.
join
(
'<br>'
).
html_safe
helpers
.
render_errors
(
@apply_job
)
redirect_to
apply_path
(
job_id:
session
[
:job_id
])
end
end
...
...
app/controllers/users_controller.rb
View file @
67ac663b
...
...
@@ -7,17 +7,12 @@ class UsersController < ApplicationController
render
:confirm
end
def
my_page
end
def
my_page
;
end
def
set_lang
if
user_signed_in?
if
params
[
:lang
]
==
'vi'
||
params
[
:lang
]
==
'en'
User
.
update
(
current_user
.
id
,
language:
params
[
:lang
])
redirect_to
'/'
else
redirect_to
'/'
end
if
user_signed_in?
&&
current_user
.
language
!=
params
[
:lang
]
User
.
update
(
current_user
.
id
,
language:
params
[
:lang
])
if
params
[
:lang
]
==
'vi'
||
params
[
:lang
]
==
'en'
end
redirect_to
'/'
end
end
app/helpers/apply_job_helper.rb
View file @
67ac663b
#frozen_string_literal: true
module
ApplyJobHelper
def
render_errors
(
obj
)
errors
=
[]
obj
.
errors
.
full_messages
.
each
{
|
mess
|
errors
<<
"
#{
mess
}
<br>"
}
flash
[
:error
]
=
errors
.
join
(
'<br>'
).
html_safe
end
end
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