Commit 94ea04f4 by nnnghia98

change applied job path

parent 8467f3e0
class JobsController < ApplicationController
before_action :authenticate_user!, only: [:apply, :confirm_apply, :finish_apply]
before_action :authenticate_user!, only: [:apply, :confirm_apply, :finish_apply, :applied_jobs]
before_action :find_user, only: :apply_available
def index
......@@ -46,6 +46,10 @@ class JobsController < ApplicationController
user_jobs.find_by(job_id: @job_id, user_id: @user.id)
end
def applied_jobs
@applied_jobs = current_user.jobs.includes(:cities).decorate
end
private
def confirm_apply_info_params
......
class Users::MyPagesController < ApplicationController
before_action :authenticate_user!, only: [:show, :applied_jobs]
before_action :authenticate_user!, only: [:show]
def show
end
def applied_jobs
@applied_jobs = current_user.jobs.all.includes(:cities).decorate
end
end
......@@ -6,5 +6,5 @@
<h3>My CV: <%= current_user.cv_path %></h3>
<%= link_to "Edit", edit_user_registration_path, class: "btn btn-lg btn-primary" %>
<%= link_to "My jobs", jobs_users_my_page_path, class: "btn btn-lg btn-primary" %>
<%= link_to "My jobs", applied_jobs_path, class: "btn btn-lg btn-primary" %>
</div>
......@@ -10,9 +10,8 @@ Rails.application.routes.draw do
post "done", to: 'jobs#finish_apply'
devise_for :users
root "tops#index"
get "users/my_page/jobs", to: "jobs#applied_jobs", as: :applied_jobs
namespace :users do
resource :my_page, only: :show do
get "/jobs", to: "my_pages#applied_jobs"
end
resource :my_page, only: :show
end
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