Commit 5931eb90 by Ngô Trung Hưng

use decorator pattern

parent 297950ef
Pipeline #846 failed with stages
in 0 seconds
......@@ -16,7 +16,7 @@ class JobController < ApplicationController
industries = @job.industries.first
add_breadcrumb 'Trang chủ', root_path
add_breadcrumb cities.name, jobs_path(model: 'city', slug: cities.slug)
add_breadcrumb industries.name, jobs_path(model: 'city', slug: industries.slug)
add_breadcrumb industries.name, jobs_path(model: 'industry', slug: industries.slug)
add_breadcrumb @job.name
end
......
# frozen_string_literal: true
# pattern job decorator
module JobDecorator
def posted_at
created_at.strftime('%d - %m - %Y')
end
def expired_at
expiration_date.strftime('%d - %m - %Y')
end
end
......@@ -2,6 +2,7 @@
# Description/Explanation of Person class
class Job < ApplicationRecord
include JobDecorator
NUMBER_LASTED_JOB = 5
belongs_to :company
......
......@@ -22,7 +22,7 @@
<span><i class="far fa-building"></i> <%= link_to @job.company.name, jobs_path(model: 'company', slug: @job.company.slug), class: 'link_ct apply_job' %></span>
</div>
</div>
<div class="col-lg-3 ">
<div class="col-lg-3">
<div class="btn_apply_job">
<%= link_to 'Nộp CV ngay', '#', class: 'btn btn-apply_job' %>
</div>
......@@ -45,16 +45,12 @@
</div>
<div class="col-lg-4 col-md-6">
<div class="detail_info">
<span><i class="fab fa-linode"></i> Ngày đăng tin: <%= @job.created_at.strftime('%d - %m - %Y') %></span>
<span><i class="fab fa-linode"></i> Ngày đăng tin: <%= @job.posted_at %></span>
</div>
</div>
<div class="col-lg-4 col-md-6">
<div class="detail_info">
<% if @job.expiration_date.present? %>
<span><i class="fab fa-linode"></i> Ngày hết hạn: <%= @job.expiration_date.strftime('%d - %m - %Y') %></span>
<% else %>
<span><i class="fab fa-linode"></i> Ngày hết hạn: đang cập nhật</span>
<% end %>
<span><i class="fab fa-linode"></i> Ngày hết hạn: <%= @job.expiration_date.present? ? @job.expired_at : 'đang cập nhật' %></span>
</div>
</div>
<div class="col-lg-4 col-md-6">
......
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