Commit b73cf713 by Hoang Phuc Do

Merge branch 'citylist' into 'master'

create ID2

See merge request !5
parents 5131650d 29876198
Pipeline #795 failed with stages
in 0 seconds
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
// Place all the styles related to the industry controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
# frozen_string_literal: true
# City controller
class CityController < ApplicationController
def index
@list_cities_domestic = City.domestic
@list_cities_international = City.international
end
end
# frozen_string_literal: true
# Industry controller
class IndustryController < ApplicationController
def index
@industries = Industry.all
end
end
# frozen_string_literal: true
# Job controller
class JobController < ApplicationController
end
module CityHelper
end
module IndustryHelper
end
......@@ -5,6 +5,8 @@ class City < ApplicationRecord
RANGE = 69
has_many :city_jobs
has_many :jobs, through: :city_jobs
scope :domestic, -> { where(area: 1) }
scope :international, -> { where(area: 0) }
scope :all_cities, -> { select :id, :name }
scope :top_cities, ->(number) do joins(:jobs)
.group(:city_id)
......
<% unless city.jobs.count < 1 %>
<div class="col-lg-3 col-md-4">
<div class="box_cityjobs">
<div class="box_cityjobs_name">
<%= link_to city.name, '#', class: 'cityjobs_link' %>
</div>
<div class="box_cityjobs_count">
<span><%= city.jobs.count %> Công việc</span>
</div>
</div>
</div>
<% end %>
<% provide(:title, 'Top thành phố') %>
<%= render 'shared/scroll_top' %>
<div class="container">
<div class="box_option_location">
<div class="icon_box_option_location">
<span class="kl_icon_box_option_location">
<i class="fas fa-search-location"></i>
</span>
</div>
<div class="row">
<div class="col-lg-12">
<div class="box_option_location_header">
<span>Bạn muốn tìm việc trong hay ngoài nước?</span>
</div>
</div>
<div class="col-lg-6">
<button class="btn_option_location btn_option_location-vn">Việt Nam</button>
</div>
<div class="col-lg-6">
<button class="btn_option_location btn_option_location-qt">Nước ngoài</button>
</div>
</div>
</div>
</div>
<!-- Main -->
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="title_list_city title_list_city_vn">
<span>Các tỉnh, thành phố thuôc Việt Nam</span>
</div>
</div>
<div class="container">
<div class="row">
<%= render partial: 'block_city_jobs', collection: @list_cities_domestic, as: :city %>
</div>
</div>
<div class="col-lg-12">
<div class="title_list_city title_list_city_qt">
<span>Quốc tế</span>
</div>
</div>
<div class="container">
<div class="row">
<%= render partial: 'block_city_jobs', collection: @list_cities_international, as: :city %>
</div>
</div>
</div>
</div>
......@@ -19,7 +19,7 @@
<div class="col-lg-12">
<div class="box_info_city">
<div class="ct_name">
<%= link_to 'Xem Thêm', '#', class: 'link_ct' %>
<%= link_to 'Xem Thêm', city_index_path, class: 'link_ct' %>
</div>
<div class="ct_jobs_count">
<i class="fas fa-ellipsis-h"></i>
......
......@@ -19,7 +19,7 @@
<div class="col-lg-12">
<div class="box_info_city">
<div class="ct_name">
<%= link_to 'Xem Thêm', '#', class: 'link_ct' %>
<%= link_to 'Xem Thêm', industry_index_path, class: 'link_ct' %>
</div>
<div class="ct_jobs_count">
<i class="fas fa-ellipsis-h"></i>
......
<div class="col-lg-3 col-md-4">
<div class="box_cityjobs">
<div class="box_cityjobs_name">
<%= link_to industry.name, '#', class: 'cityjobs_link' %>
</div>
<div class="box_cityjobs_count">
<span><%= industry.jobs.count %> Công việc</span>
</div>
</div>
</div>
<% provide(:title, 'Top nghành') %>
<%= render 'shared/scroll_top' %>
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="title_list_city title_list_city_vn">
<span>Top nghành</span>
</div>
</div>
<div class="container">
<div class="row">
<%= render partial: 'block_industry', collection: @industries, as: :industry %>
</div>
</div>
</div>
</div>
Rails.application.routes.draw do
root 'home#index'
get 'industry/index'
get 'city/index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
require 'test_helper'
class CityControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get city_index_url
assert_response :success
end
end
require 'test_helper'
class IndustryControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get industry_index_url
assert_response :success
end
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