merge bookmark controller with game controller
parent
12e2cd26ec
commit
864c507a0e
|
@ -96,7 +96,6 @@ final class LilaComponents(ctx: ApplicationLoader.Context) extends BuiltInCompon
|
|||
lazy val appeal: Appeal = wire[Appeal]
|
||||
lazy val auth: Auth = wire[Auth]
|
||||
lazy val blog: Blog = wire[Blog]
|
||||
lazy val bookmark: Bookmark = wire[Bookmark]
|
||||
lazy val playApi: PlayApi = wire[PlayApi]
|
||||
lazy val challenge: Challenge = wire[Challenge]
|
||||
lazy val coach: Coach = wire[Coach]
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package controllers
|
||||
|
||||
import lila.app._
|
||||
|
||||
final class Bookmark(env: Env) extends LilaController(env) {
|
||||
|
||||
private def api = env.bookmark.api
|
||||
|
||||
def toggle(gameId: String) =
|
||||
Auth { implicit ctx => me =>
|
||||
api.toggle(gameId, me.id)
|
||||
}
|
||||
}
|
|
@ -15,6 +15,11 @@ final class Game(
|
|||
apiC: => Api
|
||||
) extends LilaController(env) {
|
||||
|
||||
def bookmark(gameId: String) =
|
||||
Auth { implicit ctx => me =>
|
||||
env.bookmark.api.toggle(gameId, me.id)
|
||||
}
|
||||
|
||||
def delete(gameId: String) =
|
||||
Auth { implicit ctx => me =>
|
||||
OptionFuResult(env.game.gameRepo game gameId) { game =>
|
||||
|
|
|
@ -15,7 +15,7 @@ object bookmark {
|
|||
"bookmark" -> true,
|
||||
"bookmarked" -> bookmarked
|
||||
),
|
||||
href := routes.Bookmark.toggle(g.id),
|
||||
href := routes.Game.bookmark(g.id),
|
||||
title := trans.bookmarkThisGame.txt()
|
||||
)(
|
||||
iconTag("t")(cls := "on is3"),
|
||||
|
|
13
conf/routes
13
conf/routes
|
@ -1,10 +1,11 @@
|
|||
OPTIONS / controllers.Options.root
|
||||
OPTIONS /*url controllers.Options.all(url: String)
|
||||
|
||||
# Lobby
|
||||
GET / controllers.Lobby.home
|
||||
GET /lobby/seeks controllers.Lobby.seeks
|
||||
|
||||
# Should be handled by nginx mostly
|
||||
OPTIONS / controllers.Options.root
|
||||
OPTIONS /*url controllers.Options.all(url: String)
|
||||
|
||||
# Timeline
|
||||
GET /timeline controllers.Timeline.home
|
||||
POST /timeline/unsub/:channel controllers.Timeline.unsub(channel: String)
|
||||
|
@ -16,6 +17,9 @@ GET /games/search controllers.Search.index(page: Int ?= 1)
|
|||
POST /games/export/_ids controllers.Game.exportByIds
|
||||
GET /games/export/:username controllers.Game.exportByUser(username: String)
|
||||
|
||||
# Bookmark
|
||||
POST /bookmark/$gameId<\w{8}> controllers.Game.bookmark(gameId: String)
|
||||
|
||||
# TV
|
||||
GET /tv controllers.Tv.index
|
||||
GET /tv/frame controllers.Tv.frame
|
||||
|
@ -457,9 +461,6 @@ GET /irwin controllers.Irwin.dashboard
|
|||
POST /irwin/report controllers.Irwin.saveReport
|
||||
GET /api/stream/irwin controllers.Irwin.eventStream
|
||||
|
||||
# Bookmark
|
||||
POST /bookmark/$gameId<\w{8}> controllers.Bookmark.toggle(gameId: String)
|
||||
|
||||
# Forum
|
||||
GET /forum controllers.ForumCateg.index
|
||||
GET /forum/search controllers.ForumPost.search(text: String ?= "", page: Int ?= 1)
|
||||
|
|
Loading…
Reference in New Issue