Commit 423eef1a by Ngô Trung Hưng

create func apply job

parent e31804c7
Pipeline #905 failed with stages
in 0 seconds
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
...@@ -34,5 +34,8 @@ $(document).on("turbolinks:load", function(){ ...@@ -34,5 +34,8 @@ $(document).on("turbolinks:load", function(){
console.log('bam') console.log('bam')
body.stop().animate({ scrollTop: $('.title_list_city_qt').offset().top}, 700, 'swing'); body.stop().animate({ scrollTop: $('.title_list_city_qt').offset().top}, 700, 'swing');
}); });
// change lable
$("input[type=file]").on('change',function(){
document.getElementById ("label_name_file").innerHTML = this.files[0].name;
});
}); });
// Place all the styles related to the apply_job controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// Place all the styles related to the apply_job controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.box_job_apply {
font-family: 'Raleway', sans-serif;
padding: 20px;
border-radius: 4px;
width: 100%;
height: auto;
background-color: #fff;
box-shadow: 0px 0px 5px 1px rgba($color: #999, $alpha: 0.5);
margin-top: 30px;
}
.span_first {
color: rgb(221, 82, 82);
font-weight: 600;
}
.span_second {
color: #172642;
font-weight: 700;
}
.ribbon_item {
position: relative;
text-align: center;
height: 40px;
line-height: 40px;
font-size: 18px;
color: #666;
z-index: 100;
margin-bottom: 5px;
}
.ribbon_item.active {
background-color: #3d82be;
color: #fff;
&::before {
content: '';
z-index: 101;
position: absolute;
right: 0;
box-sizing: border-box;
width: 40px;
height: 40px;
border-top: 20px solid white;
border-bottom: 20px solid white;
border-left: 25px solid #3d82be;
}
&::after {
content: '';
z-index: 101;
position: absolute;
left: 0;
box-sizing: border-box;
width: 40px;
height: 40px;
border-top: 20px solid #3d82be;
border-bottom: 20px solid #3d82be;
border-left: 25px solid #fff;
}
}
.custom_badges {
font-size: 20px !important;
background-color: #000;
color: #fff;
font-weight: 600;
padding: 0px 8px 2px;
border-radius: 20%;
}
.custom_badges.active {
background-color: white;
color: #666;
padding: 0px 8px !important;
}
@media only screen and (max-width: 992px) {
}
\ No newline at end of file
...@@ -1417,6 +1417,14 @@ $main-color: #23303D; ...@@ -1417,6 +1417,14 @@ $main-color: #23303D;
.pppp { .pppp {
width: 100% !important; width: 100% !important;
} }
.pppp.hidden {
display: none;
}
.lable_custom {
cursor: pointer;
font-size: 20px;
color: green;
}
.list_email_app { .list_email_app {
ul { ul {
......
# frozen_string_literal: true
class ApplyJobController < ApplicationController
before_action :authenticate_user!, only: :apply
def apply
@data_apply = AppliedJob.new
session[:job_id] = params[:job_id]
end
def confirmation
@data_apply = AppliedJob.new(applied_job_params)
if @data_apply.save
session[:user_name] = @data_apply.name
session[:user_email] = @data_apply.email
redirect_to show_path
else
flash[:error] = 'error'
render 'apply'
end
end
def show
end
def save
@data_apply.save
end
private
def applied_job_params
params.require(:applied_job).permit(:user_id, :job_id, :name, :email, :cv)
end
end
class ApplyJobDecorator < Draper::Decorator
delegate_all
# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end
end
module ApplyJobHelper
end
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Description/Explanation of Person class # Description/Explanation of Person class
class AppliedJob < ApplicationRecord class AppliedJob < ApplicationRecord
mount_uploader :cv, CvUploader
validates_integrity_of :cv
belongs_to :user belongs_to :user
belongs_to :job belongs_to :job
end end
<%= form_with(model: data_apply, url: confirm_path) do |f| %>
<br>
<div class="container">
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-2">
<%= f.label :name, t('pages.mypage.name') %>
</div>
<div class="col-lg-6">
<%= f.text_field(:name, class:'form-control') %>
<%= f.hidden_field(:job_id, value: session[:job_id]) %>
</div>
</div><br>
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-2">
<%= f.label :email%>
</div>
<div class="col-lg-6">
<%= f.text_field(:email, class:'form-control') %>
</div>
</div><br>
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-2">
<span><%= t('pages.mypage.cv') %></span>
</div>
<div class="col-lg-5 col-md-12">
<%= f.label :cv, current_user.cv.identifier ? 'current_user.cv.identifier' : t('pages.mypage.nofile'), id: 'label_name_file' %>
<%= f.file_field :cv, class: 'pppp hidden' %>
</div>
<div class="col-lg-1">
<%= f.label :cv, '<i class="fas fa-cloud-upload-alt"></i>'.html_safe, title: 'upload', class: 'lable_custom' %>
</div>
</div><br>
<div class="row">
<div class="col-lg-6"></div>
<div class="col-lg-4">
<%= f.submit t('pages.apply.btn_text_confirm'), class:'btn btn-success btn-info-custom' %>
</div>
</div>
</div>
<% end %>
<hr>
\ No newline at end of file
<div class="ribbon">
<div class="row">
<div class="col-lg-4 col-md-12">
<div class="ribbon_item active">
<span class="custom_badges active">1</span> <%= t('pages.apply.ribon_1') %>
</div>
</div>
<div class="col-lg-4 col-md-12">
<div class="ribbon_item">
<span class="custom_badges">2</span> <%= t('pages.apply.ribon_2') %>
</div>
</div>
<div class="col-lg-4 col-md-12">
<div class="ribbon_item">
<span class="custom_badges">3</span> <%= t('pages.apply.ribon_3') %>
</div>
</div>
</div>
<hr>
</div>
\ No newline at end of file
<div class="container">
<div class="box_job_apply">
<%= render 'ribbon' %>
<div class="form_apply_job">
<span class="span_second"><%= t('pages.apply.title_input_1') %></span>
<br><br>
<span><%= t('pages.apply.title_input_2') %></span>
<%= render 'form', data_apply: @data_apply %>
</div>
</div>
</div>
\ No newline at end of file
<div class="container">
<div class="box_job_apply">
<div class="ribbon">
<div class="row">
<div class="col-lg-4 col-md-4">
<div class="ribbon_item active">
<span class="custom_badges active">1</span> Nhập thông tin
</div>
</div>
<div class="col-lg-4 col-md-4">
<div class="ribbon_item active">
<span class="custom_badges active">2</span> Xác nhận thông tin
</div>
</div>
<div class="col-lg-4 col-md-4">
<div class="ribbon_item">
<span class="custom_badges">3</span> Hoàn thành
</div>
</div>
</div>
<hr>
</div>
<div class="form_apply_job">
<span class="span_second">Vui lòng xác nhận lại thông tin của bạn</span>
<br><br>
<div class="container">
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-2">
Họ và tên:
</div>
<div class="col-lg-6">
<%= session[:user_name] %>
</div>
</div><br>
<div class="row">
<div class="col-lg-2"></div>
<div class="col-lg-2">
Email:
</div>
<div class="col-lg-6">
<%= session[:user_email] %>
</div>
</div>
</div>
<%= link_to 'save', save_path %>
<%= link_to 'back', edit_path(job_id: session[:job_id]) %>
</div>
</div>
</div>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</div> </div>
<div class="col-lg-3"> <div class="col-lg-3">
<div class="btn_apply_job"> <div class="btn_apply_job">
<%= link_to t('pages.detail.btr_text_submit_cv'), '#', class: 'btn btn-apply_job' %> <%= link_to t('pages.detail.btr_text_submit_cv'), apply_path(job_id: @job.id), class: 'btn btn-apply_job' %>
</div> </div>
</div> </div>
<div class="col-lg-12 col-md-12"> <div class="col-lg-12 col-md-12">
......
...@@ -44,6 +44,13 @@ en: ...@@ -44,6 +44,13 @@ en:
domestic: 'Viet Nam' domestic: 'Viet Nam'
international: 'International' international: 'International'
provinces_vn: 'Provinces and cities of Vietnam' provinces_vn: 'Provinces and cities of Vietnam'
apply:
ribon_1: 'Enter your information'
ribon_2: 'Confirmation'
ribon_3: 'Done'
title_input_1: 'Fill in your contact information and choose a profile to apply for:'
title_input_2: 'Your contact information:'
btn_text_confirm: 'Confirm'
mypage: mypage:
title: 'My page' title: 'My page'
email: 'Email' email: 'Email'
......
...@@ -44,6 +44,13 @@ vi: ...@@ -44,6 +44,13 @@ vi:
domestic: 'Việt Nam' domestic: 'Việt Nam'
international: 'Nước ngoài' international: 'Nước ngoài'
provinces_vn: 'Các tỉnh, thành phố thuôc Việt Nam' provinces_vn: 'Các tỉnh, thành phố thuôc Việt Nam'
apply:
ribon_1: 'Nhập thông tin'
ribon_2: 'Xác nhận thông tin'
ribon_3: 'Hoàn thành'
title_input_1: 'Điền thông tin liên hệ của bạn chọn hồ để ứng tuyển:'
title_input_2: 'Thông tin liên hệ của bạn:'
btn_text_confirm: 'Xác nhận'
mypage: mypage:
title: 'Trang nhân' title: 'Trang nhân'
email: 'Email' email: 'Email'
......
...@@ -9,6 +9,9 @@ Rails.application.routes.draw do ...@@ -9,6 +9,9 @@ Rails.application.routes.draw do
get 'register/:code', to: 'users#confirm_sign_up', as: :confirm_sign_up get 'register/:code', to: 'users#confirm_sign_up', as: :confirm_sign_up
get 'industries', to: 'industry#index', as: :industry_index get 'industries', to: 'industry#index', as: :industry_index
get 'cities', to: 'city#index', as: :city_index get 'cities', to: 'city#index', as: :city_index
get 'apply', to: 'apply_job#apply', as: :apply
post 'confrim', to: 'apply_job#confirmation', as: :confirm
get 'confrim', to: 'apply_job#show', as: :show
# Details job # Details job
get 'detail/:id', to: 'job#detail', as: :detail_job get 'detail/:id', to: 'job#detail', as: :detail_job
# Search # Search
......
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