Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added context path to javascipt sources and ajax request #4

Merged
merged 1 commit into from
Aug 8, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ organization := "net.liftmodules"

homepage := Some(url("https://github.com/joescii/lift-ng"))

version := "0.4.6"
version := "0.4.7"

liftVersion <<= liftVersion ?? "2.5.1"

Expand Down
3 changes: 2 additions & 1 deletion src/main/js/liftproxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ angular
return q.promise;
};

return $http.post('ajax_request/' + lift_page + '/', req, {
return $http.post(net_liftmodules_ng.contextPath + '/ajax_request/' + lift_page + '/', req, {
//return $http.post('ajax_request/' + lift_page + '/', req, {
headers : {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/net/liftmodules/ng/Angular.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ object Angular extends DispatchSnippet {
}

private val liftproxySrc =
"classpath/net/liftmodules/ng/js/liftproxy-"+BuildInfo.version + (Props.mode match {
LiftRules.context.path + "/classpath/net/liftmodules/ng/js/liftproxy-"+BuildInfo.version + (Props.mode match {
case RunModes.Development => ".js"
case _ => ".min.js"
})
Expand All @@ -108,6 +108,7 @@ object Angular extends DispatchSnippet {
val liftproxy = if(includeJsScript) <script src={liftproxySrc}></script> else NodeSeq.Empty
val jsModule = Script(JsRaw(
"var net_liftmodules_ng=net_liftmodules_ng||{};" +
"net_liftmodules_ng.contextPath=net_liftmodules_ng.contextPath||\"" + LiftRules.context.path + "\";" +
"net_liftmodules_ng.version=net_liftmodules_ng.version||\"" + BuildInfo.version + "\";" +
"net_liftmodules_ng.jsPath=net_liftmodules_ng.jsPath||\"" + liftproxySrc +"\";"
))
Expand Down
2 changes: 1 addition & 1 deletion test-project/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name := "ng-test"

organization := "net.liftmodules"

version := "0.4.6"
version := "0.4.7"

liftVersion <<= liftVersion ?? "2.5.1"

Expand Down
3 changes: 2 additions & 1 deletion test-project/src/main/scala/bootstrap/liftweb/Boot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class Boot {
Menu.i("Actors - Scope") / "actorsScope",
Menu.i("Actors - Assignment") / "actorsAssignment",
Menu.i("Delay") / "delay",
Menu.i("head.js") / "head-js"
Menu.i("head.js") / "head-js",
Menu.i("Subdir") / "subdir" / "index"
)

// set the sitemap. Note if you don't want access control for
Expand Down
23 changes: 23 additions & 0 deletions test-project/src/main/webapp/subdir/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta content="text/html; charset=UTF-8" http-equiv="content-type" /><title>Home</title></head>
<body class="lift:content_id=main">
<div id="main" class="lift:surround?with=default;at=content">
<script data-lift="AngularJS"></script>
<script id="liftmodules-ng_js" data-lift="Angular"></script>
<script id="staticServices_js" type="text/javascript" data-lift="StaticServices"></script>
<script id="staticApp_js" src="/js/StaticApp.js" type="text/javascript"></script>

<h2>Static service tests (in Subdir)</h2>
<div ng-app="StaticApp">
<div ng-controller="TestController">
<span id="outputStr" ng-bind="outputStr">OutputStr</span>
<span id="outputInt" ng-bind="outputInt">OutputInt</span>
<span id="outputStrField" ng-bind="outputObj.str">OutputStrField</span>
<span id="outputIntField" ng-bind="outputObj.num">OutputIntField</span>
</div>
</div>
</div>
</body>
</html>