本文整理汇总了Scala中play.api.routing.JavaScriptReverseRouter类的典型用法代码示例。如果您正苦于以下问题:Scala JavaScriptReverseRouter类的具体用法?Scala JavaScriptReverseRouter怎么用?Scala JavaScriptReverseRouter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JavaScriptReverseRouter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: JavascriptRouter
//设置package包名称以及导入依赖的类
package controllers
import javax.inject.Inject
import play.api.mvc._
import play.api.routing.JavaScriptReverseRouter
class JavascriptRouter @Inject()(controllerComponents: KnolxControllerComponents) extends KnolxAbstractController(controllerComponents) {
def jsRoutes: Action[AnyContent] = action { implicit request =>
Ok(JavaScriptReverseRouter("jsRoutes")(
controllers.routes.javascript.FeedbackFormsController.createFeedbackForm,
controllers.routes.javascript.FeedbackFormsController.manageFeedbackForm,
controllers.routes.javascript.FeedbackFormsController.updateFeedbackForm,
controllers.routes.javascript.FeedbackFormsController.getFeedbackFormPreview,
controllers.routes.javascript.UsersController.searchUser,
controllers.routes.javascript.UsersController.getByEmail,
controllers.routes.javascript.UsersController.deleteUser,
controllers.routes.javascript.SessionsController.searchManageSession,
controllers.routes.javascript.SessionsController.searchSessions,
controllers.routes.javascript.FeedbackFormsResponseController.storeFeedbackFormResponse,
controllers.routes.javascript.FeedbackFormsResponseController.fetchFeedbackFormResponse,
controllers.routes.javascript.FeedbackFormsResponseController.getFeedbackFormsForToday,
controllers.routes.javascript.SessionsController.update,
controllers.routes.javascript.SessionsController.deleteSession
)).as("text/javascript")
}
}
示例2: JavascriptRoute
//设置package包名称以及导入依赖的类
package controllers
import play.api.data
import play.api.mvc.{Action, Controller}
import play.api.routing.JavaScriptReverseRouter
class JavascriptRoute extends Controller {
def javascriptRoutes = Action {implicit request =>
Ok(
JavaScriptReverseRouter("jsRoutes")(
// routes.javascript.FrontController.front,
routes.javascript.HomeController.index,
routes.javascript.signupController.signup,
routes.javascript.LoginController.login,
routes.javascript.signupController.addPerson,
routes.javascript.LoginController.processForm
// routes.javascript.DetailController.detail
)
).as("text/javascript")
}
}
示例3: JavaScriptController
//设置package包名称以及导入依赖的类
package controllers
import play.api.mvc._
import play.api.routing.JavaScriptReverseRouter
class JavaScriptController extends Controller{
def javascriptRoutes = Action { implicit request =>
Ok(
JavaScriptReverseRouter("jsRoutes")(
routes.javascript.HomeController.index,
routes.javascript.HomeController.signUpForm,
routes.javascript.HomeController.signInForm,
routes.javascript.SignUpController.signUp,
routes.javascript.SignInController.signIn
)
).as("text/javascript")
}
}
示例4: index
//设置package包名称以及导入依赖的类
package controllers
import javax.inject._
import play.api._
import play.api.mvc._
import play.api.routing.JavaScriptReverseRouter
def index = Action {
//val ticketsAvailable = 1000
Ok(views.html.index())
}
def jsRoutes = Action { implicit request =>
Ok(
JavaScriptReverseRouter("jsRoutes")(
routes.javascript.Tickets.ticketsAvailable
)
)
}
}
示例5: JavascriptRoute
//设置package包名称以及导入依赖的类
package controllers
import play.api.mvc._
import play.api.routing.JavaScriptReverseRouter
class JavascriptRoute extends Controller {
def javascriptRoutes = Action { implicit request =>
Ok(
JavaScriptReverseRouter("jsRoutes")(
routes.javascript.CountController.count,
routes.javascript.Application.index,
routes.javascript.Application.signUp,
routes.javascript.Application.signIn ,
routes.javascript.SignUpController.addUser
)
).as("text/javascript")
}
}
示例6: RoutesController
//设置package包名称以及导入依赖的类
package controllers
import play.api.mvc.{Action, Controller}
import play.api.i18n.MessagesApi
import play.api.routing.JavaScriptReverseRouter
import services.CacheService
import com.google.inject.Inject
class RoutesController @Inject()(cacheService: CacheService)(implicit val messagesApi: MessagesApi) extends Controller {
def routesList = Action {
implicit request =>
Ok( JavaScriptReverseRouter("routesJs")(
routes.javascript.SignUpController.signup,
routes.javascript.LoginController.login,
routes.javascript.SignUpController.addUser
)
).as("text/javascript")
}
}
示例7: signOut
//设置package包名称以及导入依赖的类
package controllers
import javax.inject.Inject
import com.mohiva.play.silhouette.api.{LogoutEvent, Silhouette}
import com.mohiva.play.silhouette.impl.providers.SocialProviderRegistry
import play.Routes
import play.api.mvc._
import play.api.routing._
import play.api.i18n.{I18nSupport, MessagesApi}
import play.api.mvc.{Action, Controller}
import play.api.routing.JavaScriptReverseRouter
import utils.auth.{AuthenticationController, DefaultEnv}
import scala.concurrent.Future
def signOut = silhouette.SecuredAction.async { implicit request =>
val result = Redirect(routes.ApplicationController.index())
silhouette.env.eventBus.publish(LogoutEvent(request.identity, request))
silhouette.env.authenticatorService.discard(request.authenticator, result)
}
def jsRoutes = Action { implicit request =>
Ok(
JavaScriptReverseRouter("jsRoutes")(
routes.javascript.PlantDiseaseController.index,
routes.javascript.PlantDiseaseController.index
)).as("text/javascript")
}
}
示例8: Application
//设置package包名称以及导入依赖的类
package controllers
import javax.inject.{Inject, Singleton}
import jp.t2v.lab.play2.auth.OptionalAuthElement
import play.api.i18n.{I18nSupport, MessagesApi}
import play.api.mvc.{Action, Controller}
import play.api.routing.JavaScriptReverseRouter
import services.DBService
@Singleton
class Application @Inject()(val database: DBService,
val messagesApi: MessagesApi,
implicit val webJarAssets: WebJarAssets)
extends Controller with AuthConfigTrait with OptionalAuthElement with I18nSupport {
def index() = StackAction { implicit request =>
Ok(views.html.index(loggedIn))
}
def javascriptRoutes() = Action { implicit request =>
import routes.javascript._
Ok(
JavaScriptReverseRouter("jsRoutes")(
Arbiter.sportEventOdds
)
).as("text/javascript")
}
}
示例9: Application
//设置package包名称以及导入依赖的类
package controllers
import javax.inject.{Inject, Singleton}
import jp.t2v.lab.play2.auth.OptionalAuthElement
import play.api.i18n.{I18nSupport, MessagesApi}
import play.api.mvc.{Action, Controller}
import play.api.routing.JavaScriptReverseRouter
import services.DBService
@Singleton
class Application @Inject()(val database: DBService,
val messagesApi: MessagesApi,
implicit val webJarAssets: WebJarAssets)
extends Controller with AuthConfigTrait with OptionalAuthElement with I18nSupport {
def index() = StackAction { implicit request =>
Ok(views.html.index(loggedIn))
}
def javascriptRoutes() = Action { implicit request =>
import routes.javascript._
Ok(
JavaScriptReverseRouter("jsRoutes")(
PoloniexController.candles,
PoloniexController.messages,
PoloniexController.setups,
PoloniexController.updates,
HistoryController.socket
)
).as("text/javascript")
}
}
示例10: JavascriptRouterController
//设置package包名称以及导入依赖的类
package controllers
import play.api.mvc._
import play.api.routing.JavaScriptReverseRouter
class JavascriptRouterController extends Controller{
def javascriptRoutes = Action { implicit request =>
Ok(
JavaScriptReverseRouter("jsRoutes")(
routes.javascript.SignUpController.signUp,
routes.javascript.SignUpController.signUpAction,
routes.javascript.LoginController.login,
routes.javascript.LoginController.loginAction,
routes.javascript.ProfileController.profile,
routes.javascript.WelcomeController.welcome
)
).as("text/javascript")
}
}
示例11: FeedListController
//设置package包名称以及导入依赖的类
package controllers
import javax.inject.Inject
import akka.util.ByteString
import com.newsreader.feeds.application.api.FeedService
import com.newsreader.feeds.domain.Feed
import play.api.libs.json.Json
import play.api.mvc._
import play.api.routing.JavaScriptReverseRouter
class FeedListController @Inject() (service:FeedService) extends Controller {
implicit val feedWrites = Json.writes[Feed]
def index = Action {
Ok(views.html.index(""))
}
def feedJavascriptControllers = Action {
implicit request => Ok(
JavaScriptReverseRouter("jsRoutes")(
controllers.routes.javascript.FeedListController.add,
controllers.routes.javascript.FeedListController.load
)
).as("text/javascript")
}
def add = Action { implicit request =>
val json = request.body.asJson
val jsonName = json.map(json => (json \ "feedName").as[String]).get
val jsonAddress = json.map(json => (json \ "feedAddress").as[String]).get
val id = service.storeFeed(jsonName, jsonAddress)
Console.println(id)
Console.println(ByteString(id))
Ok(Json.toJson(id))
}
def load = Action {
Ok(Json.toJson(service.loadFeeds))
}
}
示例12: JavaScriptController
//设置package包名称以及导入依赖的类
package controllers
import play.Routes
import play.api.routing.JavaScriptReverseRouter
import routes.javascript._
import play.api._
import play.api.mvc._
class JavaScriptController extends Controller{
def javascriptRoutes = Action { implicit request =>
Ok(
JavaScriptReverseRouter("jsRoutes")(
routes.javascript.CountController.count,
routes.javascript.HomeController.signUp,
routes.javascript.HomeController.signIn,
routes.javascript.HomeController.submit,
routes.javascript.HomeController.home,
routes.javascript.HomeController.loginSubmit,
routes.javascript.HomeController.logout
)
).as("text/javascript")
}
}
示例13: index
//设置package包名称以及导入依赖的类
package controllers
import javax.inject._
import play.api.libs.concurrent.Execution.Implicits._
import play.api.mvc._
import play.api.routing.JavaScriptReverseRouter
import services.ConfigDataService
import scala.concurrent.Future
def index: Action[AnyContent] = Action.async {
val collected: Future[(Option[String], Option[String])] = for {
titleFuture <- configDataService.title.map { t => Option(t) } recover { case _ => None }
favFuture <- configDataService.favicon.map { t => Option(t) } recover { case _ => None }
} yield (titleFuture, favFuture)
collected
.map { res => Ok(views.html.index(res)) }
.recover { case _ => Ok(views.html.index((None, None))) }
}
def javascriptRoutes = Action { implicit request =>
Ok(
JavaScriptReverseRouter("jsRoutes")(
routes.javascript.MailController.index
)
).as("text/javascript")
}
}
示例14: Application
//设置package包名称以及导入依赖的类
package controllers
import play.api.Environment
import play.api.mvc._
import play.api.routing.JavaScriptReverseRouter
import shared.SharedMessages
import jsmessages.JsMessagesFactory
import play.api.i18n.{I18nSupport, MessagesApi}
import utils.i18n.i18nMessages
class Application()(implicit environment: Environment, jsMessagesFactory: JsMessagesFactory, val messagesApi: MessagesApi ) extends Controller with I18nSupport {
def index = Action {
Ok(views.html.index(SharedMessages.itWorks))
}
def graph = Action {
Ok(views.html.graph(SharedMessages.itWorks))
}
def jsMessages = Action { implicit request =>
Ok(jsMessagesFactory.all.all(Some("window.Messages")))
}
def getLang = Action { implicit request =>
Ok(i18nMessages.getLang().country)
}
def javascriptRoutes = Action { implicit request =>
Ok(
JavaScriptReverseRouter("jsRoutes")(
routes.javascript.Application.graph,
routes.javascript.Application.index,
routes.javascript.WebSocketCtrl.socket
)
).as("text/javascript")
}
}
示例15: Application
//设置package包名称以及导入依赖的类
package controllers
import models._
import play.api.routing.JavaScriptReverseRouter
import repositories.Contents.ArticleRepository
import utils.silhouette._
import play.api._
import play.api.mvc._
import play.api.Play.current
import play.api.i18n.{ MessagesApi, Messages, Lang }
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits._
import javax.inject.Inject
class Application @Inject() (val env: AuthenticationEnvironment, val messagesApi: MessagesApi) extends AuthenticationController {
def index = UserAwareAction.async { implicit request =>
val listArticles = ArticleRepository.getAllArticles().map(Article.shorten)
Future.successful(Ok(views.html.index(listArticles)))
}
def myAccount = SecuredAction.async { implicit request =>
Future.successful(Ok(views.html.myAccount()))
}
def myProfile = SecuredAction.async { implicit request =>
Future.successful(Ok(views.html.myProfile()))
}
// REQUIRED ROLES: master
def settings = SecuredAction(WithService("master")).async { implicit request =>
Future.successful(Ok(views.html.settings()))
}
def selectLang(lang: String) = Action { implicit request =>
Logger.logger.debug("Change user lang to : " + lang)
request.headers.get(REFERER).map { referer =>
Redirect(referer).withLang(Lang(lang))
}.getOrElse {
Redirect(routes.Application.index).withLang(Lang(lang))
}
}
def javascriptRoutes = Action { implicit request =>
Ok(
JavaScriptReverseRouter("jsRoutes")(
routes.javascript.RelationshipController.likeUnlike
)
).as("text/javascript")
}
}