Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
archery
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
archery
Commits
c698493e
Commit
c698493e
authored
9 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Add button to (persistently) toggle visibility of total match scores during counting
parent
6ff0b7f4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
coffee/scores.coffee
+32
-6
32 additions, 6 deletions
coffee/scores.coffee
sass/main.sass
+4
-0
4 additions, 0 deletions
sass/main.sass
templates/match/scores.latte
+4
-0
4 additions, 0 deletions
templates/match/scores.latte
with
40 additions
and
6 deletions
coffee/scores.coffee
+
32
−
6
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]'
rows
=
table
.
children
[
1
].
children
match_total
=
table
.
querySelector
'.match-total'
...
...
@@ -23,6 +25,9 @@ if table = document.querySelector '.match-editable'
false
render
=
(
dirty_row
)
->
if
table
.
classList
.
contains
'hide-total-scores'
return
subtotal
=
0
subtotal
+=
scores
[
dirty_row
*
w
+
col
]
for
col
in
[
0
...
w
]
sub
(
dirty_row
).
innerHTML
=
subtotal
...
...
@@ -60,6 +65,26 @@ if table = document.querySelector '.match-editable'
e
.
target
.
parentNode
.
previousElementSibling
.
value
=
v
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
if
notes
=
document
.
getElementById
(
'notes'
)
cb
=
->
...
...
@@ -69,20 +94,21 @@ if notes = document.getElementById('notes')
cb
.
call
notes
# 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'
match
.
classList
.
add
'colored'
table
.
classList
.
add
'colored'
toggle_color
.
classList
.
add
'active'
toggle_color
.
addEventListener
'click'
,
->
@
.
classList
.
toggle
'active'
@
.
blur
()
match
.
classList
.
toggle
'colored'
colored
=
table
.
classList
.
toggle
'colored'
if
'localStorage'
of
window
if
match
.
classList
.
contains
'
colored
'
if
colored
localStorage
.
setItem
'colored-scores'
,
true
else
localStorage
.
removeItem
'colored-scores'
This diff is collapsed.
Click to expand it.
sass/main.sass
+
4
−
0
View file @
c698493e
...
...
@@ -83,6 +83,10 @@ $lg-width: 1200px
.val-2
,
.val-1
background-color
:
$white
&
.hide-total-scores
.row-total
,
.total
,
.match-avg
,
.match-total
color
:
#fff
.popup-container
position
:
relative
width
:
100%
...
...
This diff is collapsed.
Click to expand it.
templates/match/scores.latte
+
4
−
0
View file @
c698493e
...
...
@@ -74,6 +74,10 @@
</div>
<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"
title="{_'Show/hide colors'}">
<span class="glyphicon glyphicon-tint"></span>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment