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
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
48 additions
and
31 deletions
+48
-31
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
+9
-11
app/views/applies/new.html.slim
+7
-3
app/views/user_mailer/apply_job.html.slim
+1
-1
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;
height
:
100%
;
background
:
#f3f5fa
;
text-align
:
center
;
padding
:
12
px
;
padding
:
8
px
;
position
:
relative
;
font-size
:
14px
;
font-size
:
16px
;
font-weight
:
700
;
text-decoration
:
none
;
color
:
#808080
;
.circle
{
...
...
@@ -42,11 +43,11 @@ $text-color-white: #fff;
&
:after
{
content
:
""
;
border-top
:
2
3
px
solid
transparent
;
border-bottom
:
2
3
px
solid
transparent
;
border-left
:
2
3
px
solid
#f3f5fa
;
border-top
:
2
1
px
solid
transparent
;
border-bottom
:
2
1
px
solid
transparent
;
border-left
:
2
1
px
solid
#f3f5fa
;
position
:
absolute
;
right
:
-2
3
px
;
right
:
-2
1
px
;
top
:
0
;
z-index
:
1
;
}
...
...
@@ -55,9 +56,9 @@ $text-color-white: #fff;
}
&
:first-child::before
{
content
:
""
;
border-top
:
2
3
px
solid
transparent
;
border-bottom
:
2
3
px
solid
transparent
;
border-left
:
2
3
px
solid
#fff
;
border-top
:
2
1
px
solid
transparent
;
border-bottom
:
2
1
px
solid
transparent
;
border-left
:
2
1
px
solid
#fff
;
position
:
absolute
;
left
:
0
;
top
:
0
;
...
...
@@ -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
@apply
=
@job
.
apply_jobs
.
build
(
apply_params
)
@apply
.
user_id
=
@user
.
id
render
'new'
unless
@apply
.
valid?
render
'new'
if
@apply
.
in
valid?
end
def
create
...
...
app/mailers/application_mailer.rb
View file @
41dfcb2e
class
ApplicationMailer
<
ActionMailer
::
Base
include
ApplicationHelper
helper
:application
default
from:
'from@example.com'
layout
'mailer'
end
app/models/apply_job.rb
View file @
41dfcb2e
class
ApplyJob
<
ApplicationRecord
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
:user
...
...
@@ -9,7 +10,7 @@ class ApplyJob < ApplicationRecord
validates
:email
,
presence:
true
,
length:
{
maximum:
255
},
format:
{
with:
VALID_EMAIL_REGEX
}
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'
},
size:
{
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'
)
.container
=
render
'ribbon'
=
render
'ribbon'
.container
h1
.my-5.text-center
|
Confirm
=
@job
.
title
|
Confirmation
.col
=
form_with
(
model:
@apply
,
scope: :apply_job
,
url:
done_path
,
local:
true
)
do
|
f
|
...
...
@@ -26,6 +25,7 @@
span
.mx-2.label.form-control
=
@apply
.
email
=
f
.
hidden_field
:email
,
value:
@apply
.
email
,
class:
'form-control'
.row.mb-5
.col-2
/ = f.hidden_field :cv, value: @apply.cv, class: 'form-control'
...
...
@@ -33,11 +33,10 @@
.col-10
=
f
.
file_field
:cv
,
accept:
'application/pdf, application/msword, application/zip, application/xls, application/xlsx'
span
.form-control
=
url_for
(
@apply
.
cv
)
=
url_for
(
@apply
.
cv
)
=
link_to
'Edit'
,
apply_path
(
job_id:
@job
.
id
),
class:
'btn btn-secondary w-25 btn-height mr-5 my-5'
=
f
.
submit
'Confirm'
,
class:
'btn btn-primary w-25 btn-height mx-5 my-5'
.row.justify-content-between
.col-6
=
link_to
'Edit'
,
apply_path
(
job_id:
@job
.
id
),
class:
'btn btn-secondary py-2 px-4 w-100'
.col-6
=
f
.
submit
'Confirm'
,
class:
'btn btn-primary w-100'
\ No newline at end of file
=
render
'validate_form'
app/views/applies/new.html.slim
View file @
41dfcb2e
-
provide
(
:title
,
'Apply job'
)
.container
=
render
'ribbon'
=
render
'ribbon'
.container
h1
.my-5.text-center
|
Apply form
|
Apply form
p
.fs-5.fw-bold.mb-4.text-center
|
Apply for
=
@job
.
title
.col
=
form_with
(
model:
@apply
,
url:
confirm_path
,
local:
true
)
do
|
f
|
...
...
@@ -26,4 +28,6 @@
=
f
.
label
:cv
,
class:
'form-label label'
.col-10
=
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
...
...
@@ -6,7 +6,7 @@ p
|
Job title:
#{
@job
.
title
}
p
|
Location:
= show_location(@job.cities)
=
show_location
(
@job
.
cities
)
p
|
Company:
#{
@job
.
company
.
name
}
br
/
...
...
app/views/user_mailer/apply_job.text.slim
View file @
41dfcb2e
...
...
@@ -14,6 +14,6 @@
=
"
\n
"
'
Email:
#{
@apply
.
email
}
=
"
\n
"
'
CV:
#{
@apply
.
cv
}
'
CV:
#{
url_for
(
@apply
.
cv
)
}
=
"
\n
"
'
Best,
config/application.rb
View file @
41dfcb2e
...
...
@@ -10,10 +10,6 @@ module VenJob
class
Application
<
Rails
::
Application
# Initialize configuration defaults for originally generated Rails version.
config
.
load_defaults
6.1
config
.
to_prepare
do
ActionMailer
::
Base
.
helper
"application"
end
# Configuration for the application, engines, and railties goes here.
#
# 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