Commit 41dfcb2e by Mai Hoang Thai Ha

fixed review part 2

parent a31c35be
...@@ -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: 12px; padding: 8px;
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: 23px solid transparent; border-top: 21px solid transparent;
border-bottom: 23px solid transparent; border-bottom: 21px solid transparent;
border-left: 23px solid #f3f5fa; border-left: 21px solid #f3f5fa;
position: absolute; position: absolute;
right: -23px; right: -21px;
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: 23px solid transparent; border-top: 21px solid transparent;
border-bottom: 23px solid transparent; border-bottom: 21px solid transparent;
border-left: 23px solid #fff; border-left: 21px 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
...@@ -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.invalid?
end end
def create def create
......
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
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,
......
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
- 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'
- 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'
...@@ -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,
...@@ -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
......
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