psanchezp

Merge

......@@ -113,6 +113,25 @@ table {
}
}
// Admin
.pools {
grid-template-columns: 2.5vw auto 2.5vw;
}
.admin-index {
grid-row: 2;
grid-column: 2;
th { text-align: left; }
}
.admin-pools {
grid-row: 2;
grid-column: 2;
th { text-align: left; }
}
input[type="submit"] {
float: right;
margin-top: 10px;
......@@ -130,6 +149,11 @@ input[type="submit"] {
}
}
.group-form {
grid-row: 2;
grid-column: 2;
}
// Media Queries
@media only screen and (max-width: 823px) {
.container.application {
......
......@@ -2,8 +2,8 @@ class ApplicationController < HeimdallEngine::ApplicationController
protect_from_forgery with: :exception
def root
@leaders = leaderboard
@upcoming_matches = check_matches
leaderboard
check_matches
recent_matches
@results = check_results
end
......@@ -21,8 +21,13 @@ class ApplicationController < HeimdallEngine::ApplicationController
end
def check_matches
Match.active.order(date: :ASC).limit(5)
.where('date > ?', Time.zone.now)
@upcoming_matches = Match.active.order(date: :ASC).limit(5)
.where('date > ?', Time.zone.now)
end
def recent_matches
@recent_matches = Match.active.where.not(result: nil)
.order(:date).limit(5)
end
def check_results
......@@ -31,9 +36,4 @@ class ApplicationController < HeimdallEngine::ApplicationController
.where.not(result: nil)
.limit(5)
end
def recent_matches
@recent_matches = Match.active.where.not(result: nil)
.order(:date).limit(5)
end
end
......
= simple_nested_form_for [:admin, @object] do |f|
= f.input :name
= f.association :pool
= f.association :users
div style='text-align: center'
= f.submit 'Save'
.group-form
h2
= "#{title} group"
= simple_nested_form_for [:admin, @object] do |f|
= f.input :name
= f.association :pool
= f.association :users
div style='text-align: center'
= f.submit 'Save'
......
div style='margin-top: 100px; width: 100%'
h2 New Group
= render 'form'
= render 'form', title: 'New'
......
= simple_nested_form_for [:admin, @object] do |f|
= f.input :name
= f.input :editable_until
= f.input :active
hr
h4
| Matches
= f.link_to_add 'Add Match', :matches, data: { target: '#matches' }, style: 'float:right'
table
tbody#matches
= f.fields_for :matches, wrapper: false do |ff|
tr
td = ff.input_field :date, placeholder: 'Date'
td = ff.input_field :local, placeholder: 'Local'
td = ff.input_field :visit, placeholder: 'Visit'
td = ff.input_field :score_local, placeholder: 'Score Local'
td = ff.input_field :score_visit, placeholder: 'Score Visit'
td = ff.object.result ? ff.object.result.upcase : 'Pending Result'
td
= ff.link_to_remove 'Remove'
div style='text-align: center'
= f.submit 'Save'
.admin-pools
h2
= "#{title} Pool"
= simple_nested_form_for [:admin, @object] do |f|
= f.input :name
= f.input :editable_until
= f.input :active
hr
h4
| Matches
= f.link_to_add 'Add Match', :matches, data: { target: '#matches' }, style: 'float:right'
table
tbody#matches
= f.fields_for :matches, wrapper: false do |ff|
tr
td = ff.input_field :date, placeholder: 'Date'
td = ff.input_field :local, placeholder: 'Local'
td = ff.input_field :visit, placeholder: 'Visit'
td = ff.input_field :score_local, placeholder: 'Score Local'
td = ff.input_field :score_visit, placeholder: 'Score Visit'
td = ff.object.result ? ff.object.result.upcase : 'Pending Result'
td
= ff.link_to_remove 'Remove'
div style='text-align: center'
= f.submit 'Save'
......
h2
| New Pool
= render 'form'
= render 'form', title: 'Edit'
......
h2
| Pools
= link_to 'New Pool', new_admin_pool_path, style: 'float: right'
.admin-index
h2
| Pools
= link_to 'New Pool', new_admin_pool_path, style: 'float: right'
- attrs = %i[name editable_until active]
table
thead
- attrs.each do |a|
th = Pool.human_attribute_name(a)
th Matches
th
tbody
- attrs = %i[name editable_until active]
table
thead
- attrs.each do |a|
th = Pool.human_attribute_name(a)
th Matches
th
tbody
- @object_collection.each do |model|
- attrs.each do |a|
td = model.send(a)
td #{model.matches.count} matches
td
= link_to 'Edit', edit_admin_pool_path(model)
tbody
- @object_collection.each do |model|
- attrs.each do |a|
td = model.send(a)
td #{model.matches.count} matches
td
= link_to 'Edit', edit_admin_pool_path(model)
......
h2
| New Pool
= render 'form'
= render 'form', title: 'New'
......
......@@ -24,6 +24,13 @@ ActiveRecord::Schema.define(version: 20180611152633) do
t.integer "points"
end
create_table "group_users", force: :cascade do |t|
t.integer "group_id"
t.integer "user_id"
t.index ["group_id"], name: "index_group_users_on_group_id", using: :btree
t.index ["user_id"], name: "index_group_users_on_user_id", using: :btree
end
create_table "groups", force: :cascade do |t|
t.integer "pool_id"
t.string "name"
......@@ -32,13 +39,6 @@ ActiveRecord::Schema.define(version: 20180611152633) do
t.index ["pool_id"], name: "index_groups_on_pool_id", using: :btree
end
create_table "groups_users", force: :cascade do |t|
t.integer "group_id"
t.integer "user_id"
t.index ["group_id"], name: "index_groups_users_on_group_id", using: :btree
t.index ["user_id"], name: "index_groups_users_on_user_id", using: :btree
end
create_table "heimdall_engine_role_abilities", force: :cascade do |t|
t.integer "role_id"
t.string "key"
......