Author: erinnp
Date: Tue Aug 27 17:29:44 2013
New Revision: 1517892

URL: http://svn.apache.org/r1517892
Log:
RAVE-1035, , 1036, 1043. CurrentPage, Tabs controllers. PageLayouts Resource. 
Applying patch from Rohit Kalkur.

Added:
    
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/portal/controllers/AddOrEditNewPageModalCtrl.js
    
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/CurrentPageCtrl.js
    
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/MovePageModalCtrl.js
    
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/TabsCtrl.js
Modified:
    
rave/branches/angular/rave-components/rave-core-api/src/main/java/org/apache/rave/rest/PagesResource.java
    
rave/branches/angular/rave-components/rave-core/src/main/java/org/apache/rave/rest/impl/DefaultPageResource.java
    
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/index.html
    
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/tabs.html
    
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/controllers/index.js
    
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/main.js

Modified: 
rave/branches/angular/rave-components/rave-core-api/src/main/java/org/apache/rave/rest/PagesResource.java
URL: 
http://svn.apache.org/viewvc/rave/branches/angular/rave-components/rave-core-api/src/main/java/org/apache/rave/rest/PagesResource.java?rev=1517892&r1=1517891&r2=1517892&view=diff
==============================================================================
--- 
rave/branches/angular/rave-components/rave-core-api/src/main/java/org/apache/rave/rest/PagesResource.java
 (original)
+++ 
rave/branches/angular/rave-components/rave-core-api/src/main/java/org/apache/rave/rest/PagesResource.java
 Tue Aug 27 17:29:44 2013
@@ -90,6 +90,12 @@ public interface PagesResource {
     @Consumes(MediaType.APPLICATION_JSON)
     Page updatePage(@PathParam("pageId") String pageId, Page page);
 
+    @POST
+    @Path("/{pageId}")
+    @Produces(MediaType.APPLICATION_JSON)
+    @Consumes(MediaType.APPLICATION_JSON)
+    Page updatePagePost(@PathParam("pageId") String pageId, Page page);
+
     /**
      * Returns the OMDL representation of the page
      *

Modified: 
rave/branches/angular/rave-components/rave-core/src/main/java/org/apache/rave/rest/impl/DefaultPageResource.java
URL: 
http://svn.apache.org/viewvc/rave/branches/angular/rave-components/rave-core/src/main/java/org/apache/rave/rest/impl/DefaultPageResource.java?rev=1517892&r1=1517891&r2=1517892&view=diff
==============================================================================
--- 
rave/branches/angular/rave-components/rave-core/src/main/java/org/apache/rave/rest/impl/DefaultPageResource.java
 (original)
+++ 
rave/branches/angular/rave-components/rave-core/src/main/java/org/apache/rave/rest/impl/DefaultPageResource.java
 Tue Aug 27 17:29:44 2013
@@ -108,6 +108,11 @@ public class DefaultPageResource impleme
     }
 
     @Override
+    public Page updatePagePost(String id, Page page) {
+        return updatePage(id, page);
+    }
+
+    @Override
     public Page deletePage(String id) {
         //TODO: this cannot return a 404
         logger.debug("Deleting page " + id);

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=1517892&r1=1517891&r2=1517892&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
 Tue Aug 27 17:29:44 2013
@@ -1 +1,2 @@
-Hello World.
\ No newline at end of file
+Hello World.
+<div ng-include="'/portal/static/html/portal/tabs.html'"></div>
\ No newline at end of file

Modified: 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/tabs.html
URL: 
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/tabs.html?rev=1517892&r1=1517891&r2=1517892&view=diff
==============================================================================
--- 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/tabs.html
 (original)
+++ 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/html/portal/tabs.html
 Tue Aug 27 17:29:44 2013
@@ -1,72 +1,75 @@
-<!--ng-controller="PortalController"-->
-<div ng-show="pages">
-    <nav>
-        <ul class="nav nav-tabs">
-            <li ng-repeat="page in pages"
-                ng-class="{active:page.id == selectedPageId, dropdown:page.id 
== selectedPageId}"
-                ng-include=" page.id == selectedPageId && 'currentTab'|| 
'otherTab' ">
-            </li>
-
-            <script type="text/ng-template" id="currentTab">
-                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
-                    {{page.name}}<b class="caret"></b>
-                </a>
-                <!--ng-controller="CurrentPageController"-->
-                <ul class="dropdown-menu">
-                    <li class=""><a ng-click="edit()">Edit Page</a></li>
-                    <li class=""><a ng-click="delete()">Delete Page</a></li>
-                    <li class=""><a ng-click="move()">Move Page</a></li>
-                    <li class="hidden"><a ng-click="export()">Export 
Page</a></li>
-                    <li class=""><a ng-click="share()">Share Page</a></li>
-                    <li class="menu-item-disabled"><a 
ng-click="unshare()">Remove share</a></li>
-                </ul>
-            </script>
-
-            <script type="text/ng-template" id="otherTab">
-                <a href="{{page.id}}">
-                    {{page.name}}
-                </a>
-            </script>
-
-            <li id="addPageButton">
-                <a ng-click="addPage()"><i class="icon-plus"></i></a>
-            </li>
-        </ul>
-    </nav>
-    <div class="row-fluid">
-        <div class="tab-content" ng-show="selectedPageId == page.id" 
ng-repeat="page in pages">
-            <div id="emptyPageMessageWrapper" class="emptyPageMessageWrapper">
-                <div class="emptyPageMessage" ng-hide="hasWidgets(page)">
-                    <a href="/portal/app/store">Add widgets to this page</a>
-                </div>
+<nav ng-controller="TabsCtrl">
+    <ul class="nav nav-tabs">
+        <li ng-repeat="page in pages"
+            ng-class="{active:page.id == currentPageId, dropdown:page.id == 
currentPageId}"
+            ng-include=" page.id == currentPageId && 'currentTab'|| 'otherTab' 
">
+        </li>
+
+        <script type="text/ng-template" id="currentTab">
+            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+                {{page.name}}<b class="caret"></b>
+            </a>
+            <ul class="dropdown-menu" ng-controller="CurrentPageCtrl">
+                <li class=""><a ng-click="edit()">Edit Page</a></li>
+                <li ng-class="{ 'menu-item-disabled': onlyOnePage }" 
class=""><a ng-click="delete()">Delete Page</a></li>
+                <li ng-class="{ 'menu-item-disabled': onlyOnePage }" 
class=""><a ng-click="move()">Move Page</a></li>
+                <li class="hidden"><a ng-click="export()">Export Page</a></li>
+                <li class=""><a ng-click="share()">Share Page</a></li>
+                <li class="menu-item-disabled"><a ng-click="unshare()">Remove 
share</a></li>
+            </ul>
+        </script>
+
+        <script type="text/ng-template" id="otherTab">
+            <a href="{{page.id}}">
+                {{page.name}}
+            </a>
+        </script>
+
+        <li id="addPageButton">
+            <a ng-click="addPage()"><i class="icon-plus"></i></a>
+        </li>
+    </ul>
+</nav>
+<div class="row-fluid">
+    <div class="tab-content" ng-show="currentPageId == page.id" 
ng-repeat="page in pages">
+        <div id="emptyPageMessageWrapper" class="emptyPageMessageWrapper">
+            <div class="emptyPageMessage" ng-hide="hasWidgets(page)">
+                <a href="/portal/app/store">Add widgets to this page</a>
             </div>
-            <div 
ng-include="'/portal/static/html/portal/partials/'+page.pageLayoutCode+'.html'"></div>
         </div>
+        <div 
ng-include="'/portal/static/html/portal/partials/'+page.pageLayoutCode+'.html'"></div>
     </div>
 </div>
 
-<script type="text/ng-template" id="editPageModal">
+<!------------------------------
+
+       Modal Templates
+
+-------------------------------->
+<script type="text/ng-template" id="addOrEditPageModal">
     <form class="form-horizontal modal-form"  ng-submit="savePage()" >
     <div class="modal-header">
         <a class="close" ng-click="close()">&times;</a>
-        <h3>Add New Page</h3>
+        <h3>{{ title }}</h3>
     </div>
     <div class="modal-body">
             <fieldset>
+                <div class="control-group error">
+                    <label id="pageFormErrors" ng-show="error" 
class="control-label">{{ error }}</label>
+                </div>
                 <div class="control-group">
                     <label class="control-label" for="tab_title">Title </label>
 
                     <div class="controls">
-                        <input id="tab_title" class="input-xlarge focused" 
type="text" ng-model="page.name" required
-                               ng-class="{'ng-invalid':errorMsg}"/>
-                        <span class="error">{{errorMsg}}</span>
+                        <input id="tab_title" class="input-xlarge focused" 
type="text" ng-model="page.name" required />
                     </div>
                 </div>
                 <div class="control-group">
-                    <label class="control-label" for="pageLayout">Select 
Layout </label>
+                    <label class="control-label" for="pageLayout">Select Page 
Layout </label>
 
                     <div class="controls">
-                        <select id="pageLayout" ng-model="page.pageLayoutCode" 
ng-options="l.value as l.label for l in layouts">
+                        <select id="pageLayout" ng-model="page.pageLayoutCode" 
required ng-options="l.code as l.code for l in layouts | 
filter:isUserSelectable"">
+                            <option value="">-- Select Layout --</option>
                         </select>
                     </div>
                 </div>
@@ -82,15 +85,13 @@
 <script type="text/ng-template" id="movePageModal">
     <div class="modal-header">
         <a class="close" ng-click="close()">&times;</a>
-
-        <h3 id="pageMenuDialogHeader">Move This Page</h3>
+        <h3 id="pageMenuDialogHeader">MOVE THIS PAGE</h3>
     </div>
     <div class="modal-body">
         <form id="pageForm" class="form-horizontal">
             <fieldset>
                 <div class="control-group" id="pageLayoutGroup">
                     <label class="control-label" for="pageLocation">Move to 
</label>
-
                     <div class="controls">
                         <select id="pageLocation" ng-model="newLocation" 
ng-options="l.value as l.label for l in locations">
                         </select>
@@ -103,4 +104,27 @@
         <a id="pageMenuCloseButton" class="btn" ng-click="close()">Cancel</a>
         <a id="pageMenuUpdateButton" class="btn btn-primary" 
ng-click="movePage()">Move Page</a>
     </div>
+</script>
+
+<script type="text/ng-template" id="sharePageModal">
+    <div class="modal-header">
+        <a class="close" ng-click="close()">&times;</a>
+        <h3>SEARCH OR BROWSE FOR USER</h3>
+    </div>
+    <div class="modal-body">
+        <div id="sharePageDialogContent">
+            <div id="shareContent">
+                <div id="searchControls"><input id="searchTerm" 
name="searchTerm" type="text"/>
+                    <input id="shareSearchButton" value="Search" />
+                    <input id="clearSearchButton" value="Clear Search" 
class="hide"/>
+                </div>
+                <div id="shareSearchListHeader"></div>
+                <div id="shareSearchListPaging"></div>
+                <div id="shareSearchResults"></div>
+            </div>
+        </div>
+    </div>
+    <div class="modal-footer">
+        <a href="#" class="btn" ng-click="close()">Cancel</a>
+    </div>
 </script>
\ No newline at end of file

Added: 
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=1517892&view=auto
==============================================================================
--- 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PageLayoutsResource.js
 (added)
+++ 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/common/resources/PageLayoutsResource.js
 Tue Aug 27 17:29:44 2013
@@ -0,0 +1,24 @@
+/*
+ * 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([], function() {
+    return ['$resource', 'constants', function($resource, constants) {
+        return $resource(constants.hostedPath + '/api/rest/pageLayouts/:code', 
{code : '@code'});
+    }]
+ });

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=1517892&r1=1517891&r2=1517892&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
 Tue Aug 27 17:29:44 2013
@@ -18,9 +18,9 @@
  */
 
 define(['angular', './CategoriesResource', './PagesResource', 
'./PagesForRenderResource',
-    './PeopleResource', './RegionsResource', './RegionWidgetsResource', 
'./UsersResource',
-    '../services/index', 'underscore', 'angularResource'],
-    function (angular, categories, pages, pagesForRender, people, regions, 
regionWidgets, users, _) {
+    './PeopleResource', './RegionsResource', './RegionWidgetsResource', 
'./UsersResource', './PageLayoutsResource',
+    'underscore', '../services/index', 'angularResource'],
+    function (angular, categories, pages, pagesForRender, people, regions, 
regionWidgets, users, pageLayouts, _) {
 
         var resources = angular.module('common.resources', ['ngResource', 
'common.services'])
 
@@ -46,6 +46,8 @@ define(['angular', './CategoriesResource
         resources.factory('RegionWidgets', regionWidgets);
         resources.factory('Users', users);
         resources.factory('PagesForRender', pagesForRender);
+        resources.factory('PageLayouts', pageLayouts);
+
 
         return resources;
     });

Added: 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/AddOrEditNewPageModalCtrl.js
URL: 
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/AddOrEditNewPageModalCtrl.js?rev=1517892&view=auto
==============================================================================
--- 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/AddOrEditNewPageModalCtrl.js
 (added)
+++ 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/AddOrEditNewPageModalCtrl.js
 Tue Aug 27 17:29:44 2013
@@ -0,0 +1,71 @@
+/*
+ * 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'], function(_) {
+    /* Local Variables */
+    var addNewPageTitle = "ADD A NEW PAGE",
+        updatePageTitle = "UPDATE PAGE";
+
+    /* Controller Definition */
+    return ['$scope', 'dialog', 'page', 'pageLayouts', 'Pages', function 
($scope, dialog, page, pageLayouts, Pages) {
+
+        $scope.page = angular.copy(page);
+
+        $scope.title = resolveModalTitle($scope.page);
+
+        $scope.layouts = pageLayouts;
+
+        $scope.isUserSelectable = function(pageLayout) {
+            return pageLayout.userSelectable;
+        }
+
+        $scope.close = function() {
+            dialog.close();
+        }
+
+        $scope.savePage = function() {
+            $scope.error = null;
+            Pages.save($scope.page).$then(function(page) {
+                $scope.page = page;
+                addNewPageToOrUpdatePageInPagesArray($scope);
+                dialog.close();
+            }, function(response) {
+                //TODO: When REST API is fully implemented, set error msg to 
custom response from server
+                $scope.error = "Server-side ERROR";
+            });
+        }
+    }];
+
+    /* Helpers */
+    function resolveModalTitle(page) {
+       if(page) {
+        return updatePageTitle;
+       } else {
+        return addNewPageTitle;
+       }
+    }
+
+    function addNewPageToOrUpdatePageInPagesArray($scope) {
+        var pageEntry = _.findWhere($scope.pages, $scope.page);
+        if(pageEntry) {
+             _.extend(pageEntry, $scope.page);
+        } else {
+            $scope.pages.push($scope.page);
+        }
+    }
+});

Added: 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/CurrentPageCtrl.js
URL: 
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/CurrentPageCtrl.js?rev=1517892&view=auto
==============================================================================
--- 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/CurrentPageCtrl.js
 (added)
+++ 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/CurrentPageCtrl.js
 Tue Aug 27 17:29:44 2013
@@ -0,0 +1,99 @@
+/*
+ * 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'], function(_) {
+
+    /* Controller Definition */
+    return ['$scope', '$dialog', '$location', 'Pages', 'PageLayouts', 
function($scope, $dialog, $location, Pages, PageLayouts) {
+
+        $scope.page = Pages.get({ id : $scope.currentPageId });
+
+        $scope.$watch('pages.length', function(val){
+            if(val === 1) {
+                $scope.onlyOnePage= true;
+            } else {
+                $scope.onlyOnePage= false;
+            }
+        })
+
+        var notTheOnlyPage = function() { return !$scope.onlyOnePage; };
+
+        $scope.edit = function() {
+            $dialog
+                .dialog({
+                    backdrop: true,
+                    keyboard: true,
+                    backdropClick: true,
+                    templateUrl:  'addOrEditPageModal',
+                    controller : 'AddOrEditNewPageModalCtrl',
+                    resolve : {
+                        page: function() { return $scope.page; },
+                        pageLayouts : function() { return PageLayouts.query(); 
}
+                    }
+                 })
+                 .open();
+        }
+
+        $scope.delete= function() {
+            if( notTheOnlyPage() ) {
+               $scope.page.$delete(function() {
+                   deleteCurrentPageFromPagesArray($scope);
+                   $location.path('/');
+               });
+            }
+        }
+
+        $scope.move= function() {
+            if( notTheOnlyPage() ) {
+                $dialog
+                    .dialog({
+                        backdrop: true,
+                        keyboard: true,
+                        backdropClick: true,
+                        templateUrl:  'movePageModal',
+                        controller: 'MovePageModalCtrl'
+                    })
+                    .open();
+            }
+        }
+
+        $scope.export = function() {
+            //TODO: Implement
+            console.log('Export');
+        }
+
+        $scope.share = function() {
+            //TODO: Implement
+            console.log('Share');
+        }
+
+        $scope.unshare = function() {
+            //TODO: Implement
+            console.log('Unshare');
+        }
+    }]
+
+    /* Helpers */
+    function deleteCurrentPageFromPagesArray($scope) {
+        var pageId = $scope.page.id,
+            currentPage = _.find($scope.pages, function(page) { return page.id 
=== pageId; }),
+            indexOfCurrentPage = _.indexOf($scope.pages, currentPage);
+
+        $scope.pages.splice(indexOfCurrentPage, 1);
+    }
+ });

