Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
archery
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
archery
Commits
c698493e
Commit
c698493e
authored
Jan 18, 2016
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add button to (persistently) toggle visibility of total match scores during counting
parent
6ff0b7f4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
6 deletions
+40
-6
coffee/scores.coffee
coffee/scores.coffee
+32
-6
sass/main.sass
sass/main.sass
+4
-0
templates/match/scores.latte
templates/match/scores.latte
+4
-0
No files found.
coffee/scores.coffee
View file @
c698493e
if
table
=
document
.
querySelector
'.match-editable'
table
=
document
.
getElementById
'match'
if
table
.
classList
.
contains
'match-editable'
inputs
=
table
.
querySelectorAll
'input[type=number]'
inputs
=
table
.
querySelectorAll
'input[type=number]'
rows
=
table
.
children
[
1
].
children
rows
=
table
.
children
[
1
].
children
match_total
=
table
.
querySelector
'.match-total'
match_total
=
table
.
querySelector
'.match-total'
...
@@ -23,6 +25,9 @@ if table = document.querySelector '.match-editable'
...
@@ -23,6 +25,9 @@ if table = document.querySelector '.match-editable'
false
false
render
=
(
dirty_row
)
->
render
=
(
dirty_row
)
->
if
table
.
classList
.
contains
'hide-total-scores'
return
subtotal
=
0
subtotal
=
0
subtotal
+=
scores
[
dirty_row
*
w
+
col
]
for
col
in
[
0
...
w
]
subtotal
+=
scores
[
dirty_row
*
w
+
col
]
for
col
in
[
0
...
w
]
sub
(
dirty_row
).
innerHTML
=
subtotal
sub
(
dirty_row
).
innerHTML
=
subtotal
...
@@ -60,6 +65,26 @@ if table = document.querySelector '.match-editable'
...
@@ -60,6 +65,26 @@ if table = document.querySelector '.match-editable'
e
.
target
.
parentNode
.
previousElementSibling
.
value
=
v
e
.
target
.
parentNode
.
previousElementSibling
.
value
=
v
e
.
target
.
parentNode
.
parentNode
.
children
[
0
].
focus
()
e
.
target
.
parentNode
.
parentNode
.
children
[
0
].
focus
()
# total scores toggling + persistence in local storage
toggle_totals
=
document
.
getElementById
'toggle-total-scores'
console
.
log
toggle_totals
if
'localStorage'
of
window
and
localStorage
.
getItem
'hide-total-scores'
table
.
classList
.
add
'hide-total-scores'
toggle_totals
.
classList
.
remove
'active'
toggle_totals
.
addEventListener
'click'
,
->
console
.
log
'x'
@
.
classList
.
toggle
'active'
@
.
blur
()
hide
=
table
.
classList
.
toggle
'hide-total-scores'
if
'localStorage'
of
window
if
hide
localStorage
.
setItem
'hide-total-scores'
,
true
else
localStorage
.
removeItem
'hide-total-scores'
# notes area grows automatically with each added line
# notes area grows automatically with each added line
if
notes
=
document
.
getElementById
(
'notes'
)
if
notes
=
document
.
getElementById
(
'notes'
)
cb
=
->
cb
=
->
...
@@ -69,20 +94,21 @@ if notes = document.getElementById('notes')
...
@@ -69,20 +94,21 @@ if notes = document.getElementById('notes')
cb
.
call
notes
cb
.
call
notes
# color toggling + persistence in local storage
# color toggling + persistence in local storage
match
=
document
.
getElementById
'match'
toggle_color
=
document
.
getElementById
'toggle-colored'
toggle_color
=
document
.
getElementById
(
'toggle-colored'
)
if
'localStorage'
of
window
and
localStorage
.
getItem
'colored-scores'
if
'localStorage'
of
window
and
localStorage
.
getItem
'colored-scores'
match
.
classList
.
add
'colored'
table
.
classList
.
add
'colored'
toggle_color
.
classList
.
add
'active'
toggle_color
.
classList
.
add
'active'
toggle_color
.
addEventListener
'click'
,
->
toggle_color
.
addEventListener
'click'
,
->
@
.
classList
.
toggle
'active'
@
.
classList
.
toggle
'active'
@
.
blur
()
@
.
blur
()
match
.
classList
.
toggle
'colored'
colored
=
table
.
classList
.
toggle
'colored'
if
'localStorage'
of
window
if
'localStorage'
of
window
if
match
.
classList
.
contains
'colored'
if
colored
localStorage
.
setItem
'colored-scores'
,
true
localStorage
.
setItem
'colored-scores'
,
true
else
else
localStorage
.
removeItem
'colored-scores'
localStorage
.
removeItem
'colored-scores'
sass/main.sass
View file @
c698493e
...
@@ -83,6 +83,10 @@ $lg-width: 1200px
...
@@ -83,6 +83,10 @@ $lg-width: 1200px
.val-2
,
.val-1
.val-2
,
.val-1
background-color
:
$white
background-color
:
$white
&
.hide-total-scores
.row-total
,
.total
,
.match-avg
,
.match-total
color
:
#fff
.popup-container
.popup-container
position
:
relative
position
:
relative
width
:
100%
width
:
100%
...
...
templates/match/scores.latte
View file @
c698493e
...
@@ -74,6 +74,10 @@
...
@@ -74,6 +74,10 @@
</div>
</div>
<div class="btn-group actions">
<div class="btn-group actions">
<a href="javascript:void(0)" id="toggle-total-scores" class="btn btn-default active"
title="{_'Show/hide total score counts'}">
<span class="glyphicon glyphicon-eye-open"></span>
</a>
<a href="javascript:void(0)" id="toggle-colored" class="btn btn-default"
<a href="javascript:void(0)" id="toggle-colored" class="btn btn-default"
title="{_'Show/hide colors'}">
title="{_'Show/hide colors'}">
<span class="glyphicon glyphicon-tint"></span>
<span class="glyphicon glyphicon-tint"></span>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment