Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Patricio Sanchez
/
quiniela-mundial
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
psanchezp
2018-06-11 18:20:02 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bf555f493831de06b49ac9cb00b5e125e54b87b1
bf555f49
1 parent
6a6a2f9e
Merge
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
96 additions
and
74 deletions
app/assets/stylesheets/root.scss
app/controllers/application_controller.rb
app/views/admin/groups/_form.html.slim
app/views/admin/groups/new.html.slim
app/views/admin/pools/_form.html.slim
app/views/admin/pools/edit.html.slim
app/views/admin/pools/index.html.slim
app/views/admin/pools/new.html.slim
db/schema.rb
app/assets/stylesheets/root.scss
View file @
bf555f4
...
...
@@ -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
{
...
...
app/controllers/application_controller.rb
View file @
bf555f4
...
...
@@ -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
...
...
app/views/admin/groups/_form.html.slim
View file @
bf555f4
=
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'
...
...
app/views/admin/groups/new.html.slim
View file @
bf555f4
div
style
=
'margin-top: 100px; width: 100%'
h2
New
Group
=
render
'form'
=
render
'form'
,
title:
'New'
...
...
app/views/admin/pools/_form.html.slim
View file @
bf555f4
=
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'
...
...
app/views/admin/pools/edit.html.slim
View file @
bf555f4
h2
|
New Pool
=
render
'form'
=
render
'form'
,
title:
'Edit'
...
...
app/views/admin/pools/index.html.slim
View file @
bf555f4
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
)
...
...
app/views/admin/pools/new.html.slim
View file @
bf555f4
h2
|
New Pool
=
render
'form'
=
render
'form'
,
title:
'New'
...
...
db/schema.rb
View file @
bf555f4
...
...
@@ -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"
...
...
Please
register
or
login
to post a comment