Commit efd46ea4 by Thanh Hung Pham

Merge branch 'page-ID1' into 'master'

create top page ID1

See merge request !3
parents 56fee0d7 1e120c04
Pipeline #1371 failed with stages
in 0 seconds
...@@ -7,8 +7,7 @@ ruby '3.0.1' ...@@ -7,8 +7,7 @@ ruby '3.0.1'
gem 'rails', '~> 6.1.3', '>= 6.1.3.2' gem 'rails', '~> 6.1.3', '>= 6.1.3.2'
gem 'bootstrap', '~> 5.0.1' gem 'bootstrap', '~> 5.0.1'
gem 'nokogiri', '~> 1.11', '>= 1.11.7' gem 'nokogiri', '~> 1.11', '>= 1.11.7'
gem 'slim-rails'
# Use sqlite3 as the database for Active Record # Use sqlite3 as the database for Active Record
gem 'mysql2', '~> 0.5.3' gem 'mysql2', '~> 0.5.3'
# Use Puma as the app server # Use Puma as the app server
......
...@@ -169,6 +169,13 @@ GEM ...@@ -169,6 +169,13 @@ GEM
childprocess (>= 0.5, < 4.0) childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2) rubyzip (>= 1.2.2)
semantic_range (3.0.0) semantic_range (3.0.0)
slim (4.1.0)
temple (>= 0.7.6, < 0.9)
tilt (>= 2.0.6, < 2.1)
slim-rails (3.3.0)
actionpack (>= 3.1)
railties (>= 3.1)
slim (>= 3.0, < 5.0)
spring (2.1.1) spring (2.1.1)
sprockets (4.0.2) sprockets (4.0.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
...@@ -177,6 +184,7 @@ GEM ...@@ -177,6 +184,7 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
temple (0.8.2)
thor (1.1.0) thor (1.1.0)
tilt (2.0.10) tilt (2.0.10)
turbolinks (5.2.1) turbolinks (5.2.1)
...@@ -224,6 +232,7 @@ DEPENDENCIES ...@@ -224,6 +232,7 @@ DEPENDENCIES
rails (~> 6.1.3, >= 6.1.3.2) rails (~> 6.1.3, >= 6.1.3.2)
sass-rails (>= 6) sass-rails (>= 6)
selenium-webdriver selenium-webdriver
slim-rails
spring spring
turbolinks (~> 5) turbolinks (~> 5)
tzinfo-data tzinfo-data
......
@import "bootstrap";
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700&display=swap');
/* header */
#logo {
float: left;
margin-right: 10px;
margin-left: 80px;
padding-top: 10px;
padding-bottom: 10px;
}
.navbar ul li a {
color: #fff;
font-size: 18px;
font-weight: bold;
padding: 4px 15px;
text-decoration: none;
&:hover {
color: rgb(107, 107, 107);
text-decoration: none;
}
}
.container p {
font-weight: 400;
font-size: medium;
}
a {
color: rgb(14, 14, 14);
text-decoration: none;
&:hover {
color: orange;
}
}
.more {
color: rgb(52, 119, 219);
text-align: right;
font-weight: 500;
font-size: 20px;
}
\ No newline at end of file
class TopController < ApplicationController
def home
@jobs = Job.latest_jobs
@cities = City.top_cities
@industries = Industry.top_industries
@total_job = Job.all.count
end
end
...@@ -2,4 +2,6 @@ class City < ApplicationRecord ...@@ -2,4 +2,6 @@ class City < ApplicationRecord
belongs_to :region belongs_to :region
has_and_belongs_to_many :jobs has_and_belongs_to_many :jobs
has_and_belongs_to_many :companies has_and_belongs_to_many :companies
end LATEST_CITY_NUMBER = 9
scope :top_cities, -> { joins(:jobs).group(:name).order('count_all DESC').count.take(LATEST_CITY_NUMBER) }
end
\ No newline at end of file
class Industry < ApplicationRecord class Industry < ApplicationRecord
has_and_belongs_to_many :jobs has_and_belongs_to_many :jobs
end LATEST_INDUSTRY_NUMBER = 9
scope :top_industries, -> { joins(:jobs).group(:name).order('count_all DESC').count.take(LATEST_INDUSTRY_NUMBER) }
end
\ No newline at end of file
...@@ -5,4 +5,6 @@ class Job < ApplicationRecord ...@@ -5,4 +5,6 @@ class Job < ApplicationRecord
has_many :history_jobs has_many :history_jobs
has_and_belongs_to_many :industries has_and_belongs_to_many :industries
has_and_belongs_to_many :cities has_and_belongs_to_many :cities
end LATEST_JOB_NUMBER = 5
scope :latest_jobs, -> { includes(:cities, :company).order('created_at DESC').limit(LATEST_JOB_NUMBER) }
end
\ No newline at end of file
footer.text-center.text-lg-start.bg-dark.text-muted
section.d-flex.justify-content-center.justify-content-lg-between.p-4.border-bottom
.me-5.d-none.d-lg-block
span
| Get connected with me on social networks:
div
a.me-4.text-reset[href=""]
i.fab.fa-facebook-f
a.me-4.text-reset[href=""]
i.fab.fa-twitter
a.me-4.text-reset[href=""]
i.fab.fa-google
a.me-4.text-reset[href=""]
i.fab.fa-instagram
a.me-4.text-reset[href=""]
i.fab.fa-linkedin
a.me-4.text-reset[href=""]
i.fab.fa-github
section
.container.text-center.text-md-start.mt-5
.row.mt-3
.col-md-3.col-lg-4.col-xl-3.mx-auto.mb-4
h6.text-uppercase.fw-bold.mb-4
i.fas.fa-gem.me-3
| Name
p
| NGUYỄN HOÀNG MAI PHƯƠNG
.col-md-2.col-lg-2.col-xl-2.mx-auto.mb-4
h6.text-uppercase.fw-bold.mb-4
| SCHOOL
p
a.text-reset[href="#!"]
| Banking University
.col-md-3.col-lg-2.col-xl-2.mx-auto.mb-4
h6.text-uppercase.fw-bold.mb-4
| MAJOR
p
a.text-reset[href="#!"]
| MIS
.col-md-4.col-lg-3.col-xl-3.mx-auto.mb-md-0.mb-4
h6.text-uppercase.fw-bold.mb-4
| Contact
i.fas.fa-envelope.me-3
| phuongnhm@zigenxn.vn
header
nav.navbar.navbar-expand-lg.navbar-light.bg-dark
.container-fluid
= image_tag "logo.png", alt: "logo", id: "logo"
#navbarExample01.collapse.navbar-collapse
ul.navbar-nav.ms-auto.mb-2.mb-lg-0
li.nav-item.active
= link_to "Login", '#'
li.nav-item
= link_to "Sign up", '#'
li.nav-item
= link_to "Favourite", '#'
li.nav-item
= link_to "History", '#'
<!DOCTYPE html>
<html>
<head>
<title>VeNJOB</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
<body>
<%= yield %>
</body>
</html>
doctype html
html
head
title
= yield(:title)
| | VeNJOB
meta[name="viewport" content="width=device-width,initial-scale=1"]
= csrf_meta_tags
= csp_meta_tag
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'
link[rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"]
body.bg-light
= render 'layouts/header'
.container
= yield
= render 'layouts/footer'
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<%= yield %>
</body>
</html>
doctype html
html
head
meta[http-equiv="Content-Type" content="text/html; charset=utf-8"]
style
| /* Email styles need to be inline */
body
= yield
- provide :title, 'Jobs'
h3.p-2
| Total:
= pluralize(@total_job, 'job')
.container
.input-group.py-3
input.form-control.rounded[type="search" placeholder="Search" aria-label="Search" aria-describedby="search-addon"]
button.btn.btn-outline-primary[type="button"]
| Search
h4.py-4
| Latest Jobs
- @jobs.each do |job|
.card.my-3
.card-body.text-dark
h5.mb-1
= link_to job.title, "#"
p.mb-1
= link_to job.company.name, "#"
p.mb-1
i.fas.fa-dollar-sign.m-1
| Lương:
= job.salary
p.mb-1
i.fas.fa-map-marker-alt.m-1
= link_to job.cities.map(&:name).join(', '), "#"
h4
| Top Cities
.row.my-3.text-center.fs-5
- @cities.each do |name, amount|
.col-4.p-2.border.mb-1.fw-normal
= link_to name, "#"
p.mb-1
= amount
.d-flex.flex-row-reverse.
= link_to 'All Cities', "#", class: "more"
h4
| Top Industries
.row.my-3.text-center.fs-5
- @industries.each do |name, amount|
.col-4.p-2.border.mb-1.fw-normal
= link_to name, "#"
p.mb-1
= amount
.d-flex.flex-row-reverse
= link_to 'All Industries', "#", class: "more"
\ No newline at end of file
Rails.application.routes.draw do Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html root 'top#home'
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