Author: erinnp
Date: Wed May  1 18:37:49 2013
New Revision: 1478137

URL: http://svn.apache.org/r1478137
Log:
added renderWidgets convenience function, moved render all widgets out of rave 
ui for more fine grained approach

Modified:
    
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
    
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
    
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/core/rave_core.js
    
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js
    
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js

Modified: 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
URL: 
http://svn.apache.org/viewvc/rave/branches/0.21.1/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp?rev=1478137&r1=1478136&r2=1478137&view=diff
==============================================================================
--- 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
 (original)
+++ 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
 Wed May  1 18:37:49 2013
@@ -390,10 +390,12 @@
 
 <portal:register-init-script location="${'AFTER_RAVE'}">
 <script>
+    rave.init();
+
     $(function() {
         rave.initPageEditorStatus(<c:out value="${pageUser.editor}"/>);
-        rave.init();
         rave.layout.init(${applicationProperties['portal.export.ui.enable']});
+        rave.renderWidgets('home');
     });
 </script>
 <script>rave.models.currentPage.set({id: ${page.id}, ownerId: ${page.ownerId}, 
viewerId: <sec:authentication property="principal.id" />}, 
{silent:true})</script>

Modified: 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
URL: 
http://svn.apache.org/viewvc/rave/branches/0.21.1/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp?rev=1478137&r1=1478136&r2=1478137&view=diff
==============================================================================
--- 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
 (original)
+++ 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
 Wed May  1 18:37:49 2013
@@ -207,10 +207,10 @@
 
 <portal:register-init-script location="${'AFTER_RAVE'}">
     <script>
-        $(function () {
-            rave.RegionWidget.defaultView = 'profile';
+        rave.init();
+        rave.RegionWidget.defaultView = 'profile';
 
-            rave.init();
+        $(function () {
             rave.layout.init();
             rave.personprofile.init();
             rave.setPageOwner({
@@ -218,6 +218,7 @@
                 id: "<c:out value="${userProfile.id}"/>"
             });
             rave.forms.validateEditAccountForm();
+            rave.renderWidgets('home');
         });
     </script>
 </portal:register-init-script>

Modified: 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/core/rave_core.js
URL: 
http://svn.apache.org/viewvc/rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/core/rave_core.js?rev=1478137&r1=1478136&r2=1478137&view=diff
==============================================================================
--- 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/core/rave_core.js
 (original)
+++ 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/core/rave_core.js
 Wed May  1 18:37:49 2013
@@ -69,6 +69,11 @@ rave = (function () {
         delete regionWidgets[regionWidgetId];
     }
 
+    //convenience method to render all registered widgets
+    exports.renderWidgets = function(el, opts) {
+        _.invoke(rave.getWidgets(), 'render', el, opts);
+    }
+
     //get registered widget by regionWidgetId
     exports.getWidget = function (regionWidgetId) {
         return regionWidgets[regionWidgetId];

Modified: 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js
URL: 
http://svn.apache.org/viewvc/rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js?rev=1478137&r1=1478136&r2=1478137&view=diff
==============================================================================
--- 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js
 (original)
+++ 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js
 Wed May  1 18:37:49 2013
@@ -40,6 +40,7 @@ rave.personprofile = rave.personprofile 
             //on tab click, change the url hash
             var page = $(this).text();
             var target = $(this).attr('href');
+            var regionId = target.split('-')[1];
             location.hash = encodeURIComponent(page);
 
             // refresh the widgets on the sub page when selected to ensure 
proper sizing

Modified: 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js
URL: 
http://svn.apache.org/viewvc/rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js?rev=1478137&r1=1478136&r2=1478137&view=diff
==============================================================================
--- 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js
 (original)
+++ 
rave/branches/0.21.1/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js
 Wed May  1 18:37:49 2013
@@ -210,14 +210,10 @@ _.extend(rave.ui, (function () {
         $("#emptyPageMessageWrapper").removeClass("hidden");
     }
 
-    function renderWidgets() {
+    function showEmptyDisplay() {
         if (_.isEmpty(rave.getWidgets())) {
             displayEmptyPageMessage();
         }
-
-        _.each(rave.getWidgets(), function (widget) {
-            widget.render('home');
-        });
     }
 
     function getNonLockedRegions() {
@@ -913,7 +909,7 @@ _.extend(rave.ui, (function () {
         registerHomeView();
         registerCanvasView();
         registerPopups();
-        renderWidgets();
+        showEmptyDisplay();
         setupDragAndDrop();
     }
 


Reply via email to