mods can see all puzzle dashboards
parent
16d36f3249
commit
656fd14fbc
|
@ -241,12 +241,16 @@ final class Puzzle(
|
|||
}
|
||||
|
||||
def dashboard(days: Int) =
|
||||
Auth { implicit ctx => _ =>
|
||||
env.user.repo.named("juliano123").orFail("!!!") flatMap { me =>
|
||||
env.puzzle.dashboard(me, days) map { dashboard =>
|
||||
Ok(views.html.puzzle.dashboard(dashboard, days))
|
||||
Auth { implicit ctx => me =>
|
||||
get("u")
|
||||
.ifTrue(isGranted(_.Hunter))
|
||||
.??(env.user.repo.named)
|
||||
.map(_ | me)
|
||||
.flatMap { user =>
|
||||
env.puzzle.dashboard(user, days) map { dashboard =>
|
||||
Ok(views.html.puzzle.dashboard(user, dashboard, days))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def mobileBcLoad(nid: Long) =
|
||||
|
|
|
@ -18,7 +18,11 @@ object dashboard {
|
|||
private val themeClass = s"${baseClass}__themes__theme"
|
||||
private val dataWinPercent = attr("data-win-percent")
|
||||
|
||||
def apply(dashOpt: Option[PuzzleDashboard], days: Int)(implicit ctx: Context) =
|
||||
def apply(user: User, dashOpt: Option[PuzzleDashboard], days: Int)(implicit ctx: Context) = {
|
||||
val title =
|
||||
if (ctx is user) "Puzzle dashboard"
|
||||
else s"${user.username} puzzle dashboard"
|
||||
val urlExt = !(ctx is user) ?? s"?u=${user.username}"
|
||||
views.html.base.layout(
|
||||
title = "Puzzle dashboard",
|
||||
moreCss = cssTag("puzzle.dashboard")
|
||||
|
@ -32,7 +36,7 @@ object dashboard {
|
|||
PuzzleDashboard.dayChoices map { d =>
|
||||
a(
|
||||
cls := (d == days).option("current"),
|
||||
href := routes.Puzzle.dashboard(d)
|
||||
href := s"${routes.Puzzle.dashboard(d)}$urlExt"
|
||||
)(trans.nbDays.pluralSame(d))
|
||||
}
|
||||
)
|
||||
|
@ -65,6 +69,7 @@ object dashboard {
|
|||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private def themeSelection(themes: List[(PuzzleTheme.Key, PuzzleDashboard.Results)])(implicit lang: Lang) =
|
||||
themes.map { case (key, results) =>
|
||||
|
|
|
@ -83,7 +83,7 @@ GET /training/frame controllers.Puzzle.frame
|
|||
GET /training/export/gif/thumbnail/:id.gif controllers.Export.puzzleThumbnail(id: String)
|
||||
GET /training/themes controllers.Puzzle.themes
|
||||
GET /training/dashboard controllers.Puzzle.dashboard(days: Int = 7)
|
||||
GET /training/dashboard/:days controllers.Puzzle.dashboard(days: Int)
|
||||
GET /training/dashboard/$days<\d+> controllers.Puzzle.dashboard(days: Int)
|
||||
GET /training/batch controllers.Puzzle.mobileBcBatchSelect
|
||||
POST /training/batch controllers.Puzzle.mobileBcBatchSolve
|
||||
GET /training/new controllers.Puzzle.mobileBcNew
|
||||
|
|
Loading…
Reference in New Issue