creating job_apply

parent d84887e5
Pipeline #986 failed with stages
in 0 seconds
// Place all the styles related to the Jobs 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]
def new
end
def create
binding.pry
@user = JobApplied.new(apply_params)
if @user.save
@user.update_attribute(:user_id, current_user.id)
cv_user = params[:job_applied][:cv_user]
@user.update_attribute(:cv_user, cv_user)
end
end
def confirmation
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, :job_id)
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, format: { with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
end end
<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">
<%= render 'shared/error_messages' %>
<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">
<%# binding.pry %>
<%= form_for(current_user) do |f| %>
<div class="email-field">
<div class="col-4-sm">
<%= f.label :email %>
</div>
<div class="col-8-sm">
<%= f.label "#{current_user.email}", class: 'input-email' %>
</div>
</div>
<div class="name-field">
<div class="col-4-sm">
<%= f.label :name, 'Full Name' %>
</div>
<div class="col-8-sm">
<%= f.label :name, class: 'input-name' %>
</div>
</div>
<div class="cv-field">
<div class="col-4-sm">
<%= f.label :cv_user, 'CV Upload' %>
</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 %>
<% else %>
<div class="cv-none">
CV hasn't found in your Profile. Upload now!
</div>
<% end %>
</div>
</div>
<%= link_to 'Edit', '#', 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">
<%= render 'shared/update_error_messages' %>
<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>
<div class="form-login">
<div class="row form d-flex justify-content-center">
<%= form_for(:job_applied, url: create_application_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 %>
<% 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>
......
...@@ -15,7 +15,12 @@ Rails.application.routes.draw do ...@@ -15,7 +15,12 @@ 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
get 'apply', to: 'job_applieds#new', as: :apply_job
post 'create', to: 'job_applieds#create', as: :create_application
get 'confirm', to: 'job_applieds#confirmation', as: :confirm_job
resources :job_applieds
resources :top_pages resources :top_pages
resources :industries resources :industries
resources :cities resources :cities
......
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