diff options
author | Jakob Odersky <jakob@odersky.com> | 2016-02-24 20:29:30 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2016-02-24 20:31:14 -0800 |
commit | a41de68066007852d7d3dbf019d75b4caf7463ad (patch) | |
tree | b4446408291c9f179e1c270a561523023ac6a105 /mavigator-server/src/main/scala/mavigator | |
parent | 245faaf1e2ff4d0fbda292dbb35f4b49426d4380 (diff) | |
download | mavigator-a41de68066007852d7d3dbf019d75b4caf7463ad.tar.gz mavigator-a41de68066007852d7d3dbf019d75b4caf7463ad.tar.bz2 mavigator-a41de68066007852d7d3dbf019d75b4caf7463ad.zip |
Major refactorings
Diffstat (limited to 'mavigator-server/src/main/scala/mavigator')
-rw-r--r-- | mavigator-server/src/main/scala/mavigator/Router.scala | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/mavigator-server/src/main/scala/mavigator/Router.scala b/mavigator-server/src/main/scala/mavigator/Router.scala index c6740cc..07e40b0 100644 --- a/mavigator-server/src/main/scala/mavigator/Router.scala +++ b/mavigator-server/src/main/scala/mavigator/Router.scala @@ -19,25 +19,22 @@ import play.twirl.api.{ Xml, Txt, Html } object Router { import Directives._ + val socketUrl = "ws://localhost:8080/mavlink" + def route(implicit system: ActorSystem): Route = ( - path("info") { - get { - val f: Html = mavigator.views.html.dashboard( - "ws://localhost:8080/mavlink", - 0, - 0, - 0 - ) - complete(f) - } - } ~ path("dashboard" / IntNumber) { id => get { - - - - //get dashboard for remote sys id - ??? + val html = mavigator.views.html.app( + "Mavigator", + "mavigator_dashboard_Main", + Map( + "socketUrl" -> socketUrl, + "remoteSystemId" -> "0", + "systemId" -> "0", + "componentId" -> "0" + ) + ) + complete(html) } } ~ path("mavlink") { @@ -64,16 +61,20 @@ object Router { } ~ pathEndOrSingleSlash { get { - complete("hello world") + val html = mavigator.views.html.app( + "Index", + "mavigator_index_Main", + Map( + "socketUrl" -> socketUrl + ) + ) + complete(html) } } ) - /** Serialize Twirl `Html` to `text/html`. */ - implicit val twirlHtmlMarshaller = twirlMarshaller[Html](`text/html`) - - /** Serialize Twirl formats to `String`. */ - def twirlMarshaller[A <: AnyRef: Manifest](contentType: MediaType): ToEntityMarshaller[A] = - Marshaller.StringMarshaller.wrap(contentType)(_.toString) - + implicit val twirlHtml : ToEntityMarshaller[Html] = Marshaller.StringMarshaller.wrap(`text/html`){(h: Html) => + h.toString + } + } |