Commit 01b04e4a by Thanh Hung Pham

Merge branch 'applied-job-page' into 'master'

Applied job page

See merge request !11
parents 8d685ee8 2ca39520
Pipeline #1441 failed with stages
in 0 seconds
......@@ -2,6 +2,10 @@ class ApplyJobsController < ApplicationController
include ApplicationHelper
before_action :authenticate_user!
def index
@applied_jobs = applied_jobs_query.order_applied_jobs(current_user).page(params[:page])
end
def new
job = Job.find_by(id: params[:job_id]) or not_found
......@@ -62,4 +66,8 @@ class ApplyJobsController < ApplicationController
def apply_params
params.require(:apply_job).permit(:name, :email, :cv, :job_id)
end
def applied_jobs_query
@applied_jobs_query ||= AppliedQuery.new
end
end
\ No newline at end of file
......@@ -2,7 +2,7 @@ module ApplicationHelper
def format_datetime(input)
return if input.nil?
input.strftime('%d/%m/%Y')
input.strftime('%H:%M : %d/%m/%Y')
end
def class_active(link_path)
......
class AppliedQuery
def initialize(applied_jobs = ApplyJob)
@applied_jobs = applied_jobs.includes(job: %i[cities cities_jobs])
end
def order_applied_jobs(current_user)
@applied_jobs.where(user: current_user).order('apply_jobs.created_at DESC')
end
end
\ No newline at end of file
- provide :title, 'Applied Job'
h3.p-3.text-center
| Applied Jobs
.d-flex.justify-content-center
= paginate @applied_jobs, window: 1
- @applied_jobs.each do |applied_job|
.bg-white.card.p-2
.p-3.align-self-center
h5.mb-1
= link_to applied_job.job.title, detail_path(applied_job.job.slug)
p.mb-1
i.fas.fa-dollar-sign.m-1
| Lương:
= applied_job.job.salary
p.mb-1
i.fas.fa-map-marker-alt.m-1
= applied_job.job.cities.map(&:name).uniq.join(' | ')
p.mb-1
= truncate(applied_job.job.overview, length: 250)
p.mb-1.text-end
| Applied at:
= format_datetime(applied_job.created_at)
-if @applied_jobs.any?
.d-flex.justify-content-center.p-2
= page_entries_info @applied_jobs
.d-flex.justify-content-center
= paginate @applied_jobs, window: 1
-else
h4.text-center
| You haven't any applied jobs
\ No newline at end of file
......@@ -22,4 +22,4 @@ h2.p-3.text-center
= link_to @user.cv.filename, rails_blob_path(@user.cv, disposition: 'attachment')
.span.p-2.text-center
= link_to "Update", edit_user_registration_path, class: "btn btn-primary btn-space"
= link_to "My Jobs", "#", class: "btn btn-primary btn-space"
\ No newline at end of file
= link_to "My Jobs", applied_job_path, class: "btn btn-primary btn-space"
\ No newline at end of file
......@@ -16,7 +16,7 @@ module VeNJOB
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
config.time_zone = 'Hanoi'
# config.eager_load_paths << Rails.root.join("extras")
end
end
......@@ -12,6 +12,7 @@ Rails.application.routes.draw do
get 'favorite', to: 'favorite_jobs#index', as: 'favorite'
delete 'unfavorite', to: 'favorite_jobs#destroy'
get 'history', to: 'history_jobs#index', as: 'history'
get '/my/jobs', to: 'apply_jobs#index', as: 'applied_job'
devise_for :users, skip: %i[sessions registrations passwords], controllers: { confirmations: 'users/confirmations' }
get '/my', to: 'users#show'
devise_scope :user do
......
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