Commit 75e4cd54 by Ngô Trung Hưng

use gem draper

parent 5931eb90
Pipeline #849 canceled with stages
in 0 seconds
...@@ -30,6 +30,7 @@ gem 'nokogiri' ...@@ -30,6 +30,7 @@ gem 'nokogiri'
gem 'whenever' gem 'whenever'
gem 'kaminari' gem 'kaminari'
gem 'breadcrumbs_on_rails' gem 'breadcrumbs_on_rails'
gem 'draper'
# Use ActiveStorage variant # Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8' # gem 'mini_magick', '~> 4.8'
......
...@@ -29,6 +29,10 @@ GEM ...@@ -29,6 +29,10 @@ GEM
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.2.4.3) activemodel (5.2.4.3)
activesupport (= 5.2.4.3) activesupport (= 5.2.4.3)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (5.2.4.3) activerecord (5.2.4.3)
activemodel (= 5.2.4.3) activemodel (= 5.2.4.3)
activesupport (= 5.2.4.3) activesupport (= 5.2.4.3)
...@@ -76,6 +80,12 @@ GEM ...@@ -76,6 +80,12 @@ GEM
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
concurrent-ruby (1.1.6) concurrent-ruby (1.1.6)
crass (1.0.6) crass (1.0.6)
draper (4.0.1)
actionpack (>= 5.0)
activemodel (>= 5.0)
activemodel-serializers-xml (>= 1.0)
activesupport (>= 5.0)
request_store (>= 1.0)
erubi (1.9.0) erubi (1.9.0)
execjs (2.7.0) execjs (2.7.0)
ffi (1.13.1) ffi (1.13.1)
...@@ -153,6 +163,8 @@ GEM ...@@ -153,6 +163,8 @@ GEM
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
regexp_parser (1.7.1) regexp_parser (1.7.1)
request_store (1.5.0)
rack (>= 1.4)
ruby_dep (1.5.0) ruby_dep (1.5.0)
rubyzip (2.3.0) rubyzip (2.3.0)
sass (3.7.4) sass (3.7.4)
...@@ -213,6 +225,7 @@ DEPENDENCIES ...@@ -213,6 +225,7 @@ DEPENDENCIES
capybara (>= 2.15) capybara (>= 2.15)
chromedriver-helper chromedriver-helper
coffee-rails (~> 4.2) coffee-rails (~> 4.2)
draper
jbuilder (~> 2.5) jbuilder (~> 2.5)
kaminari kaminari
listen (>= 3.0.5, < 3.2) listen (>= 3.0.5, < 3.2)
......
...@@ -1127,9 +1127,12 @@ $main-color: #23303D; ...@@ -1127,9 +1127,12 @@ $main-color: #23303D;
background-image: linear-gradient(315deg, #d4418e 0%, #0652c5 74%); background-image: linear-gradient(315deg, #d4418e 0%, #0652c5 74%);
outline: none !important; outline: none !important;
border: none !important; border: none !important;
transition: all 0.4s ease-in-out;
&:hover { &:hover {
color: #fff !important; color: #fff !important;
font-weight: 600 !important; // font-weight: 600 !important;
transition: all 4s ease-in-out;
background-image: linear-gradient(43deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%);
} }
} }
.btn-apply_job_favorite { .btn-apply_job_favorite {
......
...@@ -11,7 +11,7 @@ class JobController < ApplicationController ...@@ -11,7 +11,7 @@ class JobController < ApplicationController
end end
def detail def detail
@job = Job.find(params[:id]) @job = Job.find(params[:id]).decorate
cities = @job.cities.first cities = @job.cities.first
industries = @job.industries.first industries = @job.industries.first
add_breadcrumb 'Trang chủ', root_path add_breadcrumb 'Trang chủ', root_path
......
# frozen_string_literal: true # frozen_string_literal: true
# pattern job decorator # Decorator
module JobDecorator class JobDecorator < Draper::Decorator
delegate_all
def posted_at def posted_at
created_at.strftime('%d - %m - %Y') created_at.strftime('%d - %m - %Y')
end end
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# Description/Explanation of Person class # Description/Explanation of Person class
class Job < ApplicationRecord class Job < ApplicationRecord
include JobDecorator
NUMBER_LASTED_JOB = 5 NUMBER_LASTED_JOB = 5
belongs_to :company belongs_to :company
......
...@@ -19,6 +19,6 @@ ...@@ -19,6 +19,6 @@
# Learn more: http://github.com/javan/whenever # Learn more: http://github.com/javan/whenever
env :PATH, ENV['PATH'] env :PATH, ENV['PATH']
every 1.hours do every 10.minute do
rake 'crawler:populate' rake 'crawler:populate'
end end
\ No newline at end of file
require 'test_helper'
class JobDecoratorTest < Draper::TestCase
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