Skip to content

Commit

Permalink
only show inputs of analysable games
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Mar 2, 2021
1 parent 2323167 commit fccd9b5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
12 changes: 9 additions & 3 deletions app/views/mod/games.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ object games {
table(cls := "mod-games game-list slist")(
thead(
tr(
sortNoneTh(input(tpe := "checkbox", name := s"game[]", st.value := "all")),
sortNoneTh(
input(
tpe := "checkbox",
name := s"game[]",
st.value := "all"
)
),
sortNumberTh("Opponent"),
sortNumberTh("Speed"),
th(iconTag('g')),
Expand All @@ -85,8 +91,8 @@ object games {
tbody(
games.map { case (pov, assessment) =>
tr(
td(
input(
td(cls := pov.game.analysable.option("input"))(
pov.game.analysable option input(
tpe := "checkbox",
name := s"game[]",
st.value := pov.gameId
Expand Down
2 changes: 1 addition & 1 deletion ui/site/css/mod/_games.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
background: mix($c-bad, $c-bg-box, 50%);
}

td:first-child {
td.input {
cursor: pointer;
&:hover {
background: $c-bg-zebra2;
Expand Down
8 changes: 5 additions & 3 deletions ui/site/src/modGames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ const expandCheckboxZone = (table: HTMLTableElement, onSelect: OnSelect) =>
$(table).on('click', 'td:first-child', (e: MouseEvent) => {
if ((e.target as HTMLElement).tagName == 'INPUT') onSelect(e.target as HTMLInputElement, e.shiftKey);
else {
const input = (e.target as HTMLTableDataCellElement).querySelector('input') as HTMLInputElement;
input.checked = !input.checked;
onSelect(input, e.shiftKey);
const input = (e.target as HTMLTableDataCellElement).querySelector('input') as HTMLInputElement | undefined;
if (input) {
input.checked = !input.checked;
onSelect(input, e.shiftKey);
}
}
});

Expand Down

0 comments on commit fccd9b5

Please sign in to comment.