Commit a810b7ef by Đường Sỹ Hoàng

Change block if else

parent 0da11390
<% job = applied.job %>
<% job = apply.job %>
<dl class="row-cols">
<dt class="col-sm-6">Job Title:</dt>
<dd class="col-sm-12" <% link_to job_detail_path(job.id)%>>
......
......@@ -4,7 +4,7 @@
<div>
<%= paginate @applies %>
<div class="row row-cols-3">
<%= render partial: "apply/applied", collection: @applies %>
<%= render partial: "apply/apply", collection: @applies %>
</div>
</div>
<%= paginate @applies %>
......@@ -49,7 +49,11 @@
<dt class="col-sm-3">Requirement:</dt>
<dd class="col-sm-9"><%= simple_format @job.requirement %></dd>
</dl>
<%= link_to_if(current_user.applies.find_by(job_id: @job.id).nil?, "Apply", apply_path, class: "btn btn-primary") { link_to "Apply", apply_path, class: "btn btn-primary disabled"} %>
<% if current_user.applies.nil? %>
<%= link_to "Apply", apply_path, class: "btn btn-primary" %>
<% else %>
<%= link_to "Apply", "#", class: "btn btn-primary disabled" %>
<% end %>
<%= render "favorites/favorite_form", job: @job %>
</div>
</div
......@@ -7,7 +7,7 @@
<% if user_signed_in? %>
<%= link_to "Log out", destroy_user_session_path, method: :delete, class: "btn btn-outline-success" %>
<%= link_to "Favorite", favorites_path, method: :get, class: "btn btn-outline-success" %>
<%= link_to "Applied jobs", applied_path, method: :get, class: "btn btn-outline-success" %>
<%= link_to "Applied jobs", apply_index_path, method: :get, class: "btn btn-outline-success" %>
<button class="btn btn-outline-success" type="button">History</button>
<% else %>
<form class="form-inline">
......
......@@ -11,7 +11,7 @@ Rails.application.routes.draw do
resources :top, only: :index
resources :users, only: :show
resources :favorites, only: :index
resources :apply, only: :index
resources :jobs, only: :show, concerns: :paginatable do
resources :favorites, only: [:create, :destroy]
end
......@@ -35,5 +35,4 @@ Rails.application.routes.draw do
get "apply/:job_id", to: "apply#new", as: "apply"
post "confirm/:job_id", to: "apply#confirm", as: "confirm"
post "done/:job_id", to: "apply#done", as: "done"
get "applied", to: "apply#index", as: "applied"
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