Created ID5-6-7

parent 3154a8eb
Pipeline #1017 failed with stages
in 0 seconds
// Place all the styles related to the Top_pages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.ribbon-mark {
margin: 40px;
position: relative;
}
.arrow-new.active {
width: 250px;
height: 50px;
background: #66c2ff;
position: relative;
&:after {
content: '';
position: absolute;
left: 0; bottom: 0; width: 0; height: 0;
border-left: 25px solid white;
border-top: 25px solid transparent;
border-bottom: 25px solid transparent;
}
&:before {
content: '';
position: absolute;
right: -25px;
bottom: 0;
width: 0;
height: 0;
border-left: 25px solid #66c2ff;
border-top: 25px solid transparent;
border-bottom: 25px solid transparent;
}
.text-ribbon {
position: absolute;
top: 25%;
right: 55%;
}
.number-circle {
color: #66c2ff;
text-align: center;
background: white;
width: 20px;
height: 20px;
border-radius: 50%;
}
.text-near-circle {
font-size: 20px;
color: white;
position: absolute;
top: -25%;
left: 20px;
}
}
.arrow-confirm.active, .arrow-finish.active {
width: 250px;
height: 50px;
background: #66c2ff;
position: relative;
&:after {
content: '';
position: absolute;
left: 0; bottom: 0; width: 0; height: 0;
border-left: 25px solid #66c2ff;
border-top: 25px solid transparent;
border-bottom: 25px solid transparent;
}
&:before {
content: '';
position: absolute;
right: -25px;
bottom: 0;
width: 0;
height: 0;
border-left: 25px solid #66c2ff;
border-top: 25px solid transparent;
border-bottom: 25px solid transparent;
}
.text-ribbon {
position: absolute;
top: 25%;
right: 55%;
}
.number-circle {
color: #66c2ff;
text-align: center;
background: white;
width: 20px;
height: 20px;
border-radius: 50%;
}
.text-near-circle {
font-size: 20px;
color: white;
position: absolute;
top: -25%;
left: 20px;
}
}
.arrow-new, .arrow-confirm, .arrow-finish {
width: 250px;
height: 50px;
color: #666666;
position: relative;
.text-ribbon {
position: absolute;
top: 25%;
right: 55%;
}
.number-circle {
text-align: center;
background: #e6e6e6;
width: 20px;
height: 20px;
border-radius: 50%;
}
.text-near-circle {
font-size: 20px;
position: absolute;
top: -25%;
left: 20px;
}
}
class JobAppliedsController < ApplicationController
before_action :sign_in_validation, only: [:new, :confirmation, :create]
before_action :find_job_id, only: [:new]
def new
end
def confirmation
@user = current_user.job_applieds.new(apply_params)
@user.cv_user = current_user.cv_user if apply_params[:cv_user].blank?
if @user.invalid?
@user.errors.full_messages.each do |message|
flash[:danger] = message
redirect_to apply_job_path(job_id: apply_params[:job_id])
end
end
end
def create
@job = Job.find_by(id: apply_params[:job_id])
@user = current_user.job_applieds.new(apply_params)
@user.cv_user.retrieve_from_cache!(apply_params[:cv_user])
if @user.save
JobAppliedMailer.apply_job(@user, @job).deliver_later
JobAppliedMailer.apply_job(ENV['GMAIL_USERNAME']).deliver_later
end
end
private
def sign_in_validation
return if signed_in?
flash[:warning] = "Please Sign In..."
redirect_to login_path
end
def apply_params
params.require(:job_applied).permit(:name, :email, :cv_user, :job_id)
end
def find_job_id
return redirect_to jobs_path unless Job.find_by(id: params[:job_id])
end
end
class JobAppliedMailer < ActionMailer::Base
def apply_job(user, job)
@job = job
@user = user
mail(to: user.email, subject: 'Thank your for apply with VeNJOB')
end
end
class JobApplied < ApplicationRecord class JobApplied < ApplicationRecord
before_save { self.email = email.downcase }
mount_uploader :cv_user, UserCvUploader
belongs_to :user belongs_to :user
belongs_to :job belongs_to :job
validates :name, presence: true, length: { maximum: 200 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(?:\.[a-z\d\-]+)*\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 200 }, format: { with: VALID_EMAIL_REGEX }
validates :cv_user, presence: true
end end
<h2>Dear <%= @user.name %></h2>
<p>Thank you for applied with VenJOB. Your applied job's information is as follow:</p>
<p><h3><%= @job.title %></h3></p>
<p><h3><%= @job.cities.map(&:name).join(' | ') %></h3></p>
<p><h3><%= @job.company.name %></h3></p>
<p>Your submitted information:</p>
<p><h3><%= @user.name %></h3></p>
<p><h3><%= @user.email %></h3></p>
<p><h3><%= link_to @user.cv_user.identifier, (root_url.chop + @user.cv_user.url) %></h3></p>
Best,
<div class="col-4 arrow-new <%= step1 %>">
<div class="text-ribbon">
<div class="row">
<strong>
<div class="number-circle">1</div>
<div class="text-near-circle">New</div>
</strong>
</div>
</div>
</div>
<div class="col-4 text-center arrow-confirm <%= step2 %>">
<div class="text-ribbon">
<div class="row">
<strong>
<div class="number-circle">2</div>
<div class="text-near-circle">Confirm</div>
</strong>
</div>
</div>
</div>
<div class="col-4 text-center arrow-finish <%= step3 %>">
<div class="text-ribbon">
<div class="row">
<strong>
<div class="number-circle">3</div>
<div class="text-near-circle">Finish</div>
</strong>
</div>
</div>
</div>
<div class="container">
<div class="row ribbon-mark">
<%= render partial: 'ribbon_step', locals: { step1: 'active', step2: 'active', step3: '' } %>
</div>
<h1 class="text-center my-page-label">Confirmation</h1>
<div class="form-login">
<div class="row form d-flex justify-content-center">
<%= form_for(@user, url: finished_apply_path) do |f| %>
<div class="email-field">
<div class="col-4-sm">
<%= f.label :email %>
</div>
<div class="col-8-sm">
<strong><%= @user.email %></strong>
<%= f.hidden_field :email, value: @user.email %>
</div>
</div>
<div class="name-field">
<div class="col-4-sm">
<%= f.label :name, 'Full Name' %>
</div>
<div class="col-8-sm">
<strong><%= @user.name %></strong>
<%= f.hidden_field :name, value: @user.name %>
</div>
</div>
<div class="cv-field">
<div class="col-4-sm">
<%= f.label :cv_user, 'CV Upload' %>
</div>
<div class="col-8-sm">
<%= link_to @user.cv_user.identifier, @user.cv_user.url, download: @user.cv_user.identifier %>
<%= f.hidden_field :cv_user, value: @user.cv_user.cache_name %>
</div>
</div>
<%= f.hidden_field :job_id, value: params[:job_applied][:job_id] %>
<%= link_to 'Edit', apply_job_path(job_id: params[:job_applied][:job_id]), class: 'btn btn-outline-primary btn-lg update-btn' %>
<%= f.submit 'Done', class: 'btn btn-outline-primary btn-lg update-btn' %>
<% end %>
</div>
</div>
</div>
<div class="container">
<div class="row ribbon-mark">
<%= render partial: 'ribbon_step', locals: { step1: 'active', step2: 'active', step3: 'active' } %>
</div>
<div class="text-center">
<h1 class="my-page-label">Thank you for apply</h1>
<p>Back to <%= link_to 'TOP', root_path %> page</p>
</div>
</div>
<div class="container">
<div class="row ribbon-mark">
<%= render partial: 'ribbon_step', locals: { step1: 'active', step2: '', step3: '' } %>
</div>
<h1 class="text-center my-page-label">Apply Form</h1>
<%= render 'layouts/flash' %>
<div class="form-login">
<div class="row form d-flex justify-content-center">
<%= form_for(:job_applied, url: confirm_job_path) do |f| %>
<div class="email-field">
<div class="col-4-sm">
<%= f.label :email %>
</div>
<div class="col-8-sm">
<%= f.text_field :email, class: 'input-email', value: current_user.email %>
</div>
</div>
<div class="name-field">
<div class="col-4-sm">
<%= f.label :name, 'Full Name' %>
</div>
<div class="col-8-sm">
<%= f.text_field :name, class: 'input-name', value: current_user.name %>
</div>
</div>
<div class="cv-field">
<div class="col-4-sm">
<%= f.label :cv_user, 'My CV' %>
</div>
<div class="col-8-sm">
<% if current_user.cv_user.present? %>
<%= link_to current_user.cv_user.identifier, current_user.cv_user.url, download: current_user.cv_user.identifier %>
<div class="cv-none">
<%= f.file_field :cv_user, accept: '.doc, .pdf, .xls, .xlsx, .zip',class: 'input-cv' %>
</div>
<% else %>
<div class="cv-none">
<%= f.file_field :cv_user, accept: '.doc, .pdf, .xls, .xlsx, .zip',class: 'input-cv' %>
</div>
<% end %>
</div>
</div>
<%= f.hidden_field :job_id, value: params[:job_id] %>
<%= f.submit 'Confirm', class: 'btn btn-outline-primary btn-lg update-btn' %>
<% end %>
</div>
</div>
</div>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<% end %>/&ensp; <% end %>/&ensp;
<%= @job.title.truncate_words(5) %> <%= @job.title.truncate_words(5) %>
</div> </div>
<%= link_to '#' do %> <%= link_to apply_job_path(job_id: @job.id) do %>
<div class="apply-job"> <div class="apply-job">
<strong>Apply Now</strong> <strong>Apply Now</strong>
</div> </div>
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
</div> </div>
<div class="row under-descrip"> <div class="row under-descrip">
<div class="col-6"> <div class="col-6">
<%= link_to '#' do %> <%= link_to apply_job_path(job_id: @job.id) do %>
<div class="btn btn-info btn-lg apply-btn"> <div class="btn btn-info btn-lg apply-btn">
<strong>Apply Now</strong> <strong>Apply Now</strong>
</div> </div>
......
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
<%= f.label :cv_user, 'My CV' %> <%= f.label :cv_user, 'My CV' %>
</div> </div>
<div class="col-8-sm"> <div class="col-8-sm">
<% if current_user.cv_user.present? %> <%= link_to_if current_user.cv_user.present? ,current_user.cv_user.identifier, current_user.cv_user.url, download: current_user.cv_user.identifier do %>
<%= link_to current_user.cv_user.identifier, current_user.cv_user.url, download: current_user.cv_user.identifier %>
<% else %>
<div class="cv-none"> <div class="cv-none">
CV hasn't found in your Profile. Upload now! CV hasn't found in your Profile. Upload now!
</div> </div>
......
...@@ -19,6 +19,10 @@ Rails.application.routes.draw do ...@@ -19,6 +19,10 @@ Rails.application.routes.draw do
get '/registation/3', to: 'users#registation', as: :registation get '/registation/3', to: 'users#registation', as: :registation
get 'apply', to: 'job_applieds#new', as: :apply_job
post 'confirm', to: 'job_applieds#confirmation', as: :confirm_job
post 'done', to: 'job_applieds#create', as: :finished_apply
resources :jobs resources :jobs
get 'detail/:id', to: 'jobs#show', as: :job_detail get 'detail/:id', to: 'jobs#show', as: :job_detail
...@@ -27,6 +31,7 @@ Rails.application.routes.draw do ...@@ -27,6 +31,7 @@ Rails.application.routes.draw do
get 'jobs/industry/:converted_name', to: 'jobs#industry_jobs', as: :industry_jobs get 'jobs/industry/:converted_name', to: 'jobs#industry_jobs', as: :industry_jobs
get 'jobs/company/:converted_name', to: 'jobs#company_jobs', as: :company_jobs get 'jobs/company/:converted_name', to: 'jobs#company_jobs', as: :company_jobs
resources :job_applieds,only: [:new, :create]
resources :reset_passwords, only: [:edit, :update] resources :reset_passwords, only: [:edit, :update]
resources :confirmations, only: [:new] resources :confirmations, only: [:new]
resources :top_pages, only: [:index] resources :top_pages, only: [:index]
......
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