Added: 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/MovePageModalCtrl.js
URL: 
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/MovePageModalCtrl.js?rev=1517892&view=auto
==============================================================================
--- 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/MovePageModalCtrl.js
 (added)
+++ 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/MovePageModalCtrl.js
 Tue Aug 27 17:29:44 2013
@@ -0,0 +1,31 @@
+/*
+ * 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([], function() {
+    return ['$scope', 'dialog', function($scope, dialog) {
+
+        $scope.movePage = function() {
+            console.log("move page");
+        }
+
+        $scope.close = function() {
+            dialog.close();
+        }
+    }];
+
+ });

Added: 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/TabsCtrl.js
URL: 
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/TabsCtrl.js?rev=1517892&view=auto
==============================================================================
--- 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/TabsCtrl.js
 (added)
+++ 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/TabsCtrl.js
 Tue Aug 27 17:29:44 2013
@@ -0,0 +1,43 @@
+/*
+ * 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([], function () {
+    return ['$dialog', '$scope', 'PageLayouts', function ($dialog, $scope, 
PageLayouts) {
+        /*
+          DEBUG: $scope already has following properties bound:
+            -$scope.pages
+            -$scope.currentPageId
+        */
+
+        $scope.addPage = function() {
+            var addPageDialog = $dialog.dialog({
+                backdrop: true,
+                keyboard: true,
+                backdropClick: true,
+                templateUrl:  'addOrEditPageModal',
+                controller: 'AddOrEditNewPageModalCtrl',
+                resolve: {
+                    page : function() { return null; },
+                    pageLayouts : function() { return PageLayouts.query(); }
+                }
+            });
+            addPageDialog.open();
+        }
+
+    }]
+});

