Commit e3e7ec18 by Ngô Trung Hưng

ID5_JobApply

parent fdadf9b7
Pipeline #861 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/
// 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;
}
.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;
}
\ No newline at end of file
# frozen_string_literal: true
# Apply Job
class ApplyJobController < ApplicationController
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
......@@ -4,4 +4,5 @@
class AppliedJob < ApplicationRecord
belongs_to :user
belongs_to :job
validates :name, presence: true
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 :'Họ và tên:'%>
</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>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
\ No newline at end of file
<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">
<span class="custom_badges">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>
\ 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">Điền thông tin liên hệ của bạn và chọn hồ sơ để ứng tuyển:</span>
<br><br>
<span>Thông tin liên hệ của bạn</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 @@
</div>
<div class="col-lg-3">
<div class="btn_apply_job">
<%= link_to 'Nộp CV ngay', '#', class: 'btn btn-apply_job' %>
<%= link_to 'Nộp CV ngay', apply_path(job_id: @job.id), class: 'btn btn-apply_job' %>
</div>
</div>
<div class="col-lg-12 col-md-12">
......@@ -80,7 +80,7 @@
<div class="row">
<div class="col-lg-6 col-md-6">
<div class="btn_apply_job">
<%= link_to 'Nộp CV ngay', '#', class: 'btn btn-apply_job' %>
<%= link_to 'Nộp CV ngay', apply_path(job_id: @job.id), class: 'btn btn-apply_job' %>
</div>
</div>
<div class="col-lg-6 col-md-6">
......
......@@ -10,7 +10,7 @@ Rails.application.configure do
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = false
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
......
......@@ -8,7 +8,10 @@ Rails.application.routes.draw do
get 'detail/:id', to: 'job#detail', as: :detail_job
# Search
get 'jobs/:model/:slug', to: 'job#index', as: :jobs
# Apply
get 'apply', to: 'apply_job#apply', as: :apply
post 'confrim', to: 'apply_job#confirmation', as: :confirm
get 'confrim', to: 'apply_job#show', as: :show
# Rails error
match '/404', to: 'error#page_not_found', via: :all
match '/500', to: 'error#internal_server_error', via: :all
......
require 'test_helper'
class ApplyJobControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class ApplyJobDecoratorTest < Draper::TestCase
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