Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (31 sloc) 1.11 KB
package controllers
import lib.WebTemplateRender
import play.api.Configuration
import play.api.mvc._
import play.twirl.api.Html
import scala.async.Async._
import scala.concurrent.ExecutionContext
/**
* Created by William on 01/01/2016.
*/
final case class ServersController(templateRender: WebTemplateRender,
configuration: Configuration,
providesServers: ProvidesServers,
components: ControllerComponents)(
implicit executionContext: ExecutionContext)
extends AbstractController(components) {
def servers: Action[AnyContent] = Action.async { implicit request =>
async {
val got = await(providesServers.servers)
Ok(
templateRender.renderTemplate(
title = Some("ActionFPS Servers"),
jsonLink = Some(configuration.underlying.getString(
ServersController.ServersReferenceUrlConfigurationKey))
)(Html(views.Servers.render(got).render)))
}
}
}
object ServersController {
private val ServersReferenceUrlConfigurationKey = "af.reference.servers"
}