Commit 31dc1250 by Xuan Trung Le

fix conflict

parent 10e57825
......@@ -21,6 +21,7 @@ gem 'devise'
gem 'carrierwave'
gem 'kaminari'
gem "settingslogic"
gem 'sidekiq'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
......@@ -30,10 +31,8 @@ end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
......
......@@ -48,6 +48,7 @@ GEM
activesupport (>= 4.0.0)
mime-types (>= 1.16)
concurrent-ruby (1.0.5)
connection_pool (2.2.1)
crass (1.0.2)
devise (4.3.0)
bcrypt (~> 3.0)
......@@ -75,10 +76,6 @@ GEM
activerecord
kaminari-core (= 1.0.1)
kaminari-core (1.0.1)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.1.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
......@@ -97,6 +94,8 @@ GEM
orm_adapter (0.5.0)
puma (3.10.0)
rack (2.0.3)
rack-protection (2.0.0)
rack
rack-test (0.7.0)
rack (>= 1.0, < 3)
rails (5.1.4)
......@@ -126,10 +125,10 @@ GEM
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
redis (4.0.1)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
ruby_dep (1.5.0)
sass (3.5.1)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
......@@ -142,11 +141,13 @@ GEM
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
settingslogic (2.0.9)
sidekiq (5.0.5)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0)
redis (>= 3.3.4, < 5)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
......@@ -181,14 +182,13 @@ DEPENDENCIES
devise
figaro
kaminari
listen (>= 3.0.5, < 3.2)
mysql2 (>= 0.3.18, < 0.5)
puma (~> 3.7)
rails (~> 5.1.4)
sass-rails (~> 5.0)
settingslogic
sidekiq
spring
spring-watcher-listen (~> 2.0.0)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
......
......@@ -16,5 +16,5 @@
//= require javascripts/bootstrap.min.js
$(document).ready(function(){
$('#message').delay(5000).fadeOut('slow');
$('.message').delay(5000).fadeOut('slow');
});
......@@ -15,7 +15,6 @@ body{
background-color: #f5f5f5;
}
.border_rd0{
border-radius: 0px!important;
}
......@@ -83,3 +82,8 @@ body{
max-height: 89px;
}
// end
// Message
.message{
position: fixed; right: 0
}
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :clear_session_candidate
def clear_session_candidate
session[:candidate] = {}
end
end
class AppliesController < ApplicationController
before_action :authenticate_user!
def apply
session[:job_id] = params[:job_id] if params[:job_id]
if session[:candidate].present?
@application = ApplyJob.new(session[:candidate])
else
@application = ApplyJob.new(name: current_user.name,
email: current_user.email,
cv: current_user.cv)
end
end
def confirm
@application = ApplyJob.new(application_params)
@application.user = current_user
@application.job_id = session[:job_id]
session[:candidate] = {name: application_params[:name],
email: application_params[:email],
cv: application_params[:cv]}
unless @application.valid?
flash[:error] = @application.errors.full_messages.to_sentence
redirect_to apply_path(job_id: session[:job_id])
return
end
end
def done
@application = ApplyJob.new(user: current_user,
job_id: session[:job_id])
@application.attributes = session[:candidate]
if @application.save
flash[:notice] = 'Congratulation! Job was successfully applied'
ApplyJobMailer.successful_email(@application).deliver_later
clear_session_candidate
end
end
private
def application_params
params.require(:apply_job).permit(:name, :email, :cv)
end
end
......@@ -7,6 +7,7 @@ class JobsController < ApplicationController
end
def show
clear_session_candidate
end
def city
......
class ApplyJobMailer < ApplicationMailer
default from: 'notify@venjob.com'
def successful_email(application)
@application = application
mail(to: @application.email, subject: 'Thank you for apply with VeNJOB')
end
end
class ApplyJob < ApplicationRecord
belongs_to :job
belongs_to :user
validates :cv, presence: true
validates :email, presence: true
validates :name, presence: true
end
<div class="row">
<div class="container">
<div class="col-sm-offset-2 col-md-10 step">
Apply New > Apply Confirmation > Apply Finish
<p class="text-info">1. Apply form</p>
</div>
<div class="form-horizontal">
<%= form_for @application, url: confirm_applies_path do |f| %>
<div class="form-group">
<%= f.label :Email, 'Email:', class: "control-label col-md-2" %>
<div class="col-sm-10">
<%= f.email_field :email, autofocus: true, class: "form-control" %>
</div>
</div>
<div class="form-group">
<%= f.label :name, 'Name:', class: "control-label col-md-2" %>
<div class="col-sm-10">
<%= f.text_field :name, class: "form-control" %>
</div>
</div>
<div class="form-group">
<%= f.label :cv, 'Cv:',class: "control-label col-md-2" %>
<div class="col-sm-10">
<%= f.text_field :cv, class: "form-control" %>
</div>
</div>
<div class="actions form-group">
<div class="col-sm-offset-2 col-sm-10">
<%= f.submit "Confirm", class: "btn btn-danger form-control" %>
</div>
</div>
<% end %>
</div>
</div>
</div>
<div class="row">
<div class="container">
<div class="col-md-offset-2 col-md-10 step">
Apply New > Apply Confirmation > Apply Finish
<p class="text-info">2. Confirmation</p>
</div>
<div class="col-md-offset-2 col-md-10">
<p>Fullname: <%= @application.name %></p>
<p>Email: <%= @application.email %></p>
<p>Cv: <%= @application.cv %></p>
<div class="col-md-10">
<%= button_to "Edit",
apply_applies_path(job_id: session[:job_id]),
class: "btn btn-primary col-md-4",
method: :get %>
<%= button_to "Done",
done_applies_path,
class: "btn btn-primary col-md-offset-1 col-md-4" %>
</div>
</div>
</div>
</div>
<div class="row">
<div class="container">
Apply New > Apply Confirmation > Apply Finish
<p><h3 class="text-info">Thank you for applying</h3></p>
<p><h4 class="text-info"><%= link_to "Back to TOP page", root_path %></h4></p>
</div>
</div>
</div>
<p><h3>Dear: <%= @application.name %></h3></p>
<p>Thank you for applied with VenJOB.
Your applied job's information is as follow:
</p>
<div class="job-information">
<p>
<span>Job title: </span>
<span><%= @application.job.name %></span>
</p>
<p>
<span>Location: </span>
<span><%= @application.job.company.location %></span>
</p>
<p>
<span>Company: </span>
<span><%= @application.job.company.name %></span>
</p>
</div>
<div class="your-information">
<p>Your submitted information:</p>
<p>
<span>Full Name: </span>
<span> <%= @application.name %></span>
</p>
<p>
<span>Email: </span>
<span> <%= @application.email %></span>
</p>
<p>
<span>CV Link: </span>
<span> <%= @application.cv %></span>
</p>
</div>
<p>Best,</p>
<%= render "layouts/key_visual" %>
<div class="container">
<div class="row">
<div class="container">
<div class="top-page">
<!-- Search -->
<div class="panel border_bot clearfix">
......@@ -18,4 +19,5 @@
<%= link_to "All Industries", industries_path, class: "btn btn-default navbar-right" %>
</div>
</div>
</div>
</div>
......@@ -33,11 +33,11 @@
</p>
</div>
<div class="col-md-3">
<%= link_to "Apply", "#", class: "btn btn-primary btn-lg" %>
<%= link_to "Apply", apply_applies_path(job_id: @job.id), class: "btn btn-primary btn-lg" %>
</div>
<div class="action">
<div class="col-md-6">
<%= link_to "Apply", "#", class: "btn btn-default btn-lg" %>
<%= link_to "Apply", apply_applies_path(job_id: @job.id), class: "btn btn-default btn-lg" %>
</div>
<div class="col-md-6">
<%= link_to "Favorite", "#", class: "btn btn-default btn-lg" %>
......
<% flash.each do |name, msg| %>
<div class="alert alert-info alert-dismissable fade in" style="position: fixed; right: 0" id="message">
<div class="alert alert-info alert-dismissable fade in message">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong><%= "#{name}!" %></strong> <%= msg %>
</div>
......
......@@ -50,7 +50,7 @@ Rails.application.configure do
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_mailer.default_url_options = { :protocol => 'http', :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: 'localhost',
......
Rails.application.routes.draw do
require 'sidekiq/web'
root 'jobs#index'
devise_for :users, :controllers => {:registrations => "registrations"}
as :user do
......@@ -15,4 +16,11 @@ Rails.application.routes.draw do
get 'company/:company_id' => "jobs#company", as: :company
end
end
resources :applies do
collection do
get :apply
post :confirm
post :done
end
end
end
class AddNameAndEmailToApplyJobs < ActiveRecord::Migration[5.1]
def change
add_column :apply_jobs, :name, :string, null: false
add_column :apply_jobs, :email, :string, null: false
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20171016091830) do
ActiveRecord::Schema.define(version: 20171018012604) do
create_table "apply_jobs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.bigint "job_id"
......@@ -18,6 +18,8 @@ ActiveRecord::Schema.define(version: 20171016091830) do
t.string "cv"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name", null: false
t.string "email", null: false
t.index ["job_id"], name: "index_apply_jobs_on_job_id"
t.index ["user_id"], name: "index_apply_jobs_on_user_id"
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