Showing
9 changed files
with
96 additions
and
74 deletions
| ... | @@ -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,8 +21,13 @@ class ApplicationController < HeimdallEngine::ApplicationController | ... | @@ -21,8 +21,13 @@ 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 | ||
| 27 | + | ||
| 28 | + def recent_matches | ||
| 29 | + @recent_matches = Match.active.where.not(result: nil) | ||
| 30 | + .order(:date).limit(5) | ||
| 26 | end | 31 | end |
| 27 | 32 | ||
| 28 | def check_results | 33 | def check_results |
| ... | @@ -31,9 +36,4 @@ class ApplicationController < HeimdallEngine::ApplicationController | ... | @@ -31,9 +36,4 @@ class ApplicationController < HeimdallEngine::ApplicationController |
| 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 | - = f.input :name | 2 | + h2 |
| 3 | - = f.association :pool | 3 | + = "#{title} group" |
| 4 | - = f.association :users | 4 | + = simple_nested_form_for [:admin, @object] do |f| |
| 5 | - div style='text-align: center' | 5 | + = f.input :name |
| 6 | - = f.submit 'Save' | 6 | + = f.association :pool |
| 7 | + = f.association :users | ||
| 8 | + div style='text-align: center' | ||
| 9 | + = f.submit 'Save' | ||
| 7 | 10 | ||
| 8 | 11 | ... | ... |
| 1 | -= simple_nested_form_for [:admin, @object] do |f| | 1 | +.admin-pools |
| 2 | - = f.input :name | 2 | + h2 |
| 3 | - = f.input :editable_until | 3 | + = "#{title} Pool" |
| 4 | - = f.input :active | 4 | + = simple_nested_form_for [:admin, @object] do |f| |
| 5 | - hr | 5 | + = f.input :name |
| 6 | - h4 | 6 | + = f.input :editable_until |
| 7 | - | Matches | 7 | + = f.input :active |
| 8 | - = f.link_to_add 'Add Match', :matches, data: { target: '#matches' }, style: 'float:right' | 8 | + hr |
| 9 | - | 9 | + h4 |
| 10 | - table | 10 | + | Matches |
| 11 | - tbody#matches | 11 | + = f.link_to_add 'Add Match', :matches, data: { target: '#matches' }, style: 'float:right' |
| 12 | - = f.fields_for :matches, wrapper: false do |ff| | 12 | + |
| 13 | - tr | 13 | + table |
| 14 | - td = ff.input_field :date, placeholder: 'Date' | 14 | + tbody#matches |
| 15 | - td = ff.input_field :local, placeholder: 'Local' | 15 | + = f.fields_for :matches, wrapper: false do |ff| |
| 16 | - td = ff.input_field :visit, placeholder: 'Visit' | 16 | + tr |
| 17 | - td = ff.input_field :score_local, placeholder: 'Score Local' | 17 | + td = ff.input_field :date, placeholder: 'Date' |
| 18 | - td = ff.input_field :score_visit, placeholder: 'Score Visit' | 18 | + td = ff.input_field :local, placeholder: 'Local' |
| 19 | - td = ff.object.result ? ff.object.result.upcase : 'Pending Result' | 19 | + td = ff.input_field :visit, placeholder: 'Visit' |
| 20 | - td | 20 | + td = ff.input_field :score_local, placeholder: 'Score Local' |
| 21 | - = ff.link_to_remove 'Remove' | 21 | + td = ff.input_field :score_visit, placeholder: 'Score Visit' |
| 22 | - div style='text-align: center' | 22 | + td = ff.object.result ? ff.object.result.upcase : 'Pending Result' |
| 23 | - = f.submit 'Save' | 23 | + td |
| 24 | + = ff.link_to_remove 'Remove' | ||
| 25 | + div style='text-align: center' | ||
| 26 | + = f.submit 'Save' | ||
| 24 | 27 | ||
| 25 | 28 | ... | ... |
| 1 | -h2 | 1 | +.admin-index |
| 2 | - | Pools | 2 | + h2 |
| 3 | - = link_to 'New Pool', new_admin_pool_path, style: 'float: right' | 3 | + | Pools |
| 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) |
| 10 | - th Matches | 11 | + th Matches |
| 11 | - th | 12 | + th |
| 12 | - tbody | ||
| 13 | tbody | 13 | tbody |
| 14 | - - @object_collection.each do |model| | 14 | + tbody |
| 15 | - - attrs.each do |a| | 15 | + - @object_collection.each do |model| |
| 16 | - td = model.send(a) | 16 | + - attrs.each do |a| |
| 17 | - td #{model.matches.count} matches | 17 | + td = model.send(a) |
| 18 | - td | 18 | + td #{model.matches.count} matches |
| 19 | - = link_to 'Edit', edit_admin_pool_path(model) | 19 | + td |
| 20 | + = link_to 'Edit', edit_admin_pool_path(model) | ||
| 20 | 21 | ... | ... |
| ... | @@ -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" | ... | ... |
-
Please register or login to post a comment