Modified: 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/index.js
URL: 
http://svn.apache.org/viewvc/rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/index.js?rev=1517892&r1=1517891&r2=1517892&view=diff
==============================================================================
--- 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/index.js
 (original)
+++ 
rave/branches/angular/rave-portal-resources/src/main/webapp/static/script/portal/controllers/index.js
 Tue Aug 27 17:29:44 2013
@@ -17,10 +17,16 @@
  * under the License.
  */
 
-define(['angular', './MainCtrl'], function (angular, MainCtrl) {
-    var controllers = angular.module('portal.controllers', []);
+define(['angular', './MainCtrl', './TabsCtrl', './CurrentPageCtrl', 
'./AddOrEditNewPageModalCtrl', './MovePageModalCtrl', 'angularUIBootstrap'],
+  function (angular, MainCtrl, TabsCtrl, CurrentPageCtrl, 
AddOrEditNewPageModalCtrl, MovePageModalCtrl) {
+
+    var controllers = angular.module('portal.controllers', ['ui.bootstrap']);
 
     controllers.controller('MainCtrl', MainCtrl);
+    controllers.controller('TabsCtrl', TabsCtrl);
+    controllers.controller('CurrentPageCtrl', CurrentPageCtrl);
+    controllers.controller('AddOrEditNewPageModalCtrl', 
AddOrEditNewPageModalCtrl);
+    controllers.controller('MovePageModalCtrl', MovePageModalCtrl);
 
     return controllers;
 });
\ No newline at end of file

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=1517892&r1=1517891&r2=1517892&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
 Tue Aug 27 17:29:44 2013
@@ -29,6 +29,7 @@ requirejs.config({
         
"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',
+        "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&amp;container=default&amp;debug=1",
@@ -71,10 +72,13 @@ requirejs.config({
         },
         angularResource:{
             deps: ['angular']
+        },
+        angularUIBootstrap : {
+            deps : ['angular']
         }
     }
 });
 
 require(['angular', 'portal/portal'], function(angular, app){
     angular.bootstrap(document, [app.name]);
-});
\ No newline at end of file
+});


Reply via email to