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
Nguyen Hoang Mai Phuong
VeNJOB
Commits
f17e21bc
Commit
f17e21bc
authored
Aug 12, 2021
by
Nguyen Hoang Mai Phuong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix progress bar and add session for input field
parent
b4c15816
Pipeline
#1389
failed with stages
in 0 seconds
Changes
18
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
152 additions
and
99 deletions
+152
-99
.gitignore
+2
-0
app/assets/stylesheets/custom.scss
+28
-4
app/controllers/apply_jobs_controller.rb
+22
-7
app/helpers/application_helper.rb
+12
-0
app/mailers/application_mailer.rb
+1
-1
app/mailers/apply_job_mailer.rb
+1
-15
app/models/apply_job.rb
+2
-1
app/models/industry.rb
+2
-2
app/models/job.rb
+1
-1
app/views/apply_job_mailer/create_apply.html.slim
+9
-5
app/views/apply_job_mailer/create_apply.text.slim
+6
-1
app/views/apply_jobs/_ribbon.html.slim
+6
-5
app/views/apply_jobs/confirm.html.slim
+16
-23
app/views/apply_jobs/done.html.slim
+5
-12
app/views/apply_jobs/new.html.slim
+10
-18
app/views/shared/_error_messages.html.slim
+12
-0
config/environments/production.rb
+14
-1
config/schedule.rb
+3
-3
No files found.
.gitignore
View file @
f17e21bc
...
@@ -38,3 +38,4 @@
...
@@ -38,3 +38,4 @@
/yarn-error.log
/yarn-error.log
yarn-debug.log*
yarn-debug.log*
.yarn-integrity
.yarn-integrity
/config/credentials.yml.enc
\ No newline at end of file
app/assets/stylesheets/custom.scss
View file @
f17e21bc
...
@@ -8,6 +8,10 @@
...
@@ -8,6 +8,10 @@
padding-bottom
:
10px
;
padding-bottom
:
10px
;
}
}
footer
{
min-height
:
227px
;
}
.navbar
ul
li
a
{
.navbar
ul
li
a
{
color
:
#fff
;
color
:
#fff
;
font-size
:
18px
;
font-size
:
18px
;
...
@@ -63,6 +67,8 @@
...
@@ -63,6 +67,8 @@
justify-content
:
center
;
justify-content
:
center
;
}
}
// ribbon
.ribbon
{
.ribbon
{
width
:
100%
;
width
:
100%
;
}
}
...
@@ -85,7 +91,7 @@
...
@@ -85,7 +91,7 @@
width
:
40px
;
width
:
40px
;
height
:
40px
;
height
:
40px
;
line-height
:
40px
;
line-height
:
40px
;
border
:
1
px
solid
#ddd
;
border
:
2
px
solid
#ddd
;
display
:
block
;
display
:
block
;
text-align
:
center
;
text-align
:
center
;
margin
:
0
auto
10px
auto
;
margin
:
0
auto
10px
auto
;
...
@@ -97,7 +103,7 @@
...
@@ -97,7 +103,7 @@
content
:
''
;
content
:
''
;
position
:absolute
;
position
:absolute
;
width
:
100%
;
width
:
100%
;
height
:
1
px
;
height
:
3
px
;
line-height
:
40px
;
line-height
:
40px
;
background-color
:
#ddd
;
background-color
:
#ddd
;
top
:
15px
;
top
:
15px
;
...
@@ -121,10 +127,27 @@
...
@@ -121,10 +127,27 @@
background-color
:
blue
;
background-color
:
blue
;
}
}
// form
.btn-space
{
.btn-space
{
margin-right
:
10px
;
margin-right
:
10px
;
}
}
footer
{
.form-apply
label
{
min-height
:
calc
(
100vh
-
327px
);
margin
:
8px
0
;
font-size
:
18px
;
}
#error_explanation
{
color
:
red
;
ul
{
color
:
red
;
margin
:
0
0
30px
0
;
}
}
.field_with_errors
{
.form-control
{
color
:
$danger
;
}
}
}
\ No newline at end of file
app/controllers/apply_jobs_controller.rb
View file @
f17e21bc
class
ApplyJobsController
<
ApplicationController
class
ApplyJobsController
<
ApplicationController
def
new
def
new
@apply_job
=
ApplyJob
.
new
job
=
Job
.
find_by
(
id:
params
[
:job_id
])
@apply_job
.
job_id
=
params
[
:job_id
]
return
root_path
unless
job
@apply_job
=
if
session
[
:apply_job
].
present?
ApplyJob
.
new
(
session
[
:apply_job
])
else
ApplyJob
.
new
end
@apply_job
.
job_id
=
job
.
id
end
end
def
confirm
def
confirm
@apply_job
=
ApplyJob
.
new
(
apply_params
)
@apply_job
=
ApplyJob
.
new
(
apply_params
)
@apply_job
.
job_id
=
apply_params
[
:job_id
]
@apply_job
.
user_id
=
User
.
find_by
(
id:
1
).
id
if
@apply_job
.
valid?
session
[
:apply_job
]
=
@apply_job
render
:confirm
else
render
:new
end
end
end
def
done
def
done
@apply_job
=
ApplyJob
.
new
(
apply_params
)
@apply_job
=
ApplyJob
.
new
(
apply_params
)
@apply_job
.
user_id
=
User
.
find_by
(
id:
1
).
id
@apply_job
.
user_id
=
User
.
find_by
(
id:
1
).
id
@
apply_job
.
job_id
=
apply_params
[
:job_id
]
@
job
=
Job
.
latest_jobs
.
find
(
apply_params
[
:job_id
])
if
@apply_job
.
save
!
if
@apply_job
.
save
ApplyJobMailer
.
with
(
apply_job:
@apply_job
).
create_apply
.
deliver_now
ApplyJobMailer
.
with
(
apply_job:
@apply_job
,
job:
@job
).
create_apply
.
deliver_now
flash
.
now
[
:success
]
=
"You have applied successfully"
flash
.
now
[
:success
]
=
'You have applied successfully'
else
else
flash
.
now
[
:danger
]
=
'Please apply again'
redirect_to
root_url
redirect_to
root_url
end
end
session
[
:apply_job
]
=
nil
end
end
private
private
...
...
app/helpers/application_helper.rb
View file @
f17e21bc
...
@@ -4,4 +4,16 @@ module ApplicationHelper
...
@@ -4,4 +4,16 @@ module ApplicationHelper
input
.
strftime
(
'%d/%m/%Y'
)
input
.
strftime
(
'%d/%m/%Y'
)
end
end
def
class_active
(
link_path
)
return
unless
current_page?
(
link_path
)
'active'
end
def
current_page?
(
*
paths
)
return
true
if
paths
.
include?
(
request
.
path
)
false
end
end
end
app/mailers/application_mailer.rb
View file @
f17e21bc
class
ApplicationMailer
<
ActionMailer
::
Base
class
ApplicationMailer
<
ActionMailer
::
Base
default
from:
'
nhmphuong1005@gmail
.com'
default
from:
'
info@venjob
.com'
layout
'mailer'
layout
'mailer'
end
end
app/mailers/apply_job_mailer.rb
View file @
f17e21bc
class
ApplyJobMailer
<
ApplicationMailer
class
ApplyJobMailer
<
ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.apply_job_mailer.create_apply.subject
#
def
create_apply
def
create_apply
@apply_job
=
params
[
:apply_job
]
@apply_job
=
params
[
:apply_job
]
#@name = params[:name]
@job
=
params
[
:job
]
# @email = params[:email]
# @cv = params[:email]
mail
to:
@apply_job
.
email
,
subject:
'CONFIRM INFORMATION'
mail
to:
@apply_job
.
email
,
subject:
'CONFIRM INFORMATION'
end
end
# def create_apply
# @greeting = "Hi"
# mail to: "to@example.org"
# end
end
end
app/models/apply_job.rb
View file @
f17e21bc
...
@@ -5,5 +5,6 @@ class ApplyJob < ApplicationRecord
...
@@ -5,5 +5,6 @@ class ApplyJob < ApplicationRecord
validates
:name
,
presence:
true
,
length:
{
maximum:
200
}
validates
:name
,
presence:
true
,
length:
{
maximum:
200
}
VALID_EMAIL_REGEX
=
/\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
VALID_EMAIL_REGEX
=
/\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates
:email
,
presence:
true
,
length:
{
maximum:
255
},
format:
{
with:
VALID_EMAIL_REGEX
}
validates
:email
,
presence:
true
,
length:
{
maximum:
255
},
format:
{
with:
VALID_EMAIL_REGEX
}
validates
:cv
,
attached:
true
,
content_type:
{
in:
'application/pdf'
,
message:
'must be a valid cv format'
}
validates
:cv
,
presence:
true
,
content_type:
{
in:
'application/pdf'
,
message:
'must be a valid image format'
},
size:
{
less_than:
5
.
megabytes
,
message:
'should be less than 5MB'
}
end
end
app/models/industry.rb
View file @
f17e21bc
...
@@ -4,8 +4,8 @@ class Industry < ApplicationRecord
...
@@ -4,8 +4,8 @@ class Industry < ApplicationRecord
has_and_belongs_to_many
:jobs
has_and_belongs_to_many
:jobs
LATEST_INDUSTRY_NUMBER
=
9
LATEST_INDUSTRY_NUMBER
=
9
scope
:top_industries
,
->
{
joins
(
:jobs
).
group
(
:name
,
:slug
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_INDUSTRY_NUMBER
)
}
scope
:top_industries
,
->
{
group
(
:name
,
:slug
).
order
(
'count_all DESC'
).
count
.
take
(
LATEST_INDUSTRY_NUMBER
)
}
scope
:industry_list
,
->
{
joins
(
:jobs
).
group
(
:name
,
:slug
).
having
(
'count_all >= ?'
,
1
).
order
(
'count_all DESC'
).
count
}
scope
:industry_list
,
->
{
group
(
:name
,
:slug
).
having
(
'count_all >= ?'
,
1
).
order
(
'count_all DESC'
).
count
}
def
normalize_friendly_id
(
string
)
def
normalize_friendly_id
(
string
)
string
.
to_s
.
to_slug
.
normalize
(
transliterations: :vietnamese
).
to_s
string
.
to_s
.
to_slug
.
normalize
(
transliterations: :vietnamese
).
to_s
...
...
app/models/job.rb
View file @
f17e21bc
...
@@ -8,7 +8,7 @@ class Job < ApplicationRecord
...
@@ -8,7 +8,7 @@ class Job < ApplicationRecord
has_and_belongs_to_many
:industries
has_and_belongs_to_many
:industries
has_and_belongs_to_many
:cities
has_and_belongs_to_many
:cities
LATEST_JOB_NUMBER
=
5
LATEST_JOB_NUMBER
=
5
scope
:latest_jobs
,
->
{
includes
(
:cities
,
:
industries
,
:
company
).
order
(
'created_at DESC'
)
}
scope
:latest_jobs
,
->
{
includes
(
:cities
,
:company
).
order
(
'created_at DESC'
)
}
def
normalize_friendly_id
(
string
)
def
normalize_friendly_id
(
string
)
string
.
to_s
.
to_slug
.
normalize
(
transliterations: :vietnamese
).
to_s
string
.
to_s
.
to_slug
.
normalize
(
transliterations: :vietnamese
).
to_s
...
...
app/views/apply_job_mailer/create_apply.html.slim
View file @
f17e21bc
...
@@ -4,11 +4,15 @@ p
...
@@ -4,11 +4,15 @@ p
|
,
|
,
p
p
|
Thank you for applied with VenJOB. Your applied job's information is as follow:
|
Thank you for applied with VenJOB. Your applied job's information is as follow:
p
/ Job title: <Job title>
|
Job title:
/ Location: <Job location>
=
@job
.
title
/ Company: <Company>
p
|
Company:
=
@job
.
company
.
name
p
|
Location:
=
@job
.
cities
.
map
(
&
:name
).
uniq
.
join
(
' , '
)
p
p
|
Your submitted information:
|
Your submitted information:
p
p
...
...
app/views/apply_job_mailer/create_apply.text.slim
View file @
f17e21bc
|
Dear
|
Dear
= @apply_job.name
= @apply_job.name
|
,
|
,
|
Thank you for applied with VenJOB. Your applied job's information is as follow:
|
Thank you for applied with VenJOB. Your applied job's information is as follow:
|
Your submitted information:
|
Your submitted information:
|
Job title:
= @job.title
|
Company:
= @job.company.name
|
Location:
= @job.cities.map(&:name).uniq.join(' , ')
|
Full Name:
|
Full Name:
= @apply_job.name
= @apply_job.name
|
Email:
|
Email:
...
...
app/views/apply_jobs/_ribbon.html.slim
View file @
f17e21bc
.ribbon
.ribbon
ul
.progressbar
ul
.progressbar
li
.active
li
class
=
"#{class_active(apply_path)}"
.span.indicator
.span.indicator
.span.title
Apply
.span.title
Apply
li
li
class
=
"#{class_active(confirm_path)}"
.span.indicator
.2
.span.indicator
.span.title
Confirm
.span.title
Confirm
li
li
class
=
"#{class_active(done_path)}"
.span.indicator
.3
.span.indicator
.span.title
Done
.span.title
Done
\ No newline at end of file
app/views/apply_jobs/confirm.html.slim
View file @
f17e21bc
.ribbon
=
render
'ribbon'
ul
.progressbar
h2
.text-center
li
.span.indicator
.span.title
Apply
li
.active
.span.indicator.2
.span.title
Confirm
li
.span.indicator.3
.span.title
Done
h2
.text-center.p-4
|
CONFIRM INFORMATION
|
CONFIRM INFORMATION
.col-md-6.offset-md-3
.col-md-6.offset-md-3.form-apply
=
form_with
(
model:
@apply_job
,
url:
'/done'
,
local:
true
)
do
|
f
|
=
form_with
(
model:
@apply_job
,
url:
done_path
,
local:
true
)
do
|
f
|
=
render
'shared/error_messages'
=
f
.
hidden_field
:job_id
=
f
.
hidden_field
:job_id
=
f
.
label
:name
=
f
.
label
:name
=
f
.
text_field
:name
,
required:
true
,
disabled:
true
,
length:
{
maximum:
200
},
placeholder:
"Type name..."
,
class:
'form-control'
=
f
.
text_field
:name
,
required:
true
,
disabled:
true
,
length:
{
maximum:
200
},
=
f
.
hidden_field
:name
,
required:
true
,
length:
{
maximum:
50
}
placeholder:
"Type name..."
,
class:
'form-control'
=
f
.
hidden_field
:name
=
f
.
label
:email
=
f
.
label
:email
=
f
.
text_field
:email
,
required:
true
,
disabled:
true
,
length:
{
maximum:
255
},
format:
{
with:
ApplyJob
::
VALID_EMAIL_REGEX
},
placeholder:
"Type email..."
,
class:
'form-control'
=
f
.
text_field
:email
,
required:
true
,
disabled:
true
,
length:
{
maximum:
255
},
format:
{
with:
ApplyJob
::
VALID_EMAIL_REGEX
},
=
f
.
hidden_field
:email
,
required:
true
,
length:
{
maximum:
255
},
format:
{
with:
ApplyJob
::
VALID_EMAIL_REGEX
}
placeholder:
"Type email..."
,
class:
'form-control'
=
f
.
hidden_field
:email
p
.my-1
p
.my-1
=
f
.
label
:cv
,
"CV"
=
f
.
label
:cv
,
"CV"
p
p
=
f
.
file_field
:cv
,
required:
true
,
accept:
"application/pdf"
=
f
.
file_field
:cv
,
required:
true
,
accept:
"application/pdf"
,
size:
{
less_than:
5
.
megabytes
,
message
:"should be less than 5MB"
}
.span.p-4.text-center
.span.p-3.text-center
=
link_to
"Back"
,
apply_path
,
class:
"btn btn-primary btn-lg btn-space"
=
link_to
"Back"
,
apply_path
(
job_id:
@apply_job
.
job_id
),
class:
"btn btn-primary btn-space"
=
f
.
submit
"Done"
,
class:
"btn btn-primary btn-lg btn-space"
=
f
.
submit
"Done"
,
class:
"btn btn-primary btn-space"
\ No newline at end of file
\ No newline at end of file
app/views/apply_jobs/done.html.slim
View file @
f17e21bc
.ribbon.py-4
=
render
'ribbon'
ul
.progressbar
.container.py-5
li
.span.indicator
.span.title
Apply
li
.span.indicator.2
.span.title
Confirm
li
.active
.span.indicator.3
.span.title
Done
.container.py-4
h3
.py-3.text-center
h3
.py-3.text-center
|
Thank you for apply
|
Thank you for apply
p
.p-3.text-center
=
link_to
"Back to TOP page"
,
root_path
,
class:
"btn btn-primary btn-lg"
\ No newline at end of file
app/views/apply_jobs/new.html.slim
View file @
f17e21bc
.ribbon
=
render
'ribbon'
ul
.progressbar
h2
.text-center.form-title
li
.active
.span.indicator
.span.title
Apply
li
.span.indicator.2
.span.title
Confirm
li
.span.indicator.3
.span.title
Done
h2
.text-center.p-4
|
APPLY INFORMATION
|
APPLY INFORMATION
.col-md-6.offset-md-3
.col-md-6.offset-md-3.form-apply
=
form_with
(
model:
@apply_job
,
url:
'/confirm'
,
local:
true
)
do
|
f
|
=
form_with
(
model:
@apply_job
,
url:
confirm_path
,
local:
true
)
do
|
f
|
=
render
'shared/error_messages'
=
f
.
hidden_field
:job_id
=
f
.
hidden_field
:job_id
=
f
.
label
:name
=
f
.
text_field
:name
,
required:
true
,
length:
{
maximum:
200
},
placeholder:
"Type name..."
,
class:
'form-control'
=
f
.
text_field
:name
,
required:
true
,
length:
{
maximum:
200
},
placeholder:
"Type name..."
,
class:
'form-control'
=
f
.
label
:email
=
f
.
label
:email
...
@@ -21,6 +13,6 @@ h2.text-center.p-4
...
@@ -21,6 +13,6 @@ h2.text-center.p-4
p
.my-1
p
.my-1
=
f
.
label
:cv
,
"CV"
=
f
.
label
:cv
,
"CV"
p
p
=
f
.
file_field
:cv
,
required:
true
,
accept:
"application/pdf"
=
f
.
file_field
:cv
,
required:
true
,
accept:
"application/pdf"
,
size:
{
less_than:
5
.
megabytes
,
message
:"should be less than 5MB"
}
.span.p-4.text-center
.span.p-3.text-center
=
f
.
submit
"Confirm"
,
class:
"btn btn-primary btn-lg"
=
f
.
submit
"Confirm"
,
class:
"btn btn-primary"
\ No newline at end of file
\ No newline at end of file
app/views/shared/_error_messages.html.slim
0 → 100644
View file @
f17e21bc
-
if
@apply_job
.
errors
.
any?
#error_explanation
.alert.alert-danger
|
The form contains
=
pluralize
(
@apply_job
.
errors
.
count
,
"error"
)
|
.
ul
-
@apply_job
.
errors
.
full_messages
.
each
do
|
msg
|
li
=
msg
\ No newline at end of file
config/environments/production.rb
View file @
f17e21bc
...
@@ -40,6 +40,19 @@ Rails.application.configure do
...
@@ -40,6 +40,19 @@ Rails.application.configure do
# Store uploaded files on the local file system (see config/storage.yml for options).
# Store uploaded files on the local file system (see config/storage.yml for options).
config
.
active_storage
.
service
=
:local
config
.
active_storage
.
service
=
:local
config
.
action_mailer
.
perform_deliveries
=
true
config
.
action_mailer
.
delivery_method
=
:smtp
config
.
action_mailer
.
default_url_options
=
{
host:
"localhost:3000"
,
protocol:
"http"
}
config
.
action_mailer
.
smtp_settings
=
{
address:
'smtp.gmail.com'
,
port:
587
,
domain:
'localhost:3000'
,
user_name:
Rails
.
application
.
credentials
.
dig
(
:google_smtp
,
:email
),
password:
Rails
.
application
.
credentials
.
dig
(
:google_smtp
,
:password
),
authentication:
'plain'
,
enable_starttls_auto:
true
}
# Mount Action Cable outside main process or domain.
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.url = 'wss://example.com/cable'
...
@@ -66,7 +79,7 @@ Rails.application.configure do
...
@@ -66,7 +79,7 @@ Rails.application.configure do
# Ignore bad email addresses and do not raise email delivery errors.
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
#
config.action_mailer.raise_delivery_errors = false
config
.
action_mailer
.
raise_delivery_errors
=
false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
# the I18n.default_locale when a translation cannot be found).
...
...
config/schedule.rb
View file @
f17e21bc
every
1
.
day
,
at:
'08:00 am'
do
#
every 1.day, at: '08:00 am' do
rake
'crawler:all'
#
rake 'crawler:all'
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