Commit 936da9e5 by Tô Ngọc Ánh

fix redirect link after signin, check is_applied_job in detail job

parent a772e138
Pipeline #955 failed with stages
in 0 seconds
......@@ -9,5 +9,6 @@ class JobsController < ApplicationController
def show
@job = Job.find_by(id: params[:id])
@is_not_applied = user_signed_in? ? current_user.applied_jobs.find_by(job_id: @job.id).blank? : true
end
end
......@@ -26,6 +26,6 @@ class Users::SessionsController < Devise::SessionsController
# end
def after_sign_in_path_for(resource)
my_page_path #your path
stored_location_for(resource) || my_page_path
end
end
......@@ -31,15 +31,16 @@
<%= @job.description.html_safe %>
</div>
<div class="col-2">
<% is_not_applied = user_signed_in? ? current_user.applied_jobs.find_by(job_id: @job.id).blank? : true %>
<%= link_to_if is_not_applied, 'Apply Now', new_applied_job_path(job_id: @job.id), class: 'btn btn-outline-success btn-lg' do %>
<%= link_to_if @is_not_applied, 'Apply Now', new_applied_job_path(job_id: @job.id), class: 'btn btn-outline-success btn-lg' do %>
<%= link_to 'Apply Now', '#', class: 'btn btn-outline-secondary btn-lg disabled' %>
<% end %>
</div>
</div>
<div class="row my-3">
<div class="col-6 text-right">
<%= link_to 'Apply Now', new_applied_job_path(job_id: @job.id), class: 'btn btn-outline-success btn-lg' %>
<%= link_to_if @is_not_applied, 'Apply Now', new_applied_job_path(job_id: @job.id), class: 'btn btn-outline-success btn-lg' do %>
<%= link_to 'Apply Now', '#', class: 'btn btn-outline-secondary btn-lg disabled' %>
<% end %>
</div>
<div class="col-6 text-left">
<%= link_to 'Favorite', '#', class: 'btn btn-outline-danger btn-lg' %>
......
Rails.application.routes.draw do
devise_for :users, controllers: { sessions: 'users/sessions', registrations: 'users/registrations' }
root to: 'home#index'
devise_for :users, controllers: { sessions: 'users/sessions', registrations: 'users/registrations' }
get 'cities', to: 'locations#index'
get 'industries', to: 'industries#index'
get 'detail/:id', to: 'jobs#show', as: :job
get 'jobs/:model/:slug', to: 'jobs#index', as: :jobs
get 'my', to: 'users#my_page', as: :my_page
resources :users, only: :show
get 'apply', to: 'applied_jobs#new', as: :new_applied_job
post 'confirm', to: 'applied_jobs#confirm', as: :confirm_applied_job
post 'finish', to: 'applied_jobs#finish', as: :finish_applied_job
......
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