fix apply/confirm/done page

parent 33f82662
Pipeline #1388 failed with stages
in 0 seconds
......@@ -63,3 +63,68 @@
justify-content: center;
}
.ribbon {
width: 100%;
}
.progressbar {
counter-reset: step;
}
.progressbar li {
list-style-type:none;
float: left;
width: 33.33%;
position: relative;
text-align: center;
}
.progressbar li:before {
content : counter(step);
counter-increment: step;
width: 40px;
height: 40px;
line-height: 40px;
border: 1px solid #ddd;
display: block;
text-align: center;
margin: 0 auto 10px auto;
border-radius: 50%;
background-color: #fff;
}
.progressbar li:after {
content : '';
position:absolute;
width: 100%;
height: 1px;
line-height: 40px;
background-color: #ddd;
top: 15px;
left: -50%;
z-index: -1;
}
.progressbar li:first-child:after {
content: none;
}
.progressbar li.active {
color: blue;
}
.progressbar li.active:before {
border-color: blue;
}
.progressbar li.active + li:after {
background-color: blue;
}
.btn-space {
margin-right: 10px;
}
footer {
min-height: calc(100vh - 327px);
}
\ No newline at end of file
......@@ -14,7 +14,8 @@ class ApplyJobsController < ApplicationController
@apply_job.user_id = User.find_by(id: 1).id
@apply_job.job_id = apply_params[:job_id]
if @apply_job.save!
flash.now[:success] = 'Done hehe!'
ApplyJobMailer.with(apply_job: @apply_job).create_apply.deliver_now
flash.now[:success] = "You have applied successfully"
else
redirect_to root_url
end
......@@ -23,6 +24,6 @@ class ApplyJobsController < ApplicationController
private
def apply_params
params.require(:apply_job).permit(:name, :email, :cv)
params.require(:apply_job).permit(:name, :email, :cv, :job_id)
end
end
class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
default from: 'nhmphuong1005@gmail.com'
layout 'mailer'
end
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
@apply_job = params[:apply_job]
#@name = params[:name]
# @email = params[:email]
# @cv = params[:email]
mail to: @apply_job.email, subject: 'CONFIRM INFORMATION'
end
# def create_apply
# @greeting = "Hi"
# mail to: "to@example.org"
# end
end
......@@ -2,8 +2,8 @@ class ApplyJob < ApplicationRecord
belongs_to :user
belongs_to :job
has_one_attached :cv
validates :name, presence: true #size: { less_than_or_equal_to: 400.bytes, message: 'is not given between size' }
validates :email, presence: true
validates :cv, attached: true #, content_type: { in: 'application/pdf', message: 'must be a valid cv format' }
#content_type: { in: %w[application/msword application/pdf]
validates :name, presence: true, length: { maximum: 200 }
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 :cv, attached: true, content_type: { in: 'application/pdf', message: 'must be a valid cv format' }
end
p
| Dear
= @apply_job.name
| ,
p
| Thank you for applied with VenJOB. Your applied job's information is as follow:
/ Job title: <Job title>
/ Location: <Job location>
/ Company: <Company>
p
| Your submitted information:
p
| Full Name:
= @apply_job.name
p
| Email:
= @apply_job.email
p
| CV Link:
= url_for(@apply_job.cv)
p
| Best,
\ No newline at end of file
| Dear
= @apply_job.name
| ,
| Thank you for applied with VenJOB. Your applied job's information is as follow:
| Your submitted information:
| Full Name:
= @apply_job.name
| Email:
= @apply_job.email
| CV Link:
= @apply_job.cv
| Best,
\ No newline at end of file
ul#ex1.p-4.nav.nav-tabs.nav-fill.mb-3[role="tablist"]
li.nav-item[role="presentation"]
a#ex2-tab-1.nav-link.active[data-mdb-toggle="tab" href="#ex2-tabs-1" role="tab" aria-controls="ex2-tabs-1" aria-selected="true"]
| New apply
li.nav-item[role="presentation"]
a#ex2-tab-2.nav-link[data-mdb-toggle="tab" href="#ex2-tabs-2" role="tab" aria-controls="ex2-tabs-2" aria-selected="false"]
| Confirm
li.nav-item[role="presentation"]
a#ex2-tab-3.nav-link[data-mdb-toggle="tab" href="#ex2-tabs-3" role="tab" aria-controls="ex2-tabs-3" aria-selected="false"]
| Done
/ #ex2-content.tab-content
/ #ex2-tabs-1.tab-pane.fade.show.active[role="tabpanel" aria-labelledby="ex2-tab-1"]
/ | Tab 1 content
/ #ex2-tabs-2.tab-pane.fade[role="tabpanel" aria-labelledby="ex2-tab-2"]
/ | Tab 2 content
/ #ex2-tabs-3.tab-pane.fade[role="tabpanel" aria-labelledby="ex2-tab-3"]
/ | Tab 3 content
\ No newline at end of file
.ribbon
ul.progressbar
li.active
.span.indicator
.span.title Apply
li
.span.indicator.2
.span.title Confirm
li
.span.indicator.3
.span.title Done
\ No newline at end of file
.ribbon
ul.progressbar
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
.col-md-6.offset-md-3
= form_with(model: @apply_job, url: '/done', local: true) do |f|
= f.hidden_field :job_id, @apply.job_id
= f.hidden_field :job_id
= f.label :name
= f.text_field :name, required: true, disabled: true, placeholder: "Type name...", class: 'form-control'
= f.hidden_field :name, required: true
= f.text_field :name, required: true, disabled: true,length: { maximum: 200 }, placeholder: "Type name...", class: 'form-control'
= f.hidden_field :name, required: true, length: { maximum: 50 }
= f.label :email
= f.text_field :email, required: true, disabled: true, placeholder: "Type email...", class: 'form-control'
= f.hidden_field :email, required: true
p
= f.text_field :email, required: true, disabled: true,length: { maximum: 255 }, format: { with: ApplyJob::VALID_EMAIL_REGEX}, placeholder: "Type email...", class: 'form-control'
= f.hidden_field :email, required: true, length: { maximum: 255 }, format: { with: ApplyJob::VALID_EMAIL_REGEX}
p.my-1
= f.label :cv, "CV"
p
= f.file_field :cv, required: true, accept: "application/pdf"
.span.p-4.text-center
= f.submit "Done", class: "btn btn-primary btn-lg"
\ No newline at end of file
= link_to "Back", apply_path, class: "btn btn-primary btn-lg btn-space"
= f.submit "Done", class: "btn btn-primary btn-lg btn-space"
\ No newline at end of file
h3
| Doneeeee
\ No newline at end of file
.ribbon.py-4
ul.progressbar
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
| Thank you for apply
\ No newline at end of file
= render 'ribbon'
.ribbon
ul.progressbar
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
.col-md-6.offset-md-3
= form_with(model: @apply_job, url: '/confirm', local: true) do |f|
= f.hidden_field :job_id, @apply.job_id
= f.label :name
= f.text_field :name, required: true, placeholder: "Type name...", class: 'form-control'
= f.hidden_field :job_id
= f.text_field :name, required: true,length: { maximum: 200 }, placeholder: "Type name...", class: 'form-control'
= f.label :email
= f.text_field :email, required: true, placeholder: "Type email...", class: 'form-control'
p
= f.text_field :email, required: true, length: { maximum: 255 }, format: { with: ApplyJob::VALID_EMAIL_REGEX}, placeholder: "Type email...", class: 'form-control'
p.my-1
= f.label :cv, "CV"
= f.file_field :cv, required: true, accept: "application/pdf"
p
= f.file_field :cv, required: true, accept: "application/pdf"
.span.p-4.text-center
= f.submit "Confirm", class: "btn btn-primary btn-lg"
\ No newline at end of file
......@@ -13,5 +13,7 @@ html
body.bg-light
= render 'layouts/header'
.container
- flash.each do |key, value|
= content_tag(:div, value, class: "alert alert-#{key}")
= yield
= render 'layouts/footer'
DrY0/AhPzESn8oDFDPTUQsBNEvk49s13rSSpqNIGN57qdKMPNAsXwCKW3A/cAboje8Y5R0GxXkKFdKYWIK5ugq7ohO9d08CTuVeWhy4IATS1aJdy1GRYLg3F31k+X8Mtcf0J9mQmjBMLg9y0d69s6edaTpwtjvjkirXvbGuF2QxkWQv4vEXCqzCnQzrUbP2MIR8Oe4n0CfEZHeQVjY9tb2aFho+0hZosrSNzVVWnt4OGITjD6joHx31gJjshbWsSgumId0TkAdj2xBTUuMYwOk/21o7cBa974fzDuLuDjIZxm0joGOnsakj7j6db0xfkCG72dqXLOMIS2L6CH+skSHGMqWQEORMVm6qJsa9JyqYofIaFz4rCVqdrfG7p9GGBQHmxb4xuMFklfGLq3D9U9CMsY1/DRt7+JGky--sjw58TA1XGrY/KWE--lvwZbxtAhxp+E6KZw+vMjQ==
\ No newline at end of file
LLXrsXgHj/eT4V86Yfq8vQXrQyf43GztPjNh2aNz2zWvALbtyk8p3TgWkoLHMa2Dza7h4LGEeju/9euFKpMOMjS3SjdTOrc2b45sKZzqjfNdc56gr0NxEjuptwzAcvPc+97lWKEncqq/mEdLlAJXgMGy99gr8hVwq5U+tPIg/Y3ftgic2bVrOPxey3uEQuOlsDVwdvRq71bTJyxPAtE/MEaXv11ni9aLkwjtTQNkhTP/6UDm2ReSsvFDNcecl/dMf7VikTDOq0I5hf/8JpmYyBsQnZwPHQxhYd9uq1TBTB/Ssse1YUq855mLWOIxZAFY7nwrQl3gyYBzq+kE6wOaaoHGXfe173/Qrz03VImtn7fIInT9GKA6EpOzdDZReEFwhokmzWmLPBfSww13WlaHm691CJKEp2nXOCIxbW4cMNucq9NAV63gFJMSHEA7zXfG9Cz64IGlIO5QVef9CdbV0PcWFGe6XXhT1TiBOh5P9cAcG9qZ2/qfndGWDOr1HViNgvjr+1Z3NwzkaMuy--5CuvR8xpXsWADso7--xRAO8W3HzhLCwCOYcvpx8g==
\ No newline at end of file
......@@ -33,8 +33,19 @@ Rails.application.configure do
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
config.action_mailer.perform_deliveries = true
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
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 }
config.action_mailer.perform_caching = false
......
class RemoveCvFromApplyJobs < ActiveRecord::Migration[6.1]
def change
remove_column :apply_jobs, :cv, :binary
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_08_09_023303) do
ActiveRecord::Schema.define(version: 2021_08_09_075523) do
create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name", null: false
......@@ -43,7 +43,6 @@ ActiveRecord::Schema.define(version: 2021_08_09_023303) do
create_table "apply_jobs", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "job_id", null: false
t.binary "cv"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.string "name"
......
require "test_helper"
class ApplyJobMailerTest < ActionMailer::TestCase
test "create_apply" do
mail = ApplyJobMailer.create_apply
assert_equal "Create apply", mail.subject
assert_equal ["to@example.org"], mail.to
assert_equal ["from@example.com"], mail.from
assert_match "Hi", mail.body.encoded
end
end
# Preview all emails at http://localhost:3000/rails/mailers/apply_job_mailer
class ApplyJobMailerPreview < ActionMailer::Preview
# Preview this email at http://localhost:3000/rails/mailers/apply_job_mailer/create_apply
def create_apply
ApplyJobMailer.create_apply
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment