Commit b0c92715 by thanhnd

top page finished

parent 1ec2db23
Pipeline #473 failed with stages
in 0 seconds
File added
...@@ -31,6 +31,8 @@ gem 'jbuilder', '~> 2.7' ...@@ -31,6 +31,8 @@ gem 'jbuilder', '~> 2.7'
# Reduces boot times through caching; required in config/boot.rb # Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false gem 'bootsnap', '>= 1.4.2', require: false
gem 'sprockets', '~> 3.7.2'
group :development, :test do group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
......
...@@ -61,7 +61,7 @@ GEM ...@@ -61,7 +61,7 @@ GEM
autoprefixer-rails (9.7.4) autoprefixer-rails (9.7.4)
execjs execjs
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.4.5) bootsnap (1.4.6)
msgpack (~> 1.0) msgpack (~> 1.0)
bootstrap (4.4.1) bootstrap (4.4.1)
autoprefixer-rails (>= 9.1.0) autoprefixer-rails (>= 9.1.0)
...@@ -153,7 +153,7 @@ GEM ...@@ -153,7 +153,7 @@ GEM
rb-fsevent (0.10.3) rb-fsevent (0.10.3)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
regexp_parser (1.6.0) regexp_parser (1.7.0)
ruby_dep (1.5.0) ruby_dep (1.5.0)
rubyzip (2.2.0) rubyzip (2.2.0)
sass-rails (6.0.0) sass-rails (6.0.0)
...@@ -173,7 +173,7 @@ GEM ...@@ -173,7 +173,7 @@ GEM
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0) spring (>= 1.2, < 3.0)
sprockets (4.0.0) sprockets (3.7.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.1) sprockets-rails (3.2.1)
...@@ -227,6 +227,7 @@ DEPENDENCIES ...@@ -227,6 +227,7 @@ DEPENDENCIES
selenium-webdriver selenium-webdriver
spring spring
spring-watcher-listen (~> 2.0.0) spring-watcher-listen (~> 2.0.0)
sprockets (~> 3.7.2)
sqlite3 (~> 1.4) sqlite3 (~> 1.4)
turbolinks (~> 5) turbolinks (~> 5)
tzinfo-data tzinfo-data
......
...@@ -2,6 +2,10 @@ class ToppageController < ApplicationController ...@@ -2,6 +2,10 @@ class ToppageController < ApplicationController
def index def index
@totaljob = Job.all.count @totaljob = Job.all.count
@latestjobs = Job.order(:last_updated).first(5) @latestjobs = Job.order(:last_updated).first(5)
#@topindustry = Industry.where(INNER JOIN Job ON Job.industry_id = Industry.id).count(industry_name).order("orders_count DESC") @topindustry = Industry.joins(:jobs).select('industries.*, COUNT(jobs.id) as jobcount').group('jobs.industry_id').order(:jobcount).last(9)
@topcity = City.joins(:jobs).select('cities.*, COUNT(jobs.id) as jobcount').group('jobs.city_id').order(:jobcount).last(9)
end end
end end
...@@ -5,13 +5,17 @@ ...@@ -5,13 +5,17 @@
</div> </div>
<div id="search" class="container p-5 my-2 bg-secondary text-white"> <div id="search" class="container p-5 my-2 bg-secondary text-white">
<!-- Search form -->
<form class="form-inline md-form mr-auto mb-4">
<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-warning btn-rounded btn-sm my-0" type="submit">Search</button>
</form>
</div> </div>
<div id="latestjobs"class="container p-5 my-2 bg-secondary text-white"> <div id="latestjobs"class="container p-5 my-2 bg-secondary text-white">
<font color="red"><b><label > Latest Jobs:</label></b></font> <font color="red"><b><label > Latest Jobs:</label></b></font>
<% @latestjobs.each do |j| %> <% @latestjobs.each do |j| %>
<ul> <ul>
<li><%= j.job_name %></li> <li><%= j.job_name %></li>
...@@ -21,24 +25,25 @@ ...@@ -21,24 +25,25 @@
<li ><span class="text"><%= j.description %></span></li> <li ><span class="text"><%= j.description %></span></li>
</ul> </ul>
<% end %> <% end %>
</div> </div>
<div id="topcity" class="container p-5 my-2 bg-secondary text-white"> <div id="topcity" class="container p-5 my-2 bg-secondary text-white">
<font color="red"><b><label > Top Cities:</label></b></font> <font color="red"><b><label > Top Cities:</label></b></font>
<% @topcity.each do |j| %>
<ul>
<li><%= j.city_name %></li>
</ul>
<% end %>
</div> </div>
<div id="topindustry" class="container p-5 my-2 bg-secondary text-white">
<font color="red"><b><label > Top Industries:</label></b></font>
<div id="topindustry" class="container p-5 my-2 bg-secondary text-white">
<font color="red"><b><label > Top Industry:</label></b></font>
<% @topindustry.each do |j| %>
<ul>
<li><%= j.industry_name %></li>
</ul>
<% end %>
</div> </div>
</div>
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"@rails/ujs": "^6.0.0", "@rails/ujs": "^6.0.0",
"@rails/webpacker": "4.2.2", "@rails/webpacker": "4.2.2",
"bootstrap": "^4.4.1", "bootstrap": "^4.4.1",
"bootstrapp": "^0.0.0",
"jquery": "^3.4.1", "jquery": "^3.4.1",
"popper.js": "^1.16.1", "popper.js": "^1.16.1",
"turbolinks": "^5.2.0" "turbolinks": "^5.2.0"
......
...@@ -1391,6 +1391,15 @@ bootstrap@^4.4.1: ...@@ -1391,6 +1391,15 @@ bootstrap@^4.4.1:
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.4.1.tgz#8582960eea0c5cd2bede84d8b0baf3789c3e8b01" resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.4.1.tgz#8582960eea0c5cd2bede84d8b0baf3789c3e8b01"
integrity sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA== integrity sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA==
bootstrapp@^0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/bootstrapp/-/bootstrapp-0.0.0.tgz#5e2edd782ab7bc9addfadf412835e60c43221076"
integrity sha1-Xi7deCq3vJrd+t9BKDXmDEMiEHY=
dependencies:
erros "0.0.1"
express "^4.8.8"
middle-earth "0.0.6"
brace-expansion@^1.1.7: brace-expansion@^1.1.7:
version "1.1.11" version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
...@@ -2558,6 +2567,13 @@ error-ex@^1.2.0, error-ex@^1.3.1: ...@@ -2558,6 +2567,13 @@ error-ex@^1.2.0, error-ex@^1.3.1:
dependencies: dependencies:
is-arrayish "^0.2.1" is-arrayish "^0.2.1"
erros@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/erros/-/erros-0.0.1.tgz#f5de1b3d5e90088bff231a52241cedb04ed8ebcf"
integrity sha1-9d4bPV6QCIv/IxpSJBztsE7Y688=
dependencies:
express "^4.1.1"
es-abstract@^1.17.0-next.1, es-abstract@^1.17.2: es-abstract@^1.17.0-next.1, es-abstract@^1.17.2:
version "1.17.4" version "1.17.4"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.4.tgz#e3aedf19706b20e7c2594c35fc0d57605a79e184" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.4.tgz#e3aedf19706b20e7c2594c35fc0d57605a79e184"
...@@ -2687,7 +2703,7 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2: ...@@ -2687,7 +2703,7 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2:
dependencies: dependencies:
homedir-polyfill "^1.0.1" homedir-polyfill "^1.0.1"
express@^4.17.1: express@^4.0.0, express@^4.1.1, express@^4.17.1, express@^4.8.8:
version "4.17.1" version "4.17.1"
resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134"
integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==
...@@ -4242,6 +4258,13 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: ...@@ -4242,6 +4258,13 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4:
snapdragon "^0.8.1" snapdragon "^0.8.1"
to-regex "^3.0.2" to-regex "^3.0.2"
middle-earth@0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/middle-earth/-/middle-earth-0.0.6.tgz#83551b62767e5c170d7c1139754685064008595b"
integrity sha1-g1UbYnZ+XBcNfBE5dUaFBkAIWVs=
dependencies:
express "^4.0.0"
miller-rabin@^4.0.0: miller-rabin@^4.0.0:
version "4.0.1" version "4.0.1"
resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d"
......
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