Created
January 11, 2013 09:36
-
-
Save thbkrkr/4509319 to your computer and use it in GitHub Desktop.
Play2 Scala Template with PJAX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(title: String, styles: Html = Html(""), scripts: Html = Html(""))(content: Html)(implicit request: play.api.mvc.Request[play.api.mvc.AnyContent]) | |
@* Check for the pjax header *@ | |
@if(request.headers.get("X-PJAX").isDefined) { | |
<title>@title</title> | |
@content | |
<script>console.log("pjax template loaded");</script> | |
} else { | |
@* Normal request, not pjax *@ | |
<!DOCTYPE html> | |
<html> | |
<head> | |
@header(title) | |
@styles | |
</head> | |
<body> | |
<div id="content"> | |
@content | |
</div> | |
<script data-main="@routes.Assets.at("js/app.min.js")" src="@routes.Assets.at("js/require-jquery.min.js")"></script> | |
@scripts | |
@ga() | |
<script> | |
</script> | |
</body> | |
</html> | |
} @* End else *@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment