Commit b94adaf7 by Ba Toi Dang

Merge branch 'features/create_my_page' into 'master'

create my page

See merge request !7
parents 8d0f1d38 75d6f614
...@@ -20,3 +20,6 @@ ...@@ -20,3 +20,6 @@
# Ignore application configuration # Ignore application configuration
/config/application.yml /config/application.yml
# Ignore public
/public
...@@ -82,12 +82,13 @@ GEM ...@@ -82,12 +82,13 @@ GEM
loofah (2.1.1) loofah (2.1.1)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.6) mail (2.7.0)
mime-types (>= 1.16, < 4) mini_mime (>= 0.1.1)
method_source (0.9.0) method_source (0.9.0)
mime-types (3.1) mime-types (3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521) mime-types-data (3.2016.0521)
mini_mime (0.1.4)
mini_portile2 (2.3.0) mini_portile2 (2.3.0)
minitest (5.10.3) minitest (5.10.3)
multipart-post (2.0.0) multipart-post (2.0.0)
......
...@@ -17,4 +17,8 @@ ...@@ -17,4 +17,8 @@
$(document).ready(function(){ $(document).ready(function(){
$('.message').delay(5000).fadeOut('slow'); $('.message').delay(5000).fadeOut('slow');
$(document).on('change', 'input[name=job_id]', function(event) {
event.preventDefault();
$('#apply').removeAttr('disabled')
});
}); });
...@@ -37,6 +37,10 @@ body{ ...@@ -37,6 +37,10 @@ body{
width: 80% !important; width: 80% !important;
} }
.mrTop5{
margin-top: 5px;
}
// key-visual // key-visual
.key-visual{ .key-visual{
width: 100%; width: 100%;
......
...@@ -15,13 +15,14 @@ class AppliesController < ApplicationController ...@@ -15,13 +15,14 @@ class AppliesController < ApplicationController
@application = ApplyJob.new(application_params) @application = ApplyJob.new(application_params)
@application.user = current_user @application.user = current_user
@application.job_id = session[:job_id] @application.job_id = session[:job_id]
session[:candidate] = {name: application_params[:name], @application.cv = current_user.cv if application_params[:cv].blank?
email: application_params[:email], session[:candidate] = { name: application_params[:name],
cv: application_params[:cv]} email: application_params[:email],
cv: (application_params[:cv] || current_user.cv) }
unless @application.valid? unless @application.valid?
flash[:error] = @application.errors.full_messages.to_sentence flash[:error] = @application.errors.full_messages.to_sentence
redirect_to apply_path(job_id: session[:job_id]) redirect_to apply_applies_path(job_id: session[:job_id])
return return
end end
end end
...@@ -30,6 +31,7 @@ class AppliesController < ApplicationController ...@@ -30,6 +31,7 @@ class AppliesController < ApplicationController
@application = ApplyJob.new(user: current_user, @application = ApplyJob.new(user: current_user,
job_id: session[:job_id]) job_id: session[:job_id])
@application.attributes = session[:candidate] @application.attributes = session[:candidate]
@application.cv = current_user.cv if @application.cv.file.nil?
if @application.save if @application.save
flash[:notice] = 'Congratulation! Job was successfully applied' flash[:notice] = 'Congratulation! Job was successfully applied'
......
...@@ -8,6 +8,7 @@ class JobsController < ApplicationController ...@@ -8,6 +8,7 @@ class JobsController < ApplicationController
def show def show
clear_session_candidate clear_session_candidate
current_user.view(Job.find(params[:id])) if current_user
end end
def city def city
......
class MyPagesController < ApplicationController
before_action :authenticate_user!
def index
@user = current_user
end
def my_job
@jobs = current_user.my_jobs
end
def history
@jobs = current_user.viewed_jobs.includes(:apply_jobs, :company).limit(Settings.top.job_per_history_page)
end
def download_cv
if current_user.cv.file.exists?
send_file current_user.cv.path
else
flash[:notice] = 'File not exist!'
redirect_back(fallback_location: root_path)
end
end
end
class PasswordsController < Devise::PasswordsController
def edit
self.resource = User.with_reset_password_token(params[:reset_password_token])
if self.resource
set_minimum_password_length
resource.reset_password_token = params[:reset_password_token]
else
flash[:notice] = 'was already confirmed, please try signing in'
redirect_to root_path
end
end
end
module ApplicationHelper module ApplicationHelper
def user_has_applied?(job)
current_user && current_user.applied?(job)
end
end end
class ApplyJob < ApplicationRecord class ApplyJob < ApplicationRecord
belongs_to :job belongs_to :job
belongs_to :user belongs_to :user
validates :cv, presence: true validates_size_of :cv, maximum: 5.megabytes, message: 'size should be less than 5MB'
validates :email, presence: true validates :email, presence: true
validates :name, presence: true validates :name, presence: true
# CarrierWave
mount_uploader :cv, CvUploader
end end
...@@ -8,6 +8,8 @@ class Job < ApplicationRecord ...@@ -8,6 +8,8 @@ class Job < ApplicationRecord
has_many :industries, through: :industries_jobs has_many :industries, through: :industries_jobs
has_many :cities_jobs has_many :cities_jobs
has_many :cities, through: :cities_jobs has_many :cities, through: :cities_jobs
has_many :view_jobs
has_many :users_has_viewed, through: :view_jobs, class_name: 'User', source: :user
scope :top_list, -> { order(updated_date: :desc).limit(Settings.top.job_per_page) } scope :top_list, -> { order(updated_date: :desc).limit(Settings.top.job_per_page) }
...@@ -54,15 +56,14 @@ class Job < ApplicationRecord ...@@ -54,15 +56,14 @@ class Job < ApplicationRecord
puts "Saving #{item[:name]} ......................................" puts "Saving #{item[:name]} ......................................"
if job.save if job.save
puts "Job was successfully created" puts 'Job was successfully created'
else else
puts "Error..." puts 'Error...'
end end
end end
end end
def self.filter_link_exist(links) def self.filter_link_exist(links)
return links - Job.where(original_link: links).pluck(:original_link) links - Job.where(original_link: links).pluck(:original_link)
end end
end end
...@@ -5,6 +5,8 @@ class User < ApplicationRecord ...@@ -5,6 +5,8 @@ class User < ApplicationRecord
has_many :applied_jobs, through: :apply_jobs, class_name: 'Job', source: :job has_many :applied_jobs, through: :apply_jobs, class_name: 'Job', source: :job
has_many :favorite_jobs has_many :favorite_jobs
has_many :liked_jobs, through: :favorite_jobs, class_name: 'Job', source: :job has_many :liked_jobs, through: :favorite_jobs, class_name: 'Job', source: :job
has_many :view_jobs
has_many :viewed_jobs, through: :view_jobs, class_name: 'Job', source: :job
# Include default devise modules. Others available are: # Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable # :confirmable, :lockable, :timeoutable and :omniauthable
...@@ -33,6 +35,25 @@ class User < ApplicationRecord ...@@ -33,6 +35,25 @@ class User < ApplicationRecord
liked_jobs.include?(job) liked_jobs.include?(job)
end end
def view(job)
viewed_jobs << job unless viewed?(job)
end
def viewed?(job)
viewed_jobs.include?(job)
end
def applied?(job)
applied_jobs.include?(job)
end
def my_jobs
Job.select(:'jobs.id', :'jobs.name', :'jobs.salary', :'jobs.description',
:'companies.location', :'apply_jobs.created_at')
.joins(:company, :apply_jobs)
.where(apply_jobs: { user_id: id })
end
private private
def password_required? def password_required?
......
class ViewJob < ApplicationRecord
belongs_to :user
belongs_to :job
end
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<p class="text-info">1. Apply form</p> <p class="text-info">1. Apply form</p>
</div> </div>
<div class="form-horizontal"> <div class="form-horizontal">
<%= form_for @application, url: confirm_applies_path do |f| %> <%= form_for(@application, url: confirm_applies_path, html: { multipart: true }) do |f| %>
<div class="form-group"> <div class="form-group">
<%= f.label :Email, 'Email:', class: "control-label col-md-2" %> <%= f.label :Email, 'Email:', class: "control-label col-md-2" %>
<div class="col-sm-10"> <div class="col-sm-10">
...@@ -22,8 +22,9 @@ ...@@ -22,8 +22,9 @@
<div class="form-group"> <div class="form-group">
<%= f.label :cv, 'Cv:',class: "control-label col-md-2" %> <%= f.label :cv, 'Cv:',class: "control-label col-md-2" %>
<div class="col-sm-10"> <div class="col-sm-10 mrTop5">
<%= f.text_field :cv, class: "form-control" %> <label for="apply_job_cv"><%= @application.cv.filename %></label>
</label>
</div> </div>
</div> </div>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<div class="col-md-offset-2 col-md-10"> <div class="col-md-offset-2 col-md-10">
<p>Fullname: <%= @application.name %></p> <p>Fullname: <%= @application.name %></p>
<p>Email: <%= @application.email %></p> <p>Email: <%= @application.email %></p>
<p>Cv: <%= @application.cv %></p> <p>Cv: <%= @application.cv.filename %></p>
<div class="col-md-10"> <div class="col-md-10">
<%= button_to "Edit", <%= button_to "Edit",
apply_applies_path(job_id: session[:job_id]), apply_applies_path(job_id: session[:job_id]),
......
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
</p> </p>
<p> <p>
<span>CV Link: </span> <span>CV Link: </span>
<span> <%= @application.cv %></span> <span>
<%= link_to @application.cv.filename, download_my_pages_url %>
</span>
</p> </p>
</div> </div>
......
...@@ -3,29 +3,42 @@ ...@@ -3,29 +3,42 @@
<div class="jobs clearfix"> <div class="jobs clearfix">
<div class="job col-md-12"> <div class="job col-md-12">
<table class="table"> <table class="table">
<tbody> <%= form_tag apply_applies_path, method: :get do %>
<%- @jobs.each do |job|-%> <tbody>
<tr> <%- @jobs.each do |job|-%>
<td class="col-md-1 position-relative"> <tr>
<input type="radio" name="rbn-apply-job" class="mid-heigth"> <td class="col-md-1 position-relative">
</td> <%= radio_button_tag "job_id", job.id, false, class: "mid-heigth",
<td class="col-md-9"> disabled: user_has_applied?(job) ? true : false %>
<h4 class="mr0"><%= link_to job.name, job_path(job) %></h4> </td>
<p><%= "Loacation: #{job.company.location}" %></p> <td class="col-md-9">
<p><%= "Salary: #{job.salary}" %></p> <h4 class="mr0"><%= link_to job.name + "#{user_has_applied?(job) ? ' (APPLIED)' : ''}", job_path(job) %></h4>
</td> <p><strong>Description:</strong><%= strip_tags(job.description)[0...250] %>...</p>
<td class="col-md-2 position-relative"> <p>
<%= button_to "Remove", <span><%= "<strong>Loacation</strong>: #{job.company.location}".html_safe %></span>
unlike_job_favorites_path(job_id: job.id), <span class="navbar-right"><%= "<strong>Salary</strong>: #{job.salary}".html_safe %></span>
data: {confirm: "Are you sure you want to remove this job?"}, </p>
class: "btn btn-danger btn-lg mid-heigth" %> </td>
</td> <td class="col-md-2 position-relative">
</tr> <%= link_to "Remove",
<% end %> unlike_job_favorites_path(job_id: job.id),
</tbody> method: :post,
data: {confirm: "Are you sure you want to remove this job?"},
class: "btn btn-danger btn-lg mid-heigth" %>
</td>
</tr>
<% end %>
<tr>
<td></td>
<td>
<%= submit_tag "Applys", class: "btn btn-primary btn-lg btn-block", id: "apply", disabled: true %>
</td>
<td></td>
</tr>
</tbody>
<% end %>
</table> </table>
</div> </div>
<%= button_to "Apply", nil, class: "btn btn-primary" %>
</div> </div>
</div> </div>
</div> </div>
<div class="job-intro well mr0 mrBot20"> <div class="job-intro well mr0 mrBot20">
<h4 class="mr0"><%= link_to job.name, job_path(job) %></h4> <h4 class="mr0"><%= link_to job.name, job_path(job) %></h4>
<p><%= "Loacation: #{job.company.location}" %></p> <p><%= "Loacation: #{job.company.location}" %></p>
<p><%= strip_tags(job.description)[0...250] %>...</p>
<p><%= "Salary: #{job.salary}" %></p> <p><%= "Salary: #{job.salary}" %></p>
</div> </div>
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
</p> </p>
<div class="job-list"> <div class="job-list">
<p> <p>
<span><%= "1. Total: #{@jobs.count}" %></span> <span>1. Total: <%= "#{@jobs.count}" %></span>
<span><%= "Result for: #{@result}" %></span> <span>Result for: <%= "#{@result}" %></span>
</p> </p>
<div class="top-page"> <div class="top-page">
<div class="top-page-info"> <div class="top-page-info">
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
</div> </div>
<div class="col-md-2 favorite"> <div class="col-md-2 favorite">
<%= link_to "FAVORITE", "#", class: "btn btn-default" %> <%= button_to "Favorite",
job_favorites_path(job_id: job.id),
class: "btn btn-primary btn-lg btn-block" %>
</div> </div>
</div> </div>
<%- end -%> <%- end -%>
......
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
</ol> </ol>
</ol> </ol>
<div class="job"> <div class="job">
<% if user_has_applied?(@job) %>
<div class="alert alert-success" role="alert">
You have applied this job.
</div>
<% end %>
<div class="col-md-9"> <div class="col-md-9">
<h1>2.<%= @job.name %></h1> <h1>2.<%= @job.name %></h1>
<p>3.<%= link_to @job.company.name, company_jobs_path(@job.company) %></p> <p>3.<%= link_to @job.company.name, company_jobs_path(@job.company) %></p>
...@@ -33,18 +38,20 @@ ...@@ -33,18 +38,20 @@
</p> </p>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<%= link_to "Apply", apply_applies_path(job_id: @job.id), class: "btn btn-primary btn-lg" %> <%= link_to "Apply",
apply_applies_path(job_id: @job.id),
class: "btn btn-primary btn-lg #{user_has_applied?(@job) ? 'disabled' : ''} btn-block" %>
</div> </div>
<div class="action"> <div class="action">
<div class="col-md-6"> <div class="col-md-6">
<%= link_to "Apply", apply_applies_path(job_id: @job.id), class: "btn btn-primary btn-lg" %> <%= link_to "Apply",
apply_applies_path(job_id: @job.id),
class: "btn btn-primary btn-lg #{user_has_applied?(@job) ? 'disabled' : ''} btn-block" %>
</div> </div>
<div class="action"> <div class="col-md-6">
<div class="col-md-6"> <%= button_to "Favorite",
<%= button_to "Favorite", job_favorites_path(job_id: @job.id),
job_favorites_path(job_id: @job.id), class: "btn btn-primary btn-lg btn-block" %>
class: "btn btn-primary btn-lg" %>
</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
<!-- check an user is logged in or not --> <!-- check an user is logged in or not -->
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<%- if current_user -%> <%- if current_user -%>
<li><a href="#"><i class="fa fa-user" aria-hidden="true"></i> My Page</a></li> <li>
<%= link_to my_my_pages_path do %>
<i class="fa fa-user" aria-hidden="true"></i> My Page
<% end %>
</li>
<li> <li>
<%= link_to destroy_user_session_path, method: :delete do %> <%= link_to destroy_user_session_path, method: :delete do %>
<i class="fa fa-sign-out" aria-hidden="true"></i>Logout <i class="fa fa-sign-out" aria-hidden="true"></i>Logout
...@@ -17,13 +21,13 @@ ...@@ -17,13 +21,13 @@
</li> </li>
<%- else -%> <%- else -%>
<li> <li>
<%= link_to register_path(step: 1) do %> <%= link_to new_user_session_path do %>
<i class="fa fa-plus-circle" aria-hidden="true"></i> Register <i class="fa fa-sign-in" aria-hidden="true"></i> Login
<% end %> <% end %>
</li> </li>
<li> <li>
<%= link_to new_user_session_path do %> <%= link_to register_path(step: 1) do %>
<i class="fa fa-sign-in" aria-hidden="true"></i> Login <i class="fa fa-plus-circle" aria-hidden="true"></i> Register
<% end %> <% end %>
</li> </li>
<%- end -%> <%- end -%>
...@@ -32,7 +36,11 @@ ...@@ -32,7 +36,11 @@
<i class="fa fa-star" aria-hidden="true"></i> <i class="fa fa-star" aria-hidden="true"></i>
<% end %> <% end %>
</li> </li>
<li><a href="#"><i class="fa fa-history" aria-hidden="true"></i></span> History</a></li> <li>
<%= link_to history_my_pages_path do %>
<i class="fa fa-history" aria-hidden="true"></i> History
<% end %>
</li>
</ul> </ul>
</div> </div>
</nav> </nav>
<div class="row">
<div class="container">
<div class="jobs clearfix">
<div class="job col-md-12">
<h3>History</h3>
<table class="table">
<%= form_tag apply_applies_path, method: :get do %>
<tbody>
<%- @jobs.each do |job|-%>
<tr>
<td class="col-md-1 position-relative">
<%= radio_button_tag "job_id", job.id, false, class: "mid-heigth",
disabled: user_has_applied?(job) ? true : false %>
</td>
<td class="col-md-9">
<h4 class="mr0"><%= link_to job.name + "#{user_has_applied?(job) ? ' (APPLIED)' : ''}", job_path(job) %></h4>
<p><strong>Description:</strong><%= strip_tags(job.description)[0...250] %>...</p>
<p>
<span><%= "<strong>Loacation</strong>: #{job.company.location}".html_safe %></span>
<span class="navbar-right"><%= "<strong>Salary</strong>: #{job.salary}".html_safe %></span>
</p>
</td>
</tr>
<% end %>
<tr>
<td></td>
<td>
<%= submit_tag "Applys", class: "btn btn-primary btn-lg btn-block", id: "apply", disabled: true %>
</td>
<td></td>
</tr>
</tbody>
<% end %>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="container">
<div class="col-sm-6 col-md-offset-3 toppad" >
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">My Page</h3>
</div>
<div class="panel-body">
<div class="row">
<div class=" col-md-12">
<table class="table table-user-information">
<tbody>
<tr>
<td>Name:</td>
<td><%= @user.name %></td>
</tr>
<tr>
<td>email:</td>
<td><%= @user.email %></td>
</tr>
<tr>
<td>CV:</td>
<td>
<%= link_to @user.cv.file.filename, download_my_pages_path %>
</td>
</tr>
</tbody>
</table>
<div class="col-md-6">
<%= link_to "Update", edit_user_registration_path, class: "btn btn-primary navbar-right" %>
</div>
<div class="col-md-6">
<%= link_to "My jobs", jobs_my_pages_path, class: "btn btn-primary" %>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="container">
<h2>Applied jobs</h2>
<div class="jobs clearfix">
<%- @jobs.each do |job|-%>
<div class="job">
<div class="col-md-10 job-detail well">
<p><h4 class="mr0"><%= link_to job.name, job_path(job) %></h4></p>
<p><%= strip_tags(job.description)[0...250] %>...</p>
<p>
<span><strong>Location:</strong> <%= "#{job.location}" %></span>
<span><strong>Salary:</strong> <%= job.salary %></span>
<span class="navbar-right"><strong>Applied at:</strong> <%= I18n.localize(job.created_at, format: :long) %></span>
</p>
</div>
</div>
<%- end -%>
</div>
</div>
</div>
<p>Dear <%= @resource.name %>!</p>
<p>You have a new password!</p>
<p>Your password for signing in to VenJOB was recently changed. If you made this change, then we're all set.</p>
<p>If you did not make this change, please reset your password to secure your account. Then reply to this email to notify us.</p>
<p>Either way, feel free to reach out with any questions you might have. We're here to help.</p>
<p>Best,</p>
<p>Hello <%= @resource.email %>!</p>
<p>We received a request to reset the password associated with this e-mail address. If you made this request, please follow the instructions below.</p>
<p>Click the link below to reset your password using our secure server:.</p>
<p><%= link_to 'Reset your password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p>If you did not request to have your password reset you can safely ignore this email. Rest assured your account is safe.</p>
<p>Please also be noted that the above link is valid for 24 hours.</p>
<p>Best,</p>
<div class="row">
<div class="container">
<h2>Change your password</h2>
<%=form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %>
<div class="form-inputs form-group">
<%= f.hidden_field :reset_password_token %>
</div>
<div class="form-inputs form-group">
<%= f.label :email, "Email" %><br />
<%= f.email_field :email, required: true, class: "form-control", disabled: true %>
</div>
<div class="form-inputs form-group">
<%= f.label :password, "New password" %><br />
<%= f.password_field :password,
class: 'form-control',
required: true,
autofocus: true,
hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
</div>
<div class="form-inputs form-group">
<%= f.label :password, "Confirm password" %><br />
<%= f.password_field :password_confirmation, required: true, class: "form-control" %>
</div>
<div class="form-actions">
<%= submit_tag "Submit", class: "btn btn-danger form-control" %>
</div>
<% end %>
</div>
</div>
<div class="row">
<div class="container">
<h2>Forgot your password?</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<div class="form-inputs form-group">
<%= f.text_field :email, required: true, autofocus: true, class: "form-control" %>
</div>
<div class="form-actions form-group">
<%= submit_tag "Confirm", class: "btn btn-primary" %>
</div>
<% end %>
</div>
</div>
...@@ -12,11 +12,14 @@ ...@@ -12,11 +12,14 @@
</div> </div>
<% if devise_mapping.rememberable? -%> <% if devise_mapping.rememberable? -%>
<div class="field form-group">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<% end -%>
<div class="field form-group"> <div class="field form-group">
<%= f.check_box :remember_me %> <%= link_to "Forgot password?", forgot_password_path %>
<%= f.label :remember_me %>
</div> </div>
<% end -%>
<div class="actions form-group"> <div class="actions form-group">
<%= f.submit "Log in", class: "btn btn-default" %> <%= f.submit "Log in", class: "btn btn-default" %>
......
...@@ -47,7 +47,7 @@ Rails.application.configure do ...@@ -47,7 +47,7 @@ Rails.application.configure do
# Raises error for missing translations # Raises error for missing translations
# config.action_view.raise_on_missing_translations = true # config.action_view.raise_on_missing_translations = true
config.action_mailer.default_url_options = { protocol: 'http', host: 'localhost:3000' }
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: 'localhost', config.action_mailer.smtp_settings = { address: 'localhost',
port: 1025 } port: 1025 }
......
...@@ -12,7 +12,7 @@ Devise.setup do |config| ...@@ -12,7 +12,7 @@ Devise.setup do |config|
# Configure the e-mail address which will be shown in Devise::Mailer, # Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class # note that it will be overwritten if you use your own mailer class
# with default "from" parameter. # with default "from" parameter.
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' config.mailer_sender = 'notify@venjob.com'
# Configure the class responsible to send e-mails. # Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer' # config.mailer = 'Devise::Mailer'
...@@ -114,7 +114,7 @@ Devise.setup do |config| ...@@ -114,7 +114,7 @@ Devise.setup do |config|
# config.send_email_changed_notification = false # config.send_email_changed_notification = false
# Send a notification email when the user's password is changed. # Send a notification email when the user's password is changed.
# config.send_password_change_notification = false config.send_password_change_notification = true
# ==> Configuration for :confirmable # ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without # A period that the user is allowed to access the website even without
......
...@@ -20,13 +20,13 @@ en: ...@@ -20,13 +20,13 @@ en:
confirmation_instructions: confirmation_instructions:
subject: "Confirmation instructions" subject: "Confirmation instructions"
reset_password_instructions: reset_password_instructions:
subject: "Reset password instructions" subject: "VeNJOB Password Assistance"
unlock_instructions: unlock_instructions:
subject: "Unlock instructions" subject: "Unlock instructions"
email_changed: email_changed:
subject: "Email Changed" subject: "Email Changed"
password_change: password_change:
subject: "Password Changed" subject: "VeNJOB Password Assistance: Your password has been reset"
omniauth_callbacks: omniauth_callbacks:
failure: "Could not authenticate you from %{kind} because \"%{reason}\"." failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
success: "Successfully authenticated from %{kind} account." success: "Successfully authenticated from %{kind} account."
......
...@@ -6,10 +6,12 @@ Rails.application.routes.draw do ...@@ -6,10 +6,12 @@ Rails.application.routes.draw do
root 'applies#index' root 'applies#index'
end end
root 'jobs#index' root 'jobs#index'
devise_for :users, :controllers => {:registrations => "registrations"} devise_for :users, controllers: { registrations: 'registrations', passwords: 'passwords' }
as :user do as :user do
get 'register/:step', to: 'registrations#new', as: :register get 'register/:step', to: 'registrations#new', as: :register
patch 'complete_registering' => 'registrations#complete_registering_user' patch 'complete_registering' => 'registrations#complete_registering_user'
get 'forgot_password' => 'passwords#new'
get 'reset_password' => 'password#edit'
end end
resources :cities, only: [:index, :show] resources :cities, only: [:index, :show]
resources :industries, only: [:index, :show] resources :industries, only: [:index, :show]
...@@ -21,12 +23,20 @@ Rails.application.routes.draw do ...@@ -21,12 +23,20 @@ Rails.application.routes.draw do
end end
resources :jobs do resources :jobs do
collection do collection do
get 'city/:city_id' => "jobs#city", as: :city get 'city/:city_id' => 'jobs#city', as: :city
get 'industry/:industry_id' => "jobs#industry", as: :industry get 'industry/:industry_id' => 'jobs#industry', as: :industry
get 'company/:company_id' => "jobs#company", as: :company get 'company/:company_id' => 'jobs#company', as: :company
end end
end end
resources :applies do resources :my_pages, path: '', only: [:index] do
collection do
get 'my' => 'my_pages#index'
get 'my/jobs' => 'my_pages#my_job', as: :jobs
get 'history' => 'my_pages#history', as: :history
get 'download' => 'my_pages#download_cv'
end
end
resources :applies, path: '', only: [] do
collection do collection do
get :apply get :apply
post :confirm post :confirm
......
...@@ -3,6 +3,7 @@ defaults: &defaults ...@@ -3,6 +3,7 @@ defaults: &defaults
job_per_page: 5 job_per_page: 5
industry_per_page: 9 industry_per_page: 9
city_per_page: 9 city_per_page: 9
job_per_history_page: 20
development: development:
<<: *defaults <<: *defaults
......
class CreateViewJobs < ActiveRecord::Migration[5.1]
def change
create_table :view_jobs do |t|
t.references :user, index: true
t.references :job, index: true
t.timestamps
end
end
end
This source diff could not be displayed because it is too large. You can view the blob instead.
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