Skip to content

Commit 3698f38

Browse files
committed
default to asc sort for some other columns too
1 parent 4c77118 commit 3698f38

7 files changed

Lines changed: 17 additions & 15 deletions

File tree

app/views/mod/games.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def games(
7676
st.value := "all"
7777
)
7878
),
79-
thSortNumber("Opponent"),
79+
thSortNumber(dataSortAsc)("Opponent"),
8080
thSortNumber("Speed"),
8181
th(iconTag(Icon.Trophy)),
8282
thSortNumber("Moves"),

app/views/user/mod.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ object mod:
8282
table(cls := "slist")(
8383
thead(
8484
tr(
85-
th(
85+
th(dataSortAsc)(
8686
pluralize("linked user", userLogins.otherUsers.size),
8787
((max < 1000 || othersPartiallyLoaded) && !readOnly).option:
8888
frag(nbsp, a(cls := "more-others")("Load more"))
8989
),
90-
Granter.opt(_.Admin).option(th("Email")),
90+
Granter.opt(_.Admin).option(th(dataSortAsc)("Email")),
9191
thSortNumber(dataSortDefault)("Same"),
9292
th("Games"),
9393
thSortNumber(playban)(cls := "i", title := "Playban"),

modules/clas/src/main/ui/ClasUi.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ final class ClasUi(helpers: lila.ui.Helpers)(
137137
table(cls := "slist slist-pad")(
138138
thead(
139139
tr(
140-
th("Id"),
141-
th("Name"),
140+
th(dataSortAsc)("Id"),
141+
th(dataSortAsc)("Name"),
142142
th("Created"),
143143
th("Archived"),
144-
th("Teachers (first is owner)")
144+
th(dataSortAsc)("Teachers (first is owner)")
145145
)
146146
),
147147
tbody(

modules/clas/src/main/ui/DashboardUi.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ final class DashboardUi(helpers: Helpers, ui: ClasUi)(using NetDomain):
285285
table(cls := "slist slist-pad sortable")(
286286
thead(
287287
tr(
288-
th(dataSortDefault)(
288+
th(dataSortDefault)(dataSortAsc)(
289289
trans.clas
290290
.variantXOverLastY(progress.perfType.trans, trans.site.nbDays.txt(progress.days)),
291291
thSortNumber(trans.site.rating()),
@@ -340,7 +340,7 @@ final class DashboardUi(helpers: Helpers, ui: ClasUi)(using NetDomain):
340340
table(cls := "slist slist-pad sortable")(
341341
thead(
342342
tr(
343-
th(dataSortDefault)(
343+
th(dataSortDefault)(dataSortAsc)(
344344
trans.clas.nbStudents.pluralSame(students.size),
345345
thSortNumber(trans.site.chessBasics()),
346346
thSortNumber(trans.site.practice()),
@@ -452,7 +452,7 @@ final class DashboardUi(helpers: Helpers, ui: ClasUi)(using NetDomain):
452452
table(cls := "slist slist-pad sortable")(
453453
thead:
454454
tr(
455-
th(dataSortDefault)(trans.clas.nbStudents(students.size)),
455+
th(dataSortDefault)(dataSortAsc)(trans.clas.nbStudents(students.size)),
456456
thSortNumber(trans.site.rating()),
457457
thSortNumber(trans.site.games()),
458458
thSortNumber(trans.site.puzzles()),
@@ -542,7 +542,7 @@ final class DashboardUi(helpers: Helpers, ui: ClasUi)(using NetDomain):
542542
table(cls := "slist slist-pad sortable")(
543543
thead:
544544
tr(
545-
th(dataSortDefault)(trans.clas.nbStudents(students.size)),
545+
th(dataSortDefault)(dataSortAsc)(trans.clas.nbStudents(students.size)),
546546
thSortNumber(trans.site.rating()),
547547
thSortNumber(trans.site.games()),
548548
thSortNumber(trans.site.puzzles()),

modules/cms/src/main/CmsUi.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ final class CmsUi(helpers: Helpers)(menu: Context ?=> Frag):
9696
table(cls := "cms__pages slist slist-pad")(
9797
thead(
9898
tr(
99-
th(tableName),
100-
th("Content"),
101-
th("Lang"),
99+
th(dataSortAsc)(tableName),
100+
th(dataSortDisabled)("Content"),
101+
th(dataSortAsc)("Lang"),
102102
th("Live"),
103103
th(dataSortDefault)("Updated")
104104
)

modules/mod/src/main/ui/ModUserTableUi.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ final class ModUserTableUi(helpers: Helpers, modUi: ModUi):
4545
table(cls := "slist slist-pad mod-user-table")(
4646
thead(
4747
tr(
48-
th("User"),
48+
th(dataSortAsc)("User"),
4949
thSortNumber("Games"),
5050
th("Marks"),
5151
th("Closed"),

modules/ui/src/main/scalatags.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ trait ScalatagsAttrs:
3939
val allowfullscreen = attr("allowfullscreen").empty
4040
val credentialless = attr("credentialless").empty
4141

42-
val thSortNumber = th(attr("data-sort-method") := "number")
42+
val thSortNumber = th(attrData("sort-method") := "number")
4343
val dataSort = attrData("sort")
4444
val dataSortDefault = attrData("sort-default").empty
45+
val dataSortAsc = attrData("sort-reverse") := "true"
46+
val dataSortDisabled = attrData("sort-method") := "none"
4547

4648
// collection of lila snippets
4749
trait ScalatagsSnippets:

0 commit comments

Comments
 (0)