fix mentor's comments

parent 2e647c60
Pipeline #1029 canceled with stages
in 0 seconds
......@@ -21,7 +21,7 @@ class JobAppliedsController < ApplicationController
end
def show
@jobs = Job.applied_job(current_user.id).page(params[:page]).per(Job::LIMIT_PAGE)
@users = current_user.job_applieds.order("job_applieds.updated_at DESC").page(params[:page]).per(Job::LIMIT_PAGE)
end
def confirmation
......
......@@ -19,9 +19,6 @@ class Job < ApplicationRecord
LIMIT_PAGE = 20
scope :applied_job, ->(user_id) { joins(:job_applieds)
.where("job_applieds.user_id = #{user_id}")
.order("job_applieds.updated_at DESC") }
scope :limit_job, -> { includes(:cities, :company).order(created_at: :desc).limit(5) }
def company_name
......
......@@ -9,4 +9,5 @@ class JobApplied < ApplicationRecord
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(?:\.[a-z\d\-]+)*\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 200 }, format: { with: VALID_EMAIL_REGEX }
validates :cv_user, presence: true
end
<div class="border border-dark rounded">
<div class="job-details">
<div class="title">
<%= link_to job_detail_path(job.id) do %><strong>
<%= job.title %></strong>
<%= link_to job_detail_path(user.job.id) do %><strong>
<%= user.job.title %></strong>
<% end %>
</div>
<div class="introduction">
<%= strip_tags(job.format_desc) %><br>
<%= link_to 'Read more..', job_detail_path(job.id) %>
<%= strip_tags(user.job.format_desc) %><br>
<%= link_to 'Read more..', job_detail_path(user.job.id) %>
</div>
<div class="row">
<div class="col-6">
<%= job.cities.map(&:name).join(' | ') %>
<%= user.job.cities.map(&:name).join(' | ') %>
</div>
<div class="salary col-3">
Salary: <%= job.salary %>
Salary: <%= user.job.salary %>
</div>
<div class="applied-at col-3">
<strong>Applied at:</strong>
<% job.job_applieds.where(user_id: current_user.id).each do |info| %>
<%= info.updated_at.strftime('%d/%m/%Y') %>
<% end %>
<%= user.updated_at.strftime('%d/%m/%Y') %>
</div>
</div>
</div>
......
<div class="container">
<% if @jobs.count > 0 %>
<% if @users.count > 0 %>
<h1 class="text-center my-job-label">My Job</h1>
<%= paginate @jobs, outer_window: 2, window: 1 %>
<%= render partial: "job_applieds/my_jobs", collection: @jobs, as: :job %>
<%= paginate @jobs, outer_window: 2, window: 1 %>
<%= paginate @users, outer_window: 2, window: 1 %>
<%= render partial: "job_applieds/my_jobs", collection: @users, as: :user %>
<%= paginate @users, outer_window: 2, window: 1 %>
<% else %>
<h1 class="let-apply">Let's apply job</h1>
<% 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