Commit 91e3d553 by Hoang Nam Nguyen

'Fixed'

parent 785ef9b6
...@@ -12,7 +12,6 @@ gem 'zip-zip' # will load compatibility for old rubyzip API. ...@@ -12,7 +12,6 @@ gem 'zip-zip' # will load compatibility for old rubyzip API.
gem 'nokogiri' gem 'nokogiri'
gem 'whenever', :require => false gem 'whenever', :require => false
gem "figaro" gem "figaro"
gem 'counter_culture', '~> 0.1.33'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.3' gem 'rails', '~> 5.1.3'
# Use mysql as the database for Active Record # Use mysql as the database for Active Record
......
...@@ -40,9 +40,6 @@ GEM ...@@ -40,9 +40,6 @@ GEM
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.5.2) addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0) public_suffix (>= 2.0.2, < 4.0)
after_commit_action (1.0.1)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
arel (8.0.0) arel (8.0.0)
bindex (0.5.0) bindex (0.5.0)
bootstrap-will_paginate (1.0.0) bootstrap-will_paginate (1.0.0)
...@@ -68,12 +65,10 @@ GEM ...@@ -68,12 +65,10 @@ GEM
execjs execjs
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
concurrent-ruby (1.0.5) concurrent-ruby (1.0.5)
counter_culture (0.1.34)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
after_commit_action (~> 1.0.0)
erubi (1.6.1) erubi (1.6.1)
execjs (2.7.0) execjs (2.7.0)
faraday (0.13.1)
multipart-post (>= 1.2, < 3)
ffi (1.9.18) ffi (1.9.18)
figaro (1.1.1) figaro (1.1.1)
thor (~> 0.14) thor (~> 0.14)
...@@ -99,6 +94,7 @@ GEM ...@@ -99,6 +94,7 @@ GEM
mini_portile2 (2.2.0) mini_portile2 (2.2.0)
minitest (5.10.3) minitest (5.10.3)
multi_json (1.12.1) multi_json (1.12.1)
multipart-post (2.0.0)
mysql2 (0.4.9) mysql2 (0.4.9)
nio4r (2.1.0) nio4r (2.1.0)
nokogiri (1.8.0) nokogiri (1.8.0)
...@@ -142,6 +138,9 @@ GEM ...@@ -142,6 +138,9 @@ GEM
rb-fsevent (0.10.2) rb-fsevent (0.10.2)
rb-inotify (0.9.10) rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2) ffi (>= 0.5.0, < 2)
rsolr (2.0.2)
builder (>= 2.1.2)
faraday
ruby_dep (1.5.0) ruby_dep (1.5.0)
rubyzip (1.2.1) rubyzip (1.2.1)
sass (3.5.1) sass (3.5.1)
...@@ -205,7 +204,6 @@ DEPENDENCIES ...@@ -205,7 +204,6 @@ DEPENDENCIES
byebug byebug
capybara (~> 2.13) capybara (~> 2.13)
coffee-rails (~> 4.2) coffee-rails (~> 4.2)
counter_culture (~> 0.1.33)
figaro figaro
jbuilder (~> 2.5) jbuilder (~> 2.5)
listen (>= 3.0.5, < 3.2) listen (>= 3.0.5, < 3.2)
...@@ -215,6 +213,7 @@ DEPENDENCIES ...@@ -215,6 +213,7 @@ DEPENDENCIES
pry-byebug pry-byebug
puma (~> 3.7) puma (~> 3.7)
rails (~> 5.1.3) rails (~> 5.1.3)
rsolr
rubyzip (>= 1.0.0) rubyzip (>= 1.0.0)
sass-rails (~> 5.0) sass-rails (~> 5.0)
selenium-webdriver selenium-webdriver
......
This source diff could not be displayed because it is too large. You can view the blob instead.
class TopPagesController < ApplicationController class TopPagesController < ApplicationController
def cities def cities
@vn_cities = City.where.not(is_vietnam: :acchived ) @vn_cities = City.vietnam
@international_cities = City.where(is_vietnam: :active) @international_cities = City.international
end end
def industries def industries
...@@ -12,7 +12,7 @@ class TopPagesController < ApplicationController ...@@ -12,7 +12,7 @@ class TopPagesController < ApplicationController
end end
def top_page def top_page
@jobs = Job.recent.limit(ENV["Number_top_page_jobs"]) @jobs = Job.recent(ENV["Number_top_page_jobs"])
@total_job = Job.count @total_job = Job.count
@industries = Industry.limit(ENV["Number_top_page"]) @industries = Industry.limit(ENV["Number_top_page"])
@cities = City.limit(ENV["Number_top_page"]) @cities = City.limit(ENV["Number_top_page"])
......
class City < ApplicationRecord class City < ApplicationRecord
has_many :job_cities has_many :job_cities
has_many :jobs, through: :job_cities has_many :jobs, through: :job_cities
enum city_type: {vietnam: 1, international: 0}
end end
...@@ -4,5 +4,5 @@ class Job < ApplicationRecord ...@@ -4,5 +4,5 @@ class Job < ApplicationRecord
has_many :job_industries has_many :job_industries
has_many :industries, through: :job_industries has_many :industries, through: :job_industries
scope :recent, -> { order(id: :desc) } scope :recent, -> (num) { order(id: :desc).limit(num) }
end end
<% if city.job_cities_count != 0 %> <% if city.job_cities_count > 0 %>
<div class="col-md-4 list-group-item"> <div class="col-md-4 list-group-item">
<ul> <ul>
<li> <li>
......
<% if industry.job_industries_count !=0 %> <% if industry.job_industries_count > 0 %>
<div class="col-md-4 list-group-item"> <div class="col-md-4 list-group-item">
<ul> <ul>
<li> <li>
......
...@@ -3,11 +3,12 @@ ...@@ -3,11 +3,12 @@
<%= job.job_title %> <%= job.job_title %>
</p> </p>
</a> </a>
<div class="content_job"> <div class="content_job">
<li class="detail_description"> <%= truncate job.short_description,length: 160%> <li class="detail_description"><%= truncate job.short_description,length: 160%>
<%= link_to 'read more', '#' %> </li> <%= link_to 'read more', '#' %></li>
<li class="detail_description"> <%= job.salary %> </li> <li class="detail_description"> <%= job.salary %></li>
<% job.cities.each do |city| %> <% job.cities.each do |city| %>
<li class="detail_description"> <%= city.location %> </li> <li class="detail_description"><%= city.location %></li>
<% end %> <% end %>
</div> </div>
\ No newline at end of file
class AddBooleanToCities < ActiveRecord::Migration[5.1] class AddBooleanToCities < ActiveRecord::Migration[5.1]
def change def change
add_column :cities, :is_vietnam, :boolean add_column :cities, :city_type, :integer
enum is_vietnam: {active: 0, acchived: 1}
end end
end end
class Solr
def initialize
@solr = RSolr.connect :url => 'http://localhost:8983/solr/venjobs'
end
def self.sync_all
import_fields = [salary,industry,city,company]
end
end
\ No newline at end of file
...@@ -16,7 +16,7 @@ namespace :crawl do ...@@ -16,7 +16,7 @@ namespace :crawl do
cities.each do |city| cities.each do |city|
next if city.text == 'Tất cả địa điểm' next if city.text == 'Tất cả địa điểm'
is_vietnam = false if city.text == 'Angola' is_vietnam = false if city.text == 'Angola'
City.find_or_create_by!(location: city.text, is_vietnam: is_vietnam) City.find_or_create_by!(location: city.text, city_type: is_vietnam)
end end
#get industry and save database #get industry and save database
......
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