psanchezp

basic root

1 +//
2 +.container {
3 + display: grid;
4 + grid-template-rows: 10vh auto;
5 + grid-template-columns: auto auto auto;
6 +}
7 +
8 +.navbar {
9 + grid-row: 1;
10 + grid-columns: 1/4;
11 +}
12 +
13 +.content {
14 + grid-row: 2;
15 + justify-self: center;
16 +}
17 +
18 +.left {
19 + grid-column: 1;
20 +}
21 +
22 +.center {
23 + grid-column: 2;
24 +}
25 +
26 +.right {
27 + grid-column: 3;
28 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -2,7 +2,7 @@ class ApplicationController < HeimdallEngine::ApplicationController ...@@ -2,7 +2,7 @@ class ApplicationController < HeimdallEngine::ApplicationController
2 protect_from_forgery with: :exception 2 protect_from_forgery with: :exception
3 3
4 def root 4 def root
5 - @leaderboard = check_leaderboard 5 + @leaders = check_leaderboard
6 @upcoming_matches = check_matches 6 @upcoming_matches = check_matches
7 @results = check_results 7 @results = check_results
8 end 8 end
...@@ -10,7 +10,7 @@ class ApplicationController < HeimdallEngine::ApplicationController ...@@ -10,7 +10,7 @@ class ApplicationController < HeimdallEngine::ApplicationController
10 private 10 private
11 11
12 def check_leaderboard 12 def check_leaderboard
13 - User.all.order_by(&:user_score).take(5) 13 + (User.all.sort {|a,b| a.user_score <=> b.user_score }).take(5)
14 end 14 end
15 15
16 def check_matches 16 def check_matches
......
1 +h1 Leaderboard
2 +table
3 + thead
4 + th Username
5 + th Score
6 + tbody
7 + tr
8 + - @leaders.each do |l|
9 + td = l.name
10 + td = l.user_score
11 +
12 +
...\ No newline at end of file ...\ No newline at end of file
1 +h1 Results
2 +table
3 + thead
4 + th Team 1
5 + th Team 2
6 + th Points obtained
7 + tbody
8 + tr
9 + - @results.each do |r|
10 + td = r.local
11 + td = r.visit
12 + td = r.points
1 +h1 Upcoming matches
2 +table
3 + thead
4 + th Team 1
5 + th Team 2
6 + th Date
7 + tbody
8 + tr
9 + - @upcoming_matches.each do |u|
10 + td = u.local
11 + td = u.visit
12 + td = u.date
13 +
14 +
...\ No newline at end of file ...\ No newline at end of file
1 +.container
2 + .navbar
3 + .left.content
4 + - if @current_user
5 + = render 'login'
6 + - else
7 + = render 'results'
8 + .center.content
9 + = render 'leaderboard'
10 + .right.content
11 + = render 'upcoming_matches'
...\ No newline at end of file ...\ No newline at end of file