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
Mai Hoang Thai Ha
VenJob
Commits
41dfcb2e
Commit
41dfcb2e
authored
Aug 12, 2021
by
Mai Hoang Thai Ha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed review part 2
parent
a31c35be
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
44 additions
and
26 deletions
+44
-26
app/assets/stylesheets/applies.scss
+15
-9
app/controllers/applies_controller.rb
+1
-1
app/mailers/application_mailer.rb
+3
-0
app/models/apply_job.rb
+2
-1
app/views/applies/_validate_form.html.slim
+9
-0
app/views/applies/confirm.html.slim
+7
-8
app/views/applies/new.html.slim
+6
-2
app/views/user_mailer/apply_job.html.slim
+0
-0
app/views/user_mailer/apply_job.text.slim
+1
-1
config/application.rb
+0
-4
No files found.
app/assets/stylesheets/applies.scss
View file @
41dfcb2e
...
@@ -18,9 +18,10 @@ $text-color-white: #fff;
...
@@ -18,9 +18,10 @@ $text-color-white: #fff;
height
:
100%
;
height
:
100%
;
background
:
#f3f5fa
;
background
:
#f3f5fa
;
text-align
:
center
;
text-align
:
center
;
padding
:
12
px
;
padding
:
8
px
;
position
:
relative
;
position
:
relative
;
font-size
:
14px
;
font-size
:
16px
;
font-weight
:
700
;
text-decoration
:
none
;
text-decoration
:
none
;
color
:
#808080
;
color
:
#808080
;
.circle
{
.circle
{
...
@@ -42,11 +43,11 @@ $text-color-white: #fff;
...
@@ -42,11 +43,11 @@ $text-color-white: #fff;
&
:after
{
&
:after
{
content
:
""
;
content
:
""
;
border-top
:
2
3
px
solid
transparent
;
border-top
:
2
1
px
solid
transparent
;
border-bottom
:
2
3
px
solid
transparent
;
border-bottom
:
2
1
px
solid
transparent
;
border-left
:
2
3
px
solid
#f3f5fa
;
border-left
:
2
1
px
solid
#f3f5fa
;
position
:
absolute
;
position
:
absolute
;
right
:
-2
3
px
;
right
:
-2
1
px
;
top
:
0
;
top
:
0
;
z-index
:
1
;
z-index
:
1
;
}
}
...
@@ -55,9 +56,9 @@ $text-color-white: #fff;
...
@@ -55,9 +56,9 @@ $text-color-white: #fff;
}
}
&
:first-child::before
{
&
:first-child::before
{
content
:
""
;
content
:
""
;
border-top
:
2
3
px
solid
transparent
;
border-top
:
2
1
px
solid
transparent
;
border-bottom
:
2
3
px
solid
transparent
;
border-bottom
:
2
1
px
solid
transparent
;
border-left
:
2
3
px
solid
#fff
;
border-left
:
2
1
px
solid
#fff
;
position
:
absolute
;
position
:
absolute
;
left
:
0
;
left
:
0
;
top
:
0
;
top
:
0
;
...
@@ -77,3 +78,7 @@ $text-color-white: #fff;
...
@@ -77,3 +78,7 @@ $text-color-white: #fff;
}
}
}
}
}
}
.btn-height
{
height
:
50px
;
}
\ No newline at end of file
app/controllers/applies_controller.rb
View file @
41dfcb2e
...
@@ -11,7 +11,7 @@ class AppliesController < ApplicationController
...
@@ -11,7 +11,7 @@ class AppliesController < ApplicationController
@apply
=
@job
.
apply_jobs
.
build
(
apply_params
)
@apply
=
@job
.
apply_jobs
.
build
(
apply_params
)
@apply
.
user_id
=
@user
.
id
@apply
.
user_id
=
@user
.
id
render
'new'
unless
@apply
.
valid?
render
'new'
if
@apply
.
in
valid?
end
end
def
create
def
create
...
...
app/mailers/application_mailer.rb
View file @
41dfcb2e
class
ApplicationMailer
<
ActionMailer
::
Base
class
ApplicationMailer
<
ActionMailer
::
Base
include
ApplicationHelper
helper
:application
default
from:
'from@example.com'
default
from:
'from@example.com'
layout
'mailer'
layout
'mailer'
end
end
app/models/apply_job.rb
View file @
41dfcb2e
class
ApplyJob
<
ApplicationRecord
class
ApplyJob
<
ApplicationRecord
VALID_EMAIL_REGEX
=
/\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
VALID_EMAIL_REGEX
=
/\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
ACCEPT_CONTENT_TYPE
=
%w[application/pdf application/msword application/zip application/xls application/xlsx]
.
freeze
belongs_to
:job
belongs_to
:job
belongs_to
:user
belongs_to
:user
...
@@ -9,7 +10,7 @@ class ApplyJob < ApplicationRecord
...
@@ -9,7 +10,7 @@ class ApplyJob < ApplicationRecord
validates
:email
,
presence:
true
,
length:
{
maximum:
255
},
validates
:email
,
presence:
true
,
length:
{
maximum:
255
},
format:
{
with:
VALID_EMAIL_REGEX
}
format:
{
with:
VALID_EMAIL_REGEX
}
validates
:cv
,
presence:
true
,
content_type:
validates
:cv
,
presence:
true
,
content_type:
{
in:
%w[application/pdf application/msword application/zip application/xls application/xlsx]
,
{
in:
ACCEPT_CONTENT_TYPE
,
message:
'must be a valid cv format'
},
message:
'must be a valid cv format'
},
size:
size:
{
less_than:
5
.
megabytes
,
{
less_than:
5
.
megabytes
,
...
...
app/views/applies/_validate_form.html.slim
0 → 100644
View file @
41dfcb2e
javascript:
$
(
"#apply_job_cv"
).
bind
(
"change"
,
function
()
{
const
size_in_megabytes
=
this
.
files
[
0
].
size
/
1024
/
1024
;
if
(
size_in_megabytes
>
5
)
{
alert
(
"Maximum file size is 5MB. Please choose a smaller file."
);
$
(
"#apply_job_cv"
).
val
(
""
);
}
});
\ No newline at end of file
app/views/applies/confirm.html.slim
View file @
41dfcb2e
-
provide
(
:title
,
'Confirmation'
)
-
provide
(
:title
,
'Confirmation'
)
.container
.container
=
render
'ribbon'
=
render
'ribbon'
.container
.container
h1
.my-5.text-center
h1
.my-5.text-center
|
Confirm
|
Confirmation
=
@job
.
title
.col
.col
=
form_with
(
model:
@apply
,
scope: :apply_job
,
url:
done_path
,
local:
true
)
do
|
f
|
=
form_with
(
model:
@apply
,
scope: :apply_job
,
url:
done_path
,
local:
true
)
do
|
f
|
...
@@ -26,6 +25,7 @@
...
@@ -26,6 +25,7 @@
span
.mx-2.label.form-control
span
.mx-2.label.form-control
=
@apply
.
email
=
@apply
.
email
=
f
.
hidden_field
:email
,
value:
@apply
.
email
,
class:
'form-control'
=
f
.
hidden_field
:email
,
value:
@apply
.
email
,
class:
'form-control'
.row.mb-5
.row.mb-5
.col-2
.col-2
/ = f.hidden_field :cv, value: @apply.cv, class: 'form-control'
/ = f.hidden_field :cv, value: @apply.cv, class: 'form-control'
...
@@ -35,9 +35,8 @@
...
@@ -35,9 +35,8 @@
span
.form-control
span
.form-control
=
url_for
(
@apply
.
cv
)
=
url_for
(
@apply
.
cv
)
.row.justify-content-between
=
link_to
'Edit'
,
apply_path
(
job_id:
@job
.
id
),
class:
'btn btn-secondary w-25 btn-height mr-5 my-5'
.col-6
=
link_to
'Edit'
,
apply_path
(
job_id:
@job
.
id
),
class:
'btn btn-secondary py-2 px-4 w-100'
=
f
.
submit
'Confirm'
,
class:
'btn btn-primary w-25 btn-height mx-5 my-5'
.col-6
=
f
.
submit
'Confirm'
,
class:
'btn btn-primary w-100'
=
render
'validate_form'
app/views/applies/new.html.slim
View file @
41dfcb2e
-
provide
(
:title
,
'Apply job'
)
-
provide
(
:title
,
'Apply job'
)
.container
.container
=
render
'ribbon'
=
render
'ribbon'
.container
.container
h1
.my-5.text-center
h1
.my-5.text-center
|
Apply form
|
Apply form
p
.fs-5.fw-bold.mb-4.text-center
|
Apply for
=
@job
.
title
=
@job
.
title
.col
.col
=
form_with
(
model:
@apply
,
url:
confirm_path
,
local:
true
)
do
|
f
|
=
form_with
(
model:
@apply
,
url:
confirm_path
,
local:
true
)
do
|
f
|
...
@@ -26,4 +28,6 @@
...
@@ -26,4 +28,6 @@
=
f
.
label
:cv
,
class:
'form-label label'
=
f
.
label
:cv
,
class:
'form-label label'
.col-10
.col-10
=
f
.
file_field
:cv
,
accept:
'application/pdf, application/msword, application/zip, application/xls, application/xlsx'
,
class:
'form-control'
=
f
.
file_field
:cv
,
accept:
'application/pdf, application/msword, application/zip, application/xls, application/xlsx'
,
class:
'form-control'
=
f
.
submit
'Confirm'
,
class:
'btn btn-primary w-100'
=
f
.
submit
'Confirm'
,
class:
'btn btn-primary w-25 my-4 btn-height'
=
render
'validate_form'
app/views/user_mailer/apply_job.html.slim
View file @
41dfcb2e
app/views/user_mailer/apply_job.text.slim
View file @
41dfcb2e
...
@@ -14,6 +14,6 @@
...
@@ -14,6 +14,6 @@
=
"
\n
"
=
"
\n
"
'
Email:
#{
@apply
.
email
}
'
Email:
#{
@apply
.
email
}
=
"
\n
"
=
"
\n
"
'
CV:
#{
@apply
.
cv
}
'
CV:
#{
url_for
(
@apply
.
cv
)
}
=
"
\n
"
=
"
\n
"
'
Best,
'
Best,
config/application.rb
View file @
41dfcb2e
...
@@ -10,10 +10,6 @@ module VenJob
...
@@ -10,10 +10,6 @@ module VenJob
class
Application
<
Rails
::
Application
class
Application
<
Rails
::
Application
# Initialize configuration defaults for originally generated Rails version.
# Initialize configuration defaults for originally generated Rails version.
config
.
load_defaults
6.1
config
.
load_defaults
6.1
config
.
to_prepare
do
ActionMailer
::
Base
.
helper
"application"
end
# Configuration for the application, engines, and railties goes here.
# Configuration for the application, engines, and railties goes here.
#
#
# These settings can be overridden in specific environments using the files
# These settings can be overridden in specific environments using the files
...
...
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