Commit a18a5d62 by Đường Sỹ Hoàng

Fixed scss& import_csv

parent c0d06082
/* universal */ /* universal */
$font-stack: Arial,Helvetica, sans-serif;
$primary-color: #B6B6B6;
$sub-color: gainsboro;
body { body {
margin: 0; margin: 0;
font-family: Arial, Helvetica, sans-serif; font-family: $font-stack;
} }
/* typography */ /* typography */
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
line-height: 1; line-height: 1;
} h1 {
h1 {
font-size: 3em; font-size: 3em;
letter-spacing: -2px; letter-spacing: -2px;
margin-bottom: 30px; margin-bottom: 30px;
text-align: center; text-align: center;
} }
h2 {
h2 {
font-size: 1.2em; font-size: 1.2em;
letter-spacing: -1px; letter-spacing: -1px;
margin-bottom: 30px; margin-bottom: 30px;
text-align: center; text-align: center;
font-weight: normal; font-weight: normal;
color: #777; }
}
p {
font-size: 1.1em;
line-height: 1.7em;
} }
/* header */ /* header */
...@@ -39,59 +35,40 @@ p { ...@@ -39,59 +35,40 @@ p {
width: 50%; width: 50%;
} }
#logo:hover {
color: #fff;
text-decoration: none;
}
#banner { #banner {
width: 100%; width: 100%;
padding: 0px; padding: 0px;
} }
.inverse { .btn-outline-success {
overflow: hidden; color: $sub-color;
background-color: gray; border-color:blue;
} background: #01548c;
ul {
float: right;
list-style: none;
list-style-type: none;
margin: 0;
padding: 0;
width: 100px;
background-color: whitesmoke;
} }
li { .count-total {
float: left; margin-right: 500px;
color: black;
text-align: center;
padding: 12px;
text-decoration: none;
font-size: 18px;
line-height: 25px;
border-radius: 4px;
} }
li.btn-navbar { .col {
display: block; padding: 5px;
padding: 10px 10px; margin: 5px;
background-color: $primary-color;
} }
li.btn-navbar:hover { .row {
background-color: aquamarine; padding: 5px;
text-decoration: none; margin: 5px;
text-align: center; background-color: $sub-color;
} }
.Job {
display: block; .col-sm {
margin: 5px;
padding: 5px;
background-color: $primary-color;
} }
div.col { .form-inline-city {
border: solid 1px; margin-left: 1000px;
padding: 10px; padding: 5px;
margin: 10px;
background-color: gainsboro;
} }
class JobsController < ApplicationController class JobsController < ApplicationController
def index def home
@latest_jobs = Job.latest_city.take(5) @latest_jobs = Job.latest_jobs.take(5)
@top_cities = City.sort_top_cities.take(9) @top_cities = City.sort_top_cities.take(9)
end end
end end
...@@ -3,10 +3,10 @@ class City < ApplicationRecord ...@@ -3,10 +3,10 @@ class City < ApplicationRecord
has_many :jobs, through: :city_jobs has_many :jobs, through: :city_jobs
def self.sort_top_cities def self.sort_top_cities
@cities||= all.sort_by(&:jobs_count).reverse @cities ||= all.sort_by(&:jobs_count).reverse
end end
def jobs_count def jobs_count
@jobs_count = jobs.count @jobs_count ||= jobs.count
end end
end end
...@@ -2,7 +2,7 @@ class Job < ApplicationRecord ...@@ -2,7 +2,7 @@ class Job < ApplicationRecord
has_many :user_jobs has_many :user_jobs
has_many :city_jobs has_many :city_jobs
def self.latest_city def self.latest_jobs
@latest = Job.order(created_at: :desc) @latest = Job.order(created_at: :desc)
end end
end end
<div class="col-md-3"> <div class="container">
<div class="col"><h5><%= city.name %>(<%= city.jobs.count %>)</h5></div> <div class="row justify-content-md-center">
<div class="col-sm">
<%= city.name %>
(<%= city.jobs.count %>)
</div>
</div>
</div> </div>
<div class="row align-items-center"> <div class="row align-items-center">
<div class="col"> <div class="col">
<h5><%= job.title %></h5> <%= job.title %>
</div> </div>
</div> </div>
</br> </br>
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
<title><%= yield(:title) %> Venjob</title> <title><%= yield(:title) %> Venjob</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
</head> </head>
</div>
<h4 class="count-total">Total Jobs:<%= Job.count %></h4>
<!-- List of latest jobs--> <!-- List of latest jobs-->
<div class="Job list"> <div class="Job list">
<div class="Job-title-wrapper"> <div class="Job-title-wrapper">
...@@ -15,14 +17,17 @@ ...@@ -15,14 +17,17 @@
</div> </div>
</br> </br>
<!--List of top cities--> <!--List of top cities-->
<div class="City list"> <div class="City list">
<div class="City-title-wrapper"> <div class="City-title-wrapper">
<h3>Top Cities</h3> <h3>Top Cities</h3>
</div> </div>
<div class="City-content-wrapper"> <div class="City-content-wrapper">
<div class="row row-cols-3"> <div class="row row-cols-3">
<%= render partial: "cities/city", collection: @top_cities %> <%= render partial: "cities/city", collection: @top_cities %>
<form class="form-inline-city">
<button class="btn btn-outline-success" type="button">All cities</button>
</form>
</div>
</div> </div>
</div> </div>
</div>
</div> </div>
<header class="navbar navbar-fixed-top navbar-inverse"> <header class="navbar navbar-fixed-top navbar-inverse">
<div class="container"> <div class="container">
<%= link_to image_tag("zigexn_logo.png", id: "logo", alt: "Venjob logo") %> <%= link_to image_tag("zigexn_logo.png", id: "logo", alt: "Venjob logo") %>
<nav> <nav class="navbar navbar-light bg-light">
<ul> <form class="form-inline">
<li class="btn-navbar"><%=link_to "Login", '#' %></li> <button class="btn btn-outline-success" type="button">Login</button>
<li class="btn-navbar"><%=link_to "Register", '#' %></li> <button class="btn btn-outline-success" type="button">Register</button>
</ul> <button class="btn btn-outline-success" type="button">Favorite</button>
<ul> <button class="btn btn-outline-success" type="button">History</button>
<ul> </form>
<li class="btn-navbar"><%=link_to "Favorite", '#' %></li>
<li class="btn-navbar"><%=link_to "History", '#' %></li>
</ul>
</nav> </nav>
<%= link_to image_tag("banner.jpg", id: "banner", alt: "Venjob banner") %> <%= link_to image_tag("banner.jpg", id: "banner", alt: "Venjob banner") %>
</div> </div>
......
Rails.application.routes.draw do Rails.application.routes.draw do
root "jobs#index" root "jobs#home"
resource :jobs resource :jobs
devise_for :users devise_for :users
end end
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -22,8 +22,8 @@ require "csv" ...@@ -22,8 +22,8 @@ require "csv"
job = Job.find_or_initialize_by(title: row["name"], company_id: company.id) job = Job.find_or_initialize_by(title: row["name"], company_id: company.id)
job.update(job_params) job.update(job_params)
city_params = { region: row["company province"] } city_params = { region: row["work place"] }
city = City.find_or_initialize_by(name: row["work place"]) city = City.find_or_initialize_by(name: row["company province"])
city.update(city_params) city.update(city_params)
city_job_params = { city_id: city.id } city_job_params = { city_id: city.id }
city_job = CityJob.find_or_initialize_by(job_id: job.id) city_job = CityJob.find_or_initialize_by(job_id: job.id)
......
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