psanchezp

Merge

...@@ -113,6 +113,25 @@ table { ...@@ -113,6 +113,25 @@ table {
113 } 113 }
114 } 114 }
115 115
116 +// Admin
117 +.pools {
118 + grid-template-columns: 2.5vw auto 2.5vw;
119 +}
120 +
121 +.admin-index {
122 + grid-row: 2;
123 + grid-column: 2;
124 +
125 + th { text-align: left; }
126 +}
127 +
128 +.admin-pools {
129 + grid-row: 2;
130 + grid-column: 2;
131 +
132 + th { text-align: left; }
133 +}
134 +
116 input[type="submit"] { 135 input[type="submit"] {
117 float: right; 136 float: right;
118 margin-top: 10px; 137 margin-top: 10px;
...@@ -130,6 +149,11 @@ input[type="submit"] { ...@@ -130,6 +149,11 @@ input[type="submit"] {
130 } 149 }
131 } 150 }
132 151
152 +.group-form {
153 + grid-row: 2;
154 + grid-column: 2;
155 +}
156 +
133 // Media Queries 157 // Media Queries
134 @media only screen and (max-width: 823px) { 158 @media only screen and (max-width: 823px) {
135 .container.application { 159 .container.application {
......
...@@ -2,8 +2,8 @@ class ApplicationController < HeimdallEngine::ApplicationController ...@@ -2,8 +2,8 @@ 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 - @leaders = leaderboard 5 + leaderboard
6 - @upcoming_matches = check_matches 6 + check_matches
7 recent_matches 7 recent_matches
8 @results = check_results 8 @results = check_results
9 end 9 end
...@@ -21,19 +21,19 @@ class ApplicationController < HeimdallEngine::ApplicationController ...@@ -21,19 +21,19 @@ class ApplicationController < HeimdallEngine::ApplicationController
21 end 21 end
22 22
23 def check_matches 23 def check_matches
24 - Match.active.order(date: :ASC).limit(5) 24 + @upcoming_matches = Match.active.order(date: :ASC).limit(5)
25 .where('date > ?', Time.zone.now) 25 .where('date > ?', Time.zone.now)
26 end 26 end
27 27
28 + def recent_matches
29 + @recent_matches = Match.active.where.not(result: nil)
30 + .order(:date).limit(5)
31 + end
32 +
28 def check_results 33 def check_results
29 return [] unless current_user 34 return [] unless current_user
30 current_user.bets.joins(:match).order('matches.date desc') 35 current_user.bets.joins(:match).order('matches.date desc')
31 .where.not(result: nil) 36 .where.not(result: nil)
32 .limit(5) 37 .limit(5)
33 end 38 end
34 -
35 - def recent_matches
36 - @recent_matches = Match.active.where.not(result: nil)
37 - .order(:date).limit(5)
38 - end
39 end 39 end
......
1 -= simple_nested_form_for [:admin, @object] do |f| 1 +.group-form
2 + h2
3 + = "#{title} group"
4 + = simple_nested_form_for [:admin, @object] do |f|
2 = f.input :name 5 = f.input :name
3 = f.association :pool 6 = f.association :pool
4 = f.association :users 7 = f.association :users
......
1 -div style='margin-top: 100px; width: 100%' 1 += render 'form', title: 'New'
2 - h2 New Group
3 -
4 - = render 'form'
......
1 -= simple_nested_form_for [:admin, @object] do |f| 1 +.admin-pools
2 + h2
3 + = "#{title} Pool"
4 + = simple_nested_form_for [:admin, @object] do |f|
2 = f.input :name 5 = f.input :name
3 = f.input :editable_until 6 = f.input :editable_until
4 = f.input :active 7 = f.input :active
......
1 -h2 1 += render 'form', title: 'Edit'
2 - | New Pool
3 -
4 -= render 'form'
......
1 -h2 1 +.admin-index
2 + h2
2 | Pools 3 | Pools
3 = link_to 'New Pool', new_admin_pool_path, style: 'float: right' 4 = link_to 'New Pool', new_admin_pool_path, style: 'float: right'
4 5
5 -- attrs = %i[name editable_until active] 6 + - attrs = %i[name editable_until active]
6 -table 7 + table
7 thead 8 thead
8 - attrs.each do |a| 9 - attrs.each do |a|
9 th = Pool.human_attribute_name(a) 10 th = Pool.human_attribute_name(a)
......
1 -h2 1 += render 'form', title: 'New'
2 - | New Pool
3 -
4 -= render 'form'
......
...@@ -24,6 +24,13 @@ ActiveRecord::Schema.define(version: 20180611152633) do ...@@ -24,6 +24,13 @@ ActiveRecord::Schema.define(version: 20180611152633) do
24 t.integer "points" 24 t.integer "points"
25 end 25 end
26 26
27 + create_table "group_users", force: :cascade do |t|
28 + t.integer "group_id"
29 + t.integer "user_id"
30 + t.index ["group_id"], name: "index_group_users_on_group_id", using: :btree
31 + t.index ["user_id"], name: "index_group_users_on_user_id", using: :btree
32 + end
33 +
27 create_table "groups", force: :cascade do |t| 34 create_table "groups", force: :cascade do |t|
28 t.integer "pool_id" 35 t.integer "pool_id"
29 t.string "name" 36 t.string "name"
...@@ -32,13 +39,6 @@ ActiveRecord::Schema.define(version: 20180611152633) do ...@@ -32,13 +39,6 @@ ActiveRecord::Schema.define(version: 20180611152633) do
32 t.index ["pool_id"], name: "index_groups_on_pool_id", using: :btree 39 t.index ["pool_id"], name: "index_groups_on_pool_id", using: :btree
33 end 40 end
34 41
35 - create_table "groups_users", force: :cascade do |t|
36 - t.integer "group_id"
37 - t.integer "user_id"
38 - t.index ["group_id"], name: "index_groups_users_on_group_id", using: :btree
39 - t.index ["user_id"], name: "index_groups_users_on_user_id", using: :btree
40 - end
41 -
42 create_table "heimdall_engine_role_abilities", force: :cascade do |t| 42 create_table "heimdall_engine_role_abilities", force: :cascade do |t|
43 t.integer "role_id" 43 t.integer "role_id"
44 t.string "key" 44 t.string "key"
......