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
4362da42
Commit
4362da42
authored
Aug 11, 2021
by
Mai Hoang Thai Ha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed review part 1
parent
3926645e
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
40 additions
and
108 deletions
+40
-108
app/assets/stylesheets/applies.scss
+1
-2
app/controllers/applies_controller.rb
+12
-19
app/models/apply_job.rb
+4
-3
app/views/applies/confirm.html.slim
+9
-6
app/views/applies/new.html.slim
+4
-2
app/views/jobs/_job_details.html.slim
+0
-69
app/views/shared/_error_messages.html.slim
+2
-0
app/views/user_mailer/apply_job.html.slim
+1
-2
config/application.rb
+3
-0
config/environments/development.rb
+4
-0
yarn.lock
+0
-5
No files found.
app/assets/stylesheets/applies.scss
View file @
4362da42
...
...
@@ -6,7 +6,7 @@
color
:
black
;
}
.ribbon
{
.ribbon
{
font-weight
:
400
;
line-height
:
1
.5
;
color
:
#212529
;
...
...
@@ -56,7 +56,6 @@
.circle
{
background
:
#0d6efd
;
}
}
.line
{
flex
:
1
0
32px
;
...
...
app/controllers/applies_controller.rb
View file @
4362da42
class
AppliesController
<
ApplicationController
before_action
:load_job
,
only:
%i[confirm create]
def
create
@user
=
User
.
find_by
(
id:
1
)
@apply
=
@job
.
apply_jobs
.
build
(
apply_params
)
@apply
.
user_id
=
@user
.
id
@apply
.
cv
.
attach
(
params
[
:apply_job
][
:cv
])
if
@apply
.
save
UserMailer
.
apply_job
(
@user
,
@job
,
@apply
).
deliver_now
flash
.
now
[
:info
]
=
'Job application information has been sent to your email'
else
render
'new'
end
end
def
new
@job
=
Job
.
find_by
(
id:
params
[
:job_id
])
@apply
=
@job
.
apply_jobs
.
build
...
...
@@ -25,11 +11,18 @@ class AppliesController < ApplicationController
@apply
=
@job
.
apply_jobs
.
build
(
apply_params
)
@apply
.
user_id
=
@user
.
id
if
@apply
.
valid?
@name
=
@apply
.
user_name
@email
=
@apply
.
email
@cv
=
@apply
.
cv
@job_id
=
@apply
.
job_id
render
'new'
unless
@apply
.
valid?
end
def
create
@user
=
User
.
find_by
(
id:
1
)
@apply
=
@job
.
apply_jobs
.
build
(
apply_params
)
@apply
.
user_id
=
@user
.
id
@apply
.
cv
.
attach
(
params
[
:apply_job
][
:cv
])
if
@apply
.
save
UserMailer
.
apply_job
(
@user
,
@job
,
@apply
).
deliver_now
flash
.
now
[
:info
]
=
'Job application information has been sent to your email'
else
render
'new'
end
...
...
app/models/apply_job.rb
View file @
4362da42
...
...
@@ -8,9 +8,10 @@ class ApplyJob < ApplicationRecord
validates
:user_name
,
presence:
true
,
length:
{
maximum:
50
}
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]
,
validates
:cv
,
presence:
true
,
content_type:
{
in:
%w[application/pdf application/msword application/zip application/xls application/xlsx]
,
message:
'must be a valid cv format'
},
size:
{
less_than:
5
.
megabytes
,
size:
{
less_than:
5
.
megabytes
,
message:
'should be less than 5MB'
}
end
app/views/applies/confirm.html.slim
View file @
4362da42
...
...
@@ -11,26 +11,29 @@
=
form_with
(
model:
@apply
,
scope: :apply_job
,
url:
done_path
,
local:
true
)
do
|
f
|
.mb-5
=
f
.
hidden_field
:job_id
,
value:
@job
_
id
,
class:
'form-control'
=
f
.
hidden_field
:job_id
,
value:
@job
.
id
,
class:
'form-control'
=
f
.
label
:name
,
'Full name:'
,
class:
'form-label label'
span
.mx-2.label
=
@name
=
f
.
hidden_field
:user_name
,
value:
@name
,
class:
'form-control'
=
@
apply
.
user_
name
=
f
.
hidden_field
:user_name
,
value:
@
apply
.
user_
name
,
class:
'form-control'
.mb-5
=
f
.
label
:email
,
'Email:'
,
class:
'form-label label'
span
.mx-2.label
=
@email
=
f
.
hidden_field
:email
,
value:
@email
,
class:
'form-control'
=
@
apply
.
email
=
f
.
hidden_field
:email
,
value:
@
apply
.
email
,
class:
'form-control'
.mb-5
span
=
f
.
hidden_field
:cv
,
value:
@apply
.
cv
,
class:
'form-control'
=
f
.
label
:cv
,
'Cv: '
,
class:
'form-label label'
=
f
.
file_field
:cv
,
accept:
'application/pdf, application/msword, application/zip, application/xls, application/xlsx'
=
url_for
(
@apply
.
cv
)
.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'
=
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'
...
...
app/views/applies/new.html.slim
View file @
4362da42
...
...
@@ -3,10 +3,10 @@
=
render
'ribbon'
.container
h1
.my-5.text-center
|
Apply for
|
Apply for
m
=
@job
.
title
.col
=
form_with
(
model:
@apply
,
scope: :apply_job
,
url:
confirm_path
,
local:
true
)
do
|
f
|
=
form_with
(
model:
@apply
,
url:
confirm_path
,
local:
true
)
do
|
f
|
=
render
'shared/error_messages'
,
object:
f
.
object
.mb-5
=
f
.
hidden_field
:job_id
,
value:
@job
.
id
,
class:
'form-control'
...
...
@@ -17,6 +17,8 @@
=
f
.
label
:email
,
class:
'form-label label'
=
f
.
text_field
:email
,
class:
'form-control'
.mb-5
/ - if @user.cv.attached?
/ = url_for(@user.cv)
span
.label
=
f
.
file_field
:cv
,
accept:
'application/pdf, application/msword, application/zip, application/xls, application/xlsx'
=
f
.
submit
'Confirm'
,
class:
'btn btn-primary w-100'
app/views/jobs/_job_details.html.slim
deleted
100644 → 0
View file @
3926645e
.job-detail.my5
.job-apply.d-flex.align-items-center.justify-content-between
h2
.align-items-start
=
@job
.
title
=
link_to
'Apply for this job'
,
apply_path
(
job_id:
Job
.
find_by
(
title:
@job
.
title
).
id
),
class:
'btn btn-primary'
p
.text-secondary
=
@job
.
company
.
name
.row.bg-light
.col-4
ul
.list-unstyled
li
strong
|
Location
-
@job
.
cities
.
each
do
|
city
|
p
=
city
.
name
li
strong
|
Salary
p
.text-success
=
@job
.
salary
.col-4
ul
.list-unstyled
li
strong
|
Type
p
=
@job
.
job_type
li
strong
|
Position
p
=
@job
.
position
.col-4
ul
.list-unstyled
li
strong
|
Experience
p
=
@job
.
experience
li
strong
|
Expiration date
p
=
@job
.
expiration_date
.job-benefits.my-4
h3
|
Benefits
.row
-
@job
.
benefit
.
split
(
'---'
).
each
do
|
benefit
|
li
.list-unstyled.col-4.text-secondary
=
benefit
.job-desc.my-4
h3
|
Description
=
@job
.
description
.
html_safe
()
.job-req.my-4
h3
|
Requirement
=
@job
.
requirement
.
html_safe
()
.job-info.my-4
h3
|
Other info
-
@job
.
other_info
.
split
(
'---'
).
each
do
|
info
|
li
.text-secondary
=
info
.job-apply.d-flex.align-items-center.justify-content-between
=
link_to
'Apply for this job'
,
apply_path
(
job_id:
Job
.
find_by
(
title:
@job
.
title
).
id
),
class:
'btn btn-primary'
=
link_to
'Favorite'
,
'#'
,
class:
'btn btn-primary'
app/views/shared/_error_messages.html.slim
View file @
4362da42
...
...
@@ -7,3 +7,4 @@
-
object
.
errors
.
full_messages
.
each
do
|
msg
|
li
.text-danger
=
msg
\ No newline at end of file
app/views/user_mailer/apply_job.html.slim
View file @
4362da42
...
...
@@ -6,8 +6,7 @@ p
|
Job title:
#{
@job
.
title
}
p
|
Location:
-
@job
.
cities
.
each
do
|
city
|
span
=
city
.
name
= show_location(@job.cities)
p
|
Company:
#{
@job
.
company
.
name
}
br
/
...
...
config/application.rb
View file @
4362da42
...
...
@@ -11,6 +11,9 @@ module VenJob
# 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
...
...
config/environments/development.rb
View file @
4362da42
...
...
@@ -96,4 +96,8 @@ Rails.application.configure do
Bullet
.
rails_logger
=
true
Bullet
.
add_footer
=
true
end
config
.
action_mailer
.
delivery_method
=
:smtp
config
.
action_mailer
.
smtp_settings
=
{
:address
=>
'127.0.0.1'
,
:port
=>
1025
}
config
.
action_mailer
.
raise_delivery_errors
=
false
end
yarn.lock
View file @
4362da42
...
...
@@ -1609,11 +1609,6 @@ browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.16.6, browserslist@^4
escalade "^3.1.1"
node-releases "^1.1.71"
bs-stepper@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/bs-stepper/-/bs-stepper-1.7.0.tgz#bfa4cc51c4e67957caae57f5bdcba1977186bac1"
integrity sha512-+DX7UKKgw2GI6ucsSCRd19VHYrxf/8znRCLs1lQVVLxz+h7EqgIOxoHcJ0/QTaaNoR9Cwg78ydo6hXIasyd3LA==
buffer-from@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
...
...
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