Commit a9dbeb91 by Xuan Trung Le

install gem settinglogic and delete the unnecessary files

parent c86b29fd
......@@ -20,6 +20,7 @@ gem 'figaro'
gem 'devise'
gem 'carrierwave'
gem 'kaminari'
gem "settingslogic"
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
......
......@@ -141,6 +141,7 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
settingslogic (2.0.9)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
......@@ -185,6 +186,7 @@ DEPENDENCIES
puma (~> 3.7)
rails (~> 5.1.4)
sass-rails (~> 5.0)
settingslogic
spring
spring-watcher-listen (~> 2.0.0)
tzinfo-data
......
class JobsController < ApplicationController
before_action :set_job, only: [:show]
def index
@jobs = Job.includes(:company).order(updated_date: :desc).limit(5)
@cities = City.top_cities
@jobs = Job.top_list.includes(:company)
@cities = City.top_cities.includes(:country)
@industries = Industry.top_industries
end
......@@ -11,21 +11,21 @@ class JobsController < ApplicationController
def city
city = City.find(params[:city_id])
@jobs = city.jobs.includes(:company).page(params[:page]).per(20)
@jobs = city.jobs.includes(:company).page(params[:page]).per(Settings.pagination.job_per_page)
@result = "jobs/City/#{city.name}"
render template: "jobs/job_lists"
end
def industry
industry = Industry.find(params[:industry_id])
@jobs = industry.jobs.includes(:company).page(params[:page]).per(20)
@jobs = industry.jobs.includes(:company).page(params[:page]).per(Settings.pagination.job_per_page)
@result = "jobs/Industry/#{industry.name}"
render template: "jobs/job_lists"
end
def company
company = Company.find(params[:company_id])
@jobs = company.jobs.page(params[:page]).per(20)
@jobs = company.jobs.page(params[:page]).per(Settings.pagination.job_per_page)
@result = "jobs/Company/#{company.name}"
render template: "jobs/job_lists"
end
......
......@@ -4,13 +4,12 @@ class City < ApplicationRecord
has_many :cities_jobs
has_many :jobs, through: :cities_jobs
scope :top_cities, -> { have_at_least_one_job.
scope :top_cities, -> { availble_job.
order(jobs_count: :desc).
limit(9) }
limit(Settings.top.city_per_page) }
scope :city_list, -> { includes(:country).
have_at_least_one_job.
scope :city_list, -> { availble_job.
order(jobs_count: :desc, name: :asc) }
scope :have_at_least_one_job, -> { where('jobs_count > 0')}
scope :availble_job, -> { where('jobs_count > 0')}
end
......@@ -2,12 +2,12 @@ class Industry < ApplicationRecord
has_many :industries_jobs
has_many :jobs, through: :industries_jobs
scope :top_industries, -> { have_at_least_one_job.
scope :top_industries, -> { availble_job.
order(jobs_count: :desc, name: :asc).
limit(9) }
limit(Settings.top.industry_per_page) }
scope :industry_list, -> { have_at_least_one_job.
scope :industry_list, -> { availble_job.
order(jobs_count: :desc) }
scope :have_at_least_one_job, -> { where('jobs_count > 0')}
scope :availble_job, -> { where('jobs_count > 0')}
end
......@@ -9,6 +9,8 @@ class Job < ApplicationRecord
has_many :cities_jobs
has_many :cities, through: :cities_jobs
scope :top_list, -> { order(updated_date: :desc).limit(Settings.top.job_per_page) }
def self.create_new_jobs(arr_jobs)
arr_jobs.each do |item|
city_names = []
......
class Settings < Settingslogic
source "#{Rails.root}/config/application.yml"
namespace Rails.env
end
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('../../js/transition.js')
require('../../js/alert.js')
require('../../js/button.js')
require('../../js/carousel.js')
require('../../js/collapse.js')
require('../../js/dropdown.js')
require('../../js/modal.js')
require('../../js/tooltip.js')
require('../../js/popover.js')
require('../../js/scrollspy.js')
require('../../js/tab.js')
require('../../js/affix.js')
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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