connect link for industry and city

parent e3119670
......@@ -5,6 +5,7 @@ class JobsController < ApplicationController
@total_job = Job.count
@jobs_list = Job.all_job.page(params[:page]).per(20)
end
def city_jobs
@cities = City.all
@industries = Industry.all
......@@ -13,4 +14,13 @@ class JobsController < ApplicationController
@total_job = Job.count
@result_for_job = @city.jobs.count
end
def industry_jobs
@cities = City.all
@industries = Industry.all
@industry = Industry.find(params[:id])
@jobs_list = @industry.jobs.all_job.page(params[:page]).per(20)
@total_job = Job.count
@result_for_job = @industry.jobs.count
end
end
<div class="col-3 remove-decoration">
<%= link_to '#' do %>
<%= link_to city_jobs_path(city.id) do %>
<div class="border border-dark rounded international-name">
<div>
<strong><%= city.name %></strong>
......
<div class="col-3 remove-decoration">
<%= link_to '#' do %>
<%= link_to industry_jobs_path(industry.id) do %>
<div class="border border-dark rounded industry-details">
<div>
<strong><%= industry.name %></strong>
......
......@@ -3,12 +3,12 @@
<div class="job-details">
<div class="title"><strong><%= job.title %></strong></div>
<div class="row">
<div class="col-4">
<div class="col-6">
<% job.cities.each do |city| %>
<%= city.name %>
<% end %>
</div>
<div class="col-4 salary">Salary: <%= job.salary %></div>
<div class="col-4 salary">💲 Salary: <%= job.salary %></div>
<div class="col-10 introduction">
<%= job_description(job.description) %><br>
<%= link_to 'Read more..', '#'%>
......
<% provide(:title, 'Jobs') %>
<% provide(:title, 'City Jobs') %>
<div class="container">
<div class="search-bar">
<%= render 'layouts/search_bar' %>
......
<% provide(:title, 'Industry Jobs') %>
<div class="container">
<div class="search-bar">
<%= render 'layouts/search_bar' %>
</div>
<div class="row total-jobs">
<div class="col-4">Total: <%= @total_job %> jobs</div>
<div class="col-4">Result for: <%= @result_for_job %> jobs</div>
</div>
<%= render "jobs/pagination" %>
<div class="job-list">
<%= render partial: "all_jobs", collection: @jobs_list, as: :job %>
</div>
<%= render "jobs/pagination" %>
</div>
<div class="col-4">
<div class="row-table border border-dark rounded city-list">
<%= link_to "#{city_jobs_path}/cities/#{city.id}" do %>
<%= link_to city_jobs_path(city.id) do %>
<div class="city-name"><strong><%= city.name %></strong></div>
<div class="count-job"><%= city.jobs.count %></div>
<% end %>
......
<div class="col-4">
<div class="row-table border border-dark rounded industry-list">
<%= link_to '#' do %>
<%= link_to industry_jobs_path(industry.id) do %>
<div class="industry-name"><strong><%= industry.name %></strong></div>
<div class="count-job"><%= industry.jobs.count %></div>
<% end %>
......
......@@ -3,7 +3,7 @@
<div class="job-details">
<div class="title"><strong><%= job.title %></strong></div>
<div><%= job.company_name %></div>
<div class="salary">Salary: <%= job.salary %></div>
<div class="salary">💲 Salary: <%= job.salary %></div>
<div>
<% job.cities.each do |city| %>
<%= city.name %>
......
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :jobs
get 'jobs/cities/:id', to: 'jobs#city_jobs'
get 'jobs/cities/:id', to: 'jobs#city_jobs', as: :city_jobs
get 'jobs/industries/:id', to: 'jobs#industry_jobs', as: :industry_jobs
resources :top_pages
resources :industries
......
......@@ -9,9 +9,9 @@ namespace :import do
end
desc 'Crontab'
task auto: :environment do
crontab = JobParser.new(logger, url)
parser = JobParser.new(logger, url)
csv_importer = CSVImporter.new(logger)
crontab.crawl_all
parser.crawl_all
csv_importer.import
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