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
a3e9d1b3
Commit
a3e9d1b3
authored
Aug 14, 2020
by
Ngô Trung Hưng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add loading page
parent
423eef1a
Pipeline
#916
failed with stages
in 0 seconds
Changes
14
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
122 additions
and
30 deletions
+122
-30
app/assets/javascripts/application.js
+3
-0
app/assets/javascripts/custom.js
+8
-0
app/controllers/apply_job_controller.rb
+19
-9
app/helpers/application_helper.rb
+1
-0
app/models/applied_job.rb
+3
-1
app/views/apply_job/_form.html.erb
+7
-6
app/views/apply_job/confirm.html.erb
+19
-9
app/views/devise/registrations/edit.html.erb
+1
-1
app/views/devise/registrations/new.html.erb
+1
-1
app/views/layouts/application.html.erb
+1
-0
app/views/shared/_error.html.erb
+10
-0
app/views/shared/_loading.html.erb
+46
-0
config/environments/development.rb
+1
-1
config/routes.rb
+2
-2
No files found.
app/assets/javascripts/application.js
View file @
a3e9d1b3
...
...
@@ -15,3 +15,6 @@
//= require turbolinks
//= require jquery.min
//= require_tree .
toastr
.
options
=
{
'closeButton'
:
true
}
app/assets/javascripts/custom.js
View file @
a3e9d1b3
...
...
@@ -38,4 +38,12 @@ $(document).on("turbolinks:load", function(){
$
(
"input[type=file]"
).
on
(
'change'
,
function
(){
document
.
getElementById
(
"label_name_file"
).
innerHTML
=
this
.
files
[
0
].
name
;
});
});
$
(
document
).
on
(
"turbolinks:click"
,
function
(){
$
(
".box_loading"
).
show
();
});
$
(
document
).
on
(
"turbolinks:load"
,
function
(){
$
(
".box_loading"
).
hide
();
});
app/controllers/apply_job_controller.rb
View file @
a3e9d1b3
...
...
@@ -2,28 +2,38 @@
class
ApplyJobController
<
ApplicationController
before_action
:authenticate_user!
,
only: :apply
def
apply
redirect_to
root_path
if
params
[
:job_id
].
blank?
@data_apply
=
AppliedJob
.
new
session
[
:job_id
]
=
params
[
:job_id
]
end
def
c
onfirmation
@
data_apply
=
AppliedJob
.
new
(
applied_job_params
)
if
@
data_apply
.
save
session
[
:user_name
]
=
@data_apply
.
name
session
[
:user_email
]
=
@data_apply
.
email
redirect_to
show_path
def
c
atch_data
(
applied_job_params
)
@
apply_job
=
AppliedJob
.
new
(
applied_job_params
)
if
@
apply_job
.
cv
.
blank?
if
current_user
.
cv
.
present?
@apply_job
.
cv
=
current_user
.
cv
render
:confirm
else
flash
[
:error
]
=
'error'
render
'apply'
flash
[
:error
]
=
t
(
'pages.mypage.nofile'
)
redirect_to
apply_path
(
job_id:
session
[
:job_id
])
session
.
delete
(
:job_id
)
end
end
@apply_job
end
def
confirm
@apply_job
||=
catch_data
(
applied_job_params
)
end
def
show
end
def
save
@data_apply
.
save
debugger
confirm
.
save
end
private
...
...
app/helpers/application_helper.rb
View file @
a3e9d1b3
...
...
@@ -10,6 +10,7 @@ module ApplicationHelper
def
custom_bootstrap_flash
flash_messages
=
[]
flash
.
each
do
|
type
,
message
|
next
if
message
.
blank?
type
=
'success'
if
type
==
'notice'
type
=
'error'
if
type
==
'alert'
text
=
"<script>toastr.
#{
type
}
('
#{
message
}
');</script>"
...
...
app/models/applied_job.rb
View file @
a3e9d1b3
...
...
@@ -3,7 +3,9 @@
# Description/Explanation of Person class
class
AppliedJob
<
ApplicationRecord
mount_uploader
:cv
,
CvUploader
validates_integrity_of
:cv
belongs_to
:user
belongs_to
:job
validates
:name
,
:email
,
:cv
,
presence:
true
validates
:name
,
:email
,
length:
{
in:
8
..
200
}
validates
:email
,
format:
Devise
.
email_regexp
end
app/views/apply_job/_form.html.erb
View file @
a3e9d1b3
<%=
form_with
(
model:
data_apply
,
url:
confirm_path
)
do
|
f
|
%>
<%=
form_with
(
model:
data_apply
,
url:
confirm_path
,
local:
true
)
do
|
f
|
%>
<br>
<div
class=
"container"
>
<div
class=
"row"
>
...
...
@@ -7,8 +7,9 @@
<%=
f
.
label
:name
,
t
(
'pages.mypage.name'
)
%>
</div>
<div
class=
"col-lg-6"
>
<%=
f
.
text_field
(
:name
,
class
:'form-control'
)
%>
<%=
f
.
hidden_field
(
:job_id
,
value:
session
[
:job_id
])
%>
<%=
f
.
text_field
(
:name
,
autofocus:
true
,
autocomplete:
'name'
,
class
:'form-control'
)
%>
<%=
f
.
hidden_field
(
:job_id
,
value:
params
[
:job_id
])
%>
<%=
f
.
hidden_field
(
:user_id
,
value:
current_user
.
id
)
%>
</div>
</div><br>
<div
class=
"row"
>
...
...
@@ -17,7 +18,7 @@
<%=
f
.
label
:email
%>
</div>
<div
class=
"col-lg-6"
>
<%=
f
.
text_field
(
:email
,
class
:'form-control'
)
%>
<%=
f
.
text_field
(
:email
,
autofocus:
true
,
autocomplete:
'email'
,
class
:'form-control'
)
%>
</div>
</div><br>
<div
class=
"row"
>
...
...
@@ -26,8 +27,8 @@
<span>
<%=
t
(
'pages.mypage.cv'
)
%>
</span>
</div>
<div
class=
"col-lg-5 col-md-12"
>
<%=
f
.
label
:cv
,
current_user
.
cv
.
identifier
?
'current_user.cv.identifier'
:
t
(
'pages.mypage.nofile'
),
id:
'label_name_file'
%>
<%=
f
.
file_field
:cv
,
class:
'pppp hidden'
%>
<%=
f
.
label
:cv
,
current_user
.
cv
.
identifier
?
current_user
.
cv
.
identifier
:
t
(
'pages.mypage.nofile'
),
id:
'label_name_file'
%>
<%=
f
.
file_field
:cv
,
accept:
'.pdf'
,
class:
'pppp hidden'
%>
</div>
<div
class=
"col-lg-1"
>
<%=
f
.
label
:cv
,
'<i class="fas fa-cloud-upload-alt"></i>'
.
html_safe
,
title:
'upload'
,
class:
'lable_custom'
%>
...
...
app/views/apply_job/
show
.html.erb
→
app/views/apply_job/
confirm
.html.erb
View file @
a3e9d1b3
...
...
@@ -2,19 +2,19 @@
<div
class=
"box_job_apply"
>
<div
class=
"ribbon"
>
<div
class=
"row"
>
<div
class=
"col-lg-4 col-md-
4
"
>
<div
class=
"col-lg-4 col-md-
12
"
>
<div
class=
"ribbon_item active"
>
<span
class=
"custom_badges active"
>
1
</span>
Nhập thông tin
<span
class=
"custom_badges active"
>
1
</span>
<%=
t
(
'pages.apply.ribon_1'
)
%>
</div>
</div>
<div
class=
"col-lg-4 col-md-
4
"
>
<div
class=
"col-lg-4 col-md-
12
"
>
<div
class=
"ribbon_item active"
>
<span
class=
"custom_badges active"
>
2
</span>
Xác nhận thông tin
<span
class=
"custom_badges active"
>
2
</span>
<%=
t
(
'pages.apply.ribon_2'
)
%>
</div>
</div>
<div
class=
"col-lg-4 col-md-
4
"
>
<div
class=
"col-lg-4 col-md-
12
"
>
<div
class=
"ribbon_item"
>
<span
class=
"custom_badges"
>
3
</span>
Hoàn thành
<span
class=
"custom_badges"
>
3
</span>
<%=
t
(
'pages.apply.ribon_3'
)
%>
</div>
</div>
</div>
...
...
@@ -30,7 +30,7 @@
Họ và tên:
</div>
<div
class=
"col-lg-6"
>
<%=
session
[
:user_name
]
%>
<%=
@apply_job
.
name
%>
</div>
</div><br>
<div
class=
"row"
>
...
...
@@ -39,13 +39,22 @@
Email:
</div>
<div
class=
"col-lg-6"
>
<%=
session
[
:user_email
]
%>
<%=
@apply_job
.
email
%>
</div>
</div><br>
<div
class=
"row"
>
<div
class=
"col-lg-2"
></div>
<div
class=
"col-lg-2"
>
CV:
</div>
<div
class=
"col-lg-6"
>
<%=
@apply_job
.
cv
.
identifier
%>
</div>
</div>
</div>
<%=
link_to
'save'
,
save_path
%>
<%=
link_to
'back'
,
edit_path
(
job_id:
session
[
:job_id
])
%>
<%=
link_to
t
(
'devise.back'
),
:back
%>
</div>
</div>
</div>
\ No newline at end of file
app/views/devise/registrations/edit.html.erb
View file @
a3e9d1b3
...
...
@@ -34,7 +34,7 @@
<%=
f
.
label
:cv
,
t
(
'pages.mypage.cv'
)
%>
</div>
<div
class=
"col-md-9"
>
<%=
f
.
file_field
:cv
,
autofocus:
true
,
class:
'pppp'
%>
<%=
f
.
file_field
:cv
,
a
ccept:
'.pdf'
,
a
utofocus:
true
,
class:
'pppp'
%>
<i
style=
"font-size: 15px; color: #666"
>
Current file:
<%=
current_user
.
cv
.
identifier
%>
</i>
</div>
</div><br>
...
...
app/views/devise/registrations/new.html.erb
View file @
a3e9d1b3
...
...
@@ -31,7 +31,7 @@
<%=
f
.
label
:cv
,
t
(
'pages.mypage.cv'
)
%>
</div>
<div
class=
"col-md-9"
>
<%=
f
.
file_field
:cv
,
autofocus:
true
,
class:
'pppp'
%>
<%=
f
.
file_field
:cv
,
a
ccept:
'.pdf'
,
a
utofocus:
true
,
class:
'pppp'
%>
</div>
</div><br>
<div
class=
"row"
>
...
...
app/views/layouts/application.html.erb
View file @
a3e9d1b3
...
...
@@ -19,6 +19,7 @@
<%=
render
'layouts/padding'
%>
<%=
yield
%>
<%=
render
'layouts/footer'
%>
<%=
render
'shared/loading'
%>
</div>
</body>
</html>
app/views/shared/_error.html.erb
0 → 100644
View file @
a3e9d1b3
<%
if
resource
.
errors
.
any?
%>
<div
id=
"error_explanation"
>
<ul>
<%
resource
.
errors
.
full_messages
.
each
do
|
message
|
%>
<li>
<%=
message
%>
</li>
<%
end
%>
</ul>
</div>
<%
end
%>
\ No newline at end of file
app/views/shared/_loading.html.erb
0 → 100644
View file @
a3e9d1b3
<style>
body
{
padding
:
0
;
margin
:
0
;
}
.box_loading
{
z-index
:
9999999
;
position
:
fixed
;
top
:
0
;
left
:
0
;
bottom
:
0
;
right
:
0
;
box-sizing
:
border-box
;
background-image
:
linear-gradient
(
to
bottom
,
rgba
(
112
,
112
,
112
,
0.486
),
rgba
(
112
,
112
,
112
,
0.486
));
}
.content
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
width
:
60px
;
height
:
60px
;
border-radius
:
50%
;
border
:
8px
solid
#f3f3f3
c0
;
border-left
:
8px
solid
rgb
(
247
,
127
,
29
);
border-right
:
8px
solid
rgb
(
247
,
127
,
29
);
transform
:
translateX
(
-50%
)
translateY
(
-50%
);
-webkit-animation
:
spin
2s
linear
infinite
;
animation
:
spin
2s
linear
infinite
;
}
@-webkit-keyframes
spin
{
0
%
{
-webkit-transform
:
rotate
(
0deg
);
}
100
%
{
-webkit-transform
:
rotate
(
360deg
);
}
}
@keyframes
spin
{
0
%
{
transform
:
rotate
(
0deg
);
}
100
%
{
transform
:
rotate
(
360deg
);
}
}
</style>
<div
class=
"box_loading"
>
<div
class=
"content"
></div>
</div>
config/environments/development.rb
View file @
a3e9d1b3
...
...
@@ -22,7 +22,7 @@ Rails.application.configure do
config
.
eager_load
=
false
# Show full error reports.
config
.
consider_all_requests_local
=
fals
e
config
.
consider_all_requests_local
=
tru
e
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
...
...
config/routes.rb
View file @
a3e9d1b3
...
...
@@ -10,8 +10,8 @@ Rails.application.routes.draw do
get
'industries'
,
to:
'industry#index'
,
as: :industry_index
get
'cities'
,
to:
'city#index'
,
as: :city_index
get
'apply'
,
to:
'apply_job#apply'
,
as: :apply
post
'conf
rim'
,
to:
'apply_job#confirmation
'
,
as: :confirm
get
'
confrim'
,
to:
'apply_job#show'
,
as: :show
post
'conf
irm'
,
to:
'apply_job#confirm
'
,
as: :confirm
get
'
save'
,
to:
'apply_job#save'
,
as: :save
# Details job
get
'detail/:id'
,
to:
'job#detail'
,
as: :detail_job
# Search
...
...
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