-
changed title from First commit to Feature/city_list/first commit
Toggle commit list -
changed the description
Toggle commit list -
1 1 class TopController < ApplicationController 2 2 def index 3 @latest_jobs = Job.latest_jobs.take(Settings.top.job.limit) 4 @top_cities = City.sort_top_cities.take(Settings.top.city.limit) 5 @top_industries = Industry.sort_top_industries.take(Settings.top.industry.limit) 3 @latest_jobs = Job.latest_jobs 4 @top_cities = City.sort_top_cities 5 @top_industries = Industry.sort_top_industries 6 end 7 8 def cities -
Master
viết thành hàm index của city controller
-
-
-
1 1 Rails.application.routes.draw do 2 2 root "top#index" 3 get "/cities", to: "top#cities" -
Master
sử dụng resources cities
-
-
-
app/views/top/cities.html.erb 0 → 100644
1 <div class="center jumbotron"> 2 <head> 3 <title><%= yield(:title) %> Venjob</title> 4 <meta name="viewport" content="width=device-width, initial-scale=1"> -
Master
phần này viết vào header của layout
-
-
-
3 3 has_many :jobs, through: :city_jobs 4 4 5 5 def self.sort_top_cities 6 @cities ||= all.sort_by(&:jobs_count).reverse 6 @cities ||= all.sort_by(&:jobs_count).reject{ |city| city.jobs_count ==0 }.reverse.take(Settings.top.city.limit) -
Master
sử dụng
zero?khi so sánh với 0 -
-
-
1 1 class TopController < ApplicationController 2 2 def index 3 @latest_jobs = Job.latest_jobs.take(Settings.top.job.limit) 4 @top_cities = City.sort_top_cities.take(Settings.top.city.limit) 5 @top_industries = Industry.sort_top_industries.take(Settings.top.industry.limit) 3 @latest_jobs = Job.latest_jobs 4 @top_cities = City.sort_top_cities 5 @top_industries = Industry.sort_top_industries 6 end 7 8 def cities 9 @top_cities = City.sort_top_cities -
Master
tách thành 2 biến, 1 là city của VN, 1 là city của quốc tế
-
-
-
1 <div class="container"> 2 <div class="row justify-content-md-center"> 3 <div class="col-sm"> 4 </div> -
Master
lúc có data thì nó sẽ hiển thị như thế nào ở đây
-
-
-
1 1 <div class="row align-items-center"> 2 2 <div class="col"> 3 <%= job.title %> 3 <div class="text-center"><%= job.title %></div> -
Master
thêm
text-centervào div bên ngoài, k cần tạo thêm div -
-
-
1 1 <div class="container"> 2 2 <div class="row justify-content-md-center"> 3 <div class="col-sm"> 4 <%= industry.name %> 5 (<%= industry.jobs.count %>) 3 <div class="col"> 4 <div class="text-center"> -
Master
thêm
text-centervào div bên ngoài, k cần tạo thêm div -
-
-
app/views/cities/_cities_list.html.erb 0 → 100644
1 <div class="container"> 2 <div class="row justify-content-md-center"> 3 <div class="col-sm"> 4 <div class="text-center"> -
Master
thêm
text-centervào div bên ngoài, k cần tạo thêm div -
-
-
1 1 <div class="container"> 2 2 <div class="row justify-content-md-center"> 3 <div class="col-sm"> 4 <%= city.name %> 5 (<%= city.jobs.count %>) 3 <div class="col"> 4 <div class="text-center"> -
Master
thêm
text-centervào div bên ngoài, k cần tạo thêm div -
-
-
-
-
changed title from Feature/city_list/first commit to Feature/city_list/Updated city list
Toggle commit list -
changed the description
Toggle commit list -
app/controllers/cities_controller.rb 0 → 100644
1 class CitiesController < ApplicationController 2 def index 3 @top_vn_cities = City.sort_top_vn_cities 4 @top_inter_cities = City.sort_top_inter_cities 5 end 6 7 def vn_cities 8 @top_vn_cities = City.sort_top_vn_cities 9 end 10 11 def inter_cities 12 @top_inter_cities = City.sort_top_inter_cities 13 end -
Toggle commit list
-
-
3 3 has_many :jobs, through: :city_jobs 4 4 5 5 def self.sort_top_cities 6 @cities ||= all.sort_by(&:jobs_count).reverse 6 @cities ||= all.sort_by(&:jobs_count).reject{ |city| city.jobs_count.zero? }.reverse.take(Settings.top.city.limit) 7 end 8 9 def self.sort_top_vn_cities 10 @vn_cities ||= City.where(region: 0).sort_by(&:jobs_count).reject{ |city| city.jobs_count.zero? }.reverse.take(Settings.top.city.limit) -
Master
where(region: 0)ko cần City -
-
-
1 require 'test_helper' 2 3 class IndustriesControllerTest < ActionDispatch::IntegrationTest 4 # test "the truth" do 5 # assert true -
Master
xóa file này
-
-
-
test/controllers/city_controller_test.rb 0 → 100644
1 require 'test_helper' 2 3 class CityControllerTest < ActionDispatch::IntegrationTest -
Master
xóa file này
-
-
-
app/assets/stylesheets/city.scss 0 → 100644
1 // Place all the styles related to the city controller here. 2 // They will automatically be included in application.css. -
Master
xóa file này
-
-
-
app/assets/stylesheets/industries.scss 0 → 100644
1 // Place all the styles related to the Industries controller here. -
Master
xóa file này
-
-
-
-
3 3 has_many :jobs, through: :city_jobs 4 4 5 5 def self.sort_top_cities 6 @cities ||= all.sort_by(&:jobs_count).reverse 6 @cities ||= all.sort_by(&:jobs_count).reject{ |city| city.jobs_count.zero? }.reverse.take(Settings.top.city.limit) -
3 3 has_many :jobs, through: :city_jobs 4 4 5 5 def self.sort_top_cities 6 @cities ||= all.sort_by(&:jobs_count).reverse 6 @cities ||= all.sort_by(&:jobs_count).reject{ |city| city.jobs_count.zero? }.reverse.take(Settings.top.city.limit) 7 end 8 9 def self.sort_top_vn_cities 10 @vn_cities ||= where(region: 0).sort_by(&:jobs_count).reject{ |city| city.jobs_count.zero? }.reverse.take(Settings.top.city.limit) -
-
-
1 1 Rails.application.routes.draw do 2 2 root "top#index" 3 resources :cities, only: :index 4 resources :industries, only: :index 5 resources :login, only: :index -
Master
remove
-
-
-
3 3 <%= link_to image_tag("zigexn_logo.png", id: "logo", alt: "Venjob logo") %> 4 4 <nav class="navbar navbar-light bg-light"> 5 5 <form class="form-inline"> 6 <button class="btn btn-outline-success" type="button">Login</button> 6 <%= link_to "Login", login_index_path, class:"btn btn-outline-success" %> -
Master
để lại như cũ
-
-
-
-
merged
Toggle commit list
