forked from lichess-org/lila
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.scala
61 lines (53 loc) · 1.49 KB
/
index.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package views.html.relay
import play.api.mvc.Call
import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.common.paginator.Paginator
import controllers.routes
object index {
import trans.broadcast._
def apply(
fresh: Option[lila.relay.Relay.Fresh],
pager: Paginator[lila.relay.Relay.WithStudyAndLiked],
url: Call
)(implicit ctx: Context) = {
def sublist(name: Frag, relays: Seq[lila.relay.Relay.WithStudyAndLiked]) =
relays.nonEmpty option st.section(
h2(name),
div(cls := "list")(
relays.map(show.widget(_))
)
)
views.html.base.layout(
title = liveBroadcasts.txt(),
moreCss = cssTag("relay.index"),
moreJs = infiniteScrollTag
) {
main(cls := "relay-index page-small box")(
div(cls := "box__top")(
h1(liveBroadcasts()),
a(
href := routes.Relay.form,
cls := "new button button-empty",
title := newBroadcast.txt(),
dataIcon := "O"
)
),
fresh.map { f =>
frag(
sublist(ongoing(), f.started),
sublist(upcoming(), f.created)
)
},
st.section(
h2(completed()),
div(cls := "infinitescroll")(
pager.currentPageResults.map { show.widget(_, "paginated") },
pagerNext(pager, np => addQueryParameter(url.url, "page", np))
)
)
)
}
}
}