Commit 94ea04f4 by nnnghia98

change applied job path

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