Author: erinnp
Date: Fri Aug 30 17:56:44 2013
New Revision: 1519034
URL: http://svn.apache.org/r1519034
Log:
updates
Added:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/portal.html
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RaveResource.js
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/common/partials/navbar.html
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/index.html
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/directives/Base.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/CategoriesResource.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PageLayoutsResource.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PagesForRenderResource.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PagesResource.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PeopleResource.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RegionWidgetsResource.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RegionsResource.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/UsersResource.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/index.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/main.js
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/routes.js
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/common/partials/navbar.html
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/common/partials/navbar.html?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/common/partials/navbar.html
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/common/partials/navbar.html
Fri Aug 30 17:56:44 2013
@@ -12,15 +12,13 @@
<div class="nav-collapse">
<ul class="nav pull-right">
-
- <li ng-show="user.username"><a
href="/portal/app/person/id/{{user.id}}">Profile</a></li>
- <li ng-show="user.username"><a
href="/portal/app/store">Store</a></li>
- <li ng-show="user.admin"><a
href="/portal/app/admin">Admin</a></li>
+ <li ng-show="user.username"><a ng-href="{{ hostedPath
}}/app/person/id/{{user.id}}">Profile</a></li>
+ <li ng-show="user.username"><a ng-href="{{ hostedPath
}}/app/store">Store</a></li>
+ <li ng-show="user.admin"><a ng-href="{{ hostedPath
}}/app/admin">Admin</a></li>
<li ng-show="user.username"><a ng-click="logout()"
href="#">Logout</a></li>
<li ng-hide="user.username"><a ng-click="login()"
href="#">Login/Register</a></li>
-
</ul>
</div>
</div>
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/index.html
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/index.html?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/index.html
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/index.html
Fri Aug 30 17:56:44 2013
@@ -1,6 +1,2 @@
-<div ng-include="'/portal/static/html/common/partials/navbar.html'"></div>
-
-<div class="row-fluid" id="pageContent">
- <div ng-include="'/portal/static/html/portal/tabs.html'"></div>
-</div>
+<div ng-view></div>
Added:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/portal.html
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/portal.html?rev=1519034&view=auto
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/portal.html
(added)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/portal.html
Fri Aug 30 17:56:44 2013
@@ -0,0 +1,5 @@
+<div ng-include="hostedPath+'/static/html/common/partials/navbar.html'"></div>
+
+<div class="row-fluid" id="pageContent">
+ <div ng-include="hostedPath+'/static/html/portal/tabs.html'"></div>
+</div>
\ No newline at end of file
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/directives/Base.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/directives/Base.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/directives/Base.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/directives/Base.js
Fri Aug 30 17:56:44 2013
@@ -23,8 +23,8 @@
* service, etc that needs to build a url (see all common resources for
example).
*/
define([], function () {
- return [ 'constants',
- function (constants) {
+ return [ 'constants', '$rootScope',
+ function (constants, $rootScope) {
return {
restrict: 'E',
link: function link(scope, el, attrs) {
@@ -36,6 +36,7 @@ define([], function () {
href = href.join('/');
constants.hostedPath = href;
+ $rootScope.hostedPath = href;
}
}
}
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/CategoriesResource.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/CategoriesResource.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/CategoriesResource.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/CategoriesResource.js
Fri Aug 30 17:56:44 2013
@@ -18,8 +18,8 @@
*/
define([], function(){
- return ['$resource', 'constants', function($resource, constants){
- return $resource(constants.hostedPath + '/api/rest/categories/:id',
{id: '@id'});
+ return ['RaveResource', function(RaveResource){
+ return RaveResource('categories/:id', {id: '@id'});
}];
});
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PageLayoutsResource.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PageLayoutsResource.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PageLayoutsResource.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PageLayoutsResource.js
Fri Aug 30 17:56:44 2013
@@ -18,7 +18,7 @@
*/
define([], function() {
- return ['$resource', 'constants', function($resource, constants) {
- return $resource(constants.hostedPath + '/api/rest/pageLayouts/:code',
{code : '@code'});
+ return ['RaveResource', function(RaveResource) {
+ return RaveResource('pageLayouts/:code', {code : '@code'});
}]
});
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PagesForRenderResource.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PagesForRenderResource.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PagesForRenderResource.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PagesForRenderResource.js
Fri Aug 30 17:56:44 2013
@@ -18,57 +18,8 @@
*/
define(['underscore', 'rave'], function (_, rave) {
- return ['$resource', 'Pages', 'Regions', 'RegionWidgets', 'constants',
- function ($resource, Pages, Regions, RegionWidgets, constants) {
- var res = $resource(constants.hostedPath +
'/api/rest/pages/render/:context/:identifier/:id', {},
- {
- _query: { method: 'GET', isArray: true },
- _get: {method: 'GET'}
- });
-
- /**
- * Overwriting the pagesForRender query / get methods to decompose
the responses into their subordinate
- * $resource types. This guarantees that the PagesForRender
resource gets us objects on the scope that
- * we can individually manipulate and update.
- */
- /*
- TODO: One issue with this approach is that currently on a save to
a page, the entire page AND all sub-objects
- are getting posted to the server on $save() - same for regions
- */
- res.query = function (args, onSuccess, onError) {
- return res._query.call(null, args).$then(function (res) {
- //TODO: check for error
- var pages = res.data;
-
- _.each(pages, function (page, k) {
- page = pages[k] = new Pages(page);
-
- decomposePage(page);
- });
-
- if(onSuccess){
- return onSuccess(pages);
- }else{
- return pages
- }
- });
- }
-
- res.get = function (args, onSuccess, onError) {
- return res._get.call(null, args).$then(function (res) {
- //TODO: check for error
- var page = res.data;
-
- decomposePage(page);
-
- if(onSuccess){
- return onSuccess(page);
- }else{
- return page
- }
-
- });
- }
+ return ['RaveResource', 'Pages', 'Regions', 'RegionWidgets',
+ function (RaveResource, Pages, Regions, RegionWidgets) {
function decomposePage(page) {
_.each(page.regions, function (region, j) {
@@ -79,9 +30,29 @@ define(['underscore', 'rave'], function
region.regionWidgets[i] = new
RegionWidgets(regionWidget);
});
});
+
+ return page;
}
- return res;
+ return RaveResource('pages/render/:context/:identifier/:id', {},
+ {
+ query: {
+ transformResponse: function (data) {
+ var pages = data;
+
+ _.each(pages, function (page, k) {
+ page = pages[k] = new Pages(page);
+
+ decomposePage(page);
+ });
+
+ return pages;
+ }
+ },
+ get: {
+ transformResponse: decomposePage
+ }
+ });
}
];
})
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PagesResource.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PagesResource.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PagesResource.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PagesResource.js
Fri Aug 30 17:56:44 2013
@@ -18,8 +18,8 @@
*/
define([], function(){
- return ['$resource', 'constants', function($resource, constants){
- return $resource(constants.hostedPath + '/api/rest/pages/:id', {id:
'@id'});
+ return ['RaveResource', function(RaveResource){
+ return RaveResource('pages/:id', {id: '@id'});
}];
})
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PeopleResource.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PeopleResource.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PeopleResource.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PeopleResource.js
Fri Aug 30 17:56:44 2013
@@ -18,8 +18,8 @@
*/
define([], function(){
- return ['$resource', 'constants', function($resource, constants){
- return $resource(constants.hostedPath + '/api/rest/people/:id', {id:
'@id'});
+ return ['RaveResource', function(RaveResource){
+ return RaveResource('people/:id', {id: '@id'});
}];
// var friendResource = ['$resource', function($resource){
Added:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RaveResource.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RaveResource.js?rev=1519034&view=auto
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RaveResource.js
(added)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RaveResource.js
Fri Aug 30 17:56:44 2013
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+define(['underscore', 'angular'], function (_, angular) {
+ return ['$resource', '$http', 'constants', function ($resource, $http,
constants) {
+ var baseUrl = constants.hostedPath + '/api/rest/',
+ transform = $http.defaults.transformResponse.concat([
+ function (data) {
+ return data.data || data;
+ }
+ ]),
+ defaultActions = {
+ get: {method: 'GET', cache: true, transformResponse:
transform},
+ save: {method: 'POST', transformResponse: transform},
+ update: {method: 'PUT', transformResponse: transform},
+ query: {method: 'GET', cache: true, isArray: true,
transformResponse: transform},
+ remove: {method: 'DELETE', transformResponse: transform},
+ delete: {method: 'DELETE', transformResponse: transform}
+ };
+
+ return function RaveResource(url, paramDefaults, actions) {
+ var acts = angular.copy(defaultActions),
+ trans = transform;
+ url = baseUrl + url;
+
+ _.each(actions, function (action, key) {
+ if (action.transformResponse) {
+ if (_.isArray(action.transformResponse)) {
+ trans = trans.concat(action.transformResponse);
+ } else {
+ trans = trans.concat([action.transformResponse]);
+ }
+ }
+
+ action.transformResponse = trans;
+ acts[key] = _.extend(acts[key] || {}, action);
+ });
+
+
+ return $resource(url, paramDefaults, acts)
+ }
+ }];
+});
\ No newline at end of file
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RegionWidgetsResource.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RegionWidgetsResource.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RegionWidgetsResource.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RegionWidgetsResource.js
Fri Aug 30 17:56:44 2013
@@ -18,9 +18,9 @@
*/
define([], function(){
- return ['$resource', 'constants', function($resource, constants){
- return $resource(constants.hostedPath +
'/api/rest/pages/:pageId/regions/:regionId/regionWidgets/:id',
- {id: '@id', regionId: '@regionId'});
+ return ['RaveResource', function(RaveResource){
+ return
RaveResource('pages/:pageId/regions/:regionId/regionWidgets/:id',
+ {pageId: '@pageId', id: '@id', regionId: '@regionId'});
}];
});
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RegionsResource.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RegionsResource.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RegionsResource.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/RegionsResource.js
Fri Aug 30 17:56:44 2013
@@ -18,8 +18,8 @@
*/
define([], function(){
- return ['$resource', 'constants', function($resource, constants){
- return $resource(constants.hostedPath +
'/api/rest/pages/:pageId/regions/:id', {id: '@id'});
+ return ['RaveResource', function(RaveResource){
+ return RaveResource('pages/:pageId/regions/:id', {pageId: '@pageId',
id: '@id'});
}];
})
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/UsersResource.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/UsersResource.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/UsersResource.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/UsersResource.js
Fri Aug 30 17:56:44 2013
@@ -18,8 +18,8 @@
*/
define([], function(){
- return ['$resource', 'constants', function($resource, constants){
- return $resource(constants.hostedPath + '/api/rest/users/:id', {id:
'@id'});
+ return ['RaveResource', function(RaveResource){
+ return RaveResource('users/:id', {id: '@id'});
}];
});
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/index.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/index.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/index.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/index.js
Fri Aug 30 17:56:44 2013
@@ -17,28 +17,21 @@
* under the License.
*/
-define(['angular', './CategoriesResource', './PagesResource',
'./PagesForRenderResource',
+define(['angular', './RaveResource', './CategoriesResource',
'./PagesResource', './PagesForRenderResource',
'./PeopleResource', './RegionsResource', './RegionWidgetsResource',
'./UsersResource', './PageLayoutsResource',
'underscore', '../services/index', 'angularResource'],
- function (angular, categories, pages, pagesForRender, people, regions,
regionWidgets, users, pageLayouts, _) {
+ function (angular, Resource, categories, pages, pagesForRender, people,
regions, regionWidgets, users, pageLayouts, _) {
var resources = angular.module('common.resources', ['ngResource',
'common.services'])
/**
- * For all ajax requests, if the request returns json data and has a
.data property, return that.
- * This lets us unwrap our api responses for $resources.
+ The base $resource class for rave models.
*/
- resources.config(['$httpProvider', function ($httpProvider) {
- $httpProvider.defaults.transformResponse.push(function (data,
headers) {
- if (headers('CONTENT-TYPE') === 'application/json' &&
data.data) {
- return data.data;
- }
- else {
- return data;
- }
- });
- }]);
+ resources.factory('RaveResource', Resource);
+ /**
+ The rave models.
+ */
resources.factory('Categories', categories);
resources.factory('Pages', pages);
resources.factory('People', people);
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/main.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/main.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/main.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/main.js
Fri Aug 30 17:56:44 2013
@@ -28,12 +28,11 @@ requirejs.config({
"jqueryValidate":"//ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min",
"jqueryHashChange":'//cdnjs.cloudflare.com/ajax/libs/jquery-hashchange/v1.3/jquery.ba-hashchange.min',
"jqueryTouchPouch":
'//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.2/jquery.ui.touch-punch.min',
- "angular":
'//cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.min',
+ "angular": 'http://code.angularjs.org/1.1.5/angular',
+ "angularResource": 'http://code.angularjs.org/1.1.5/angular-resource',
"angularUIBootstrap" :
"//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.5.0/ui-bootstrap-tpls.min",
- "angularResource":
'//cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular-resource.min',
//TODO: We need to get this url from the server either via an endpoint
or jsp
"osapi":"/gadgets/js/container:pubsub-2:open-views.js?c=1&container=default&debug=1",
-//
"osapi":"//placeholder.url.will.be.replaced.by.opensocial.environment",
"rave": "core/main",
"underscore":
"//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min"
},
@@ -73,6 +72,9 @@ requirejs.config({
angularResource:{
deps: ['angular']
},
+ angularRouter:{
+ deps: ['angular']
+ },
angularUIBootstrap : {
deps : ['angular']
}
Modified:
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/routes.js
URL:
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/routes.js?rev=1519034&r1=1519033&r2=1519034&view=diff
==============================================================================
---
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/routes.js
(original)
+++
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/routes.js
Fri Aug 30 17:56:44 2013
@@ -17,11 +17,11 @@
* under the License.
*/
-define(['angular', 'common/resources/index'], function (angular) {
- var router = angular.module('portal.routes', ['common.resources']);
+define(['angular', 'common/resources/index', 'common/services/index'],
function (angular) {
+ var router = angular.module('portal.routes', ['common.resources',
'common.services']);
- router.config(['$routeProvider', '$locationProvider', '$httpProvider',
- function ($routeProvider, $locationProvider, $httpProvider) {
+ router.config(['constants', '$routeProvider', '$locationProvider',
'$httpProvider',
+ function (constants, $routeProvider, $locationProvider, $httpProvider)
{
/**
* The resolve functions guarantee that needed data is requested
and resolved from the server BEFORE route
@@ -29,38 +29,31 @@ define(['angular', 'common/resources/ind
* resource request. This is to prevent a new request on every
change in navigation - it will only happen
* on initial load.
*/
+ //TODO: once angular 1.2 is released, the resources will expose a
$promise property
var resolve = {
- pages: ['PagesForRender', '$q', '$rootScope',
- function (PagesForRender, $q, $rootScope) {
+ pages: ['PagesForRender', '$q',
+ function (PagesForRender, $q) {
var deferred = $q.defer();
- if ($rootScope.pages) {
- deferred.resolve($rootScope.pages);
- } else {
- PagesForRender.query({
- context: 'portal',
- identifier: '@self'
- }, function (data) {
- deferred.resolve(data);
+ PagesForRender.query({
+ context: 'portal',
+ identifier: '@self'
+ }).$then(function (response) {
+ deferred.resolve(response.resource)
});
- }
return deferred.promise;
}
],
- user: [ 'Users', '$q', '$rootScope',
- function (Users, $q, $rootScope) {
+ user: [ 'Users', '$q',
+ function (Users, $q) {
var deferred = $q.defer();
- if ($rootScope.user) {
- deferred.resolve($rootScope.user);
- } else {
- Users.get({
- id: '@self'
- }, function (data) {
- deferred.resolve(data);
+ Users.get({
+ id: '@self'
+ }).$then(function (response) {
+ deferred.resolve(response.resource)
});
- }
return deferred.promise;
}
@@ -73,12 +66,20 @@ define(['angular', 'common/resources/ind
*/
$routeProvider
.when('/', {
- resolve: resolve
+ resolve: resolve,
+ templateUrl: function () {
+ return constants.hostedPath +
'/static/html/portal/portal.html'
+ }
})
.when('/:tabId', {
- resolve: resolve
+ resolve: resolve,
+ templateUrl: function () {
+ return constants.hostedPath +
'/static/html/portal/portal.html'
+ }
})
- .otherwise({ templateUrl:
'/portal/static/html/portal/404.html'});
+ .otherwise({ templateUrl: function () {
+ return constants.hostedPath +
'/static/html/portal/404.html'
+ }});
$locationProvider.html5Mode(true);
}