Author: klegacy
Date: Wed Oct 24 14:00:24 2012
New Revision: 1401693

URL: http://svn.apache.org/viewvc?rev=1401693&view=rev
Log:
RAVE-454 - Adding js, markup and message copy for link to comment and rate 
widget in the gadget menu.

Modified:
    rave/trunk/rave-portal-resources/src/main/resources/messages.properties
    
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
    
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/tags/region_widget.tag
    rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave.js
    
rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave_layout.js

Modified: 
rave/trunk/rave-portal-resources/src/main/resources/messages.properties
URL: 
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/resources/messages.properties?rev=1401693&r1=1401692&r2=1401693&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/resources/messages.properties 
(original)
+++ rave/trunk/rave-portal-resources/src/main/resources/messages.properties Wed 
Oct 24 14:00:24 2012
@@ -354,6 +354,8 @@ widget.chrome.toggle=Collapse/Restore Wi
 widget.chrome.disabled=This widget is currently disabled
 
 widget.menu.about=About this Widget
+widget.menu.comment=Comment on this Widget
+widget.menu.rate=Rate this Widget
 widget.menu.delete=Delete Widget
 widget.menu.editprefs=Edit Preferences
 widget.menu.maximize=Maximize

Modified: 
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
URL: 
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp?rev=1401693&r1=1401692&r2=1401693&view=diff
==============================================================================
--- 
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp 
(original)
+++ 
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp 
Wed Oct 24 14:00:24 2012
@@ -91,7 +91,7 @@
                 </c:if>
            </div>
            <div class="clearfix">
-                <div class="widgetRating">
+                <div class="widgetRating" id="widgetRatings">
                     <h3><fmt:message key="page.widget.rate"/></h3>
                     <form class="hidden">
                         <input type="hidden" id="rate-${widget.id}"
@@ -180,7 +180,7 @@
             </div>
 
             <div>
-                <div class="widgetComments">
+                <div class="widgetComments" id="widgetComments">
                     <h3><fmt:message key="page.widget.comments"/></h3>
                     <div class="new-comment form-inline well">
                         <div class="row-fluid">

Modified: 
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/tags/region_widget.tag
URL: 
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/tags/region_widget.tag?rev=1401693&r1=1401692&r2=1401693&view=diff
==============================================================================
--- 
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/tags/region_widget.tag 
(original)
+++ 
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/tags/region_widget.tag 
Wed Oct 24 14:00:24 2012
@@ -86,6 +86,16 @@ Template for rendering a RegionWidget in
                                 <fmt:message key="widget.menu.about"/>
                             </a>
                         </li>
+                        <li id="widget-${regionWidget.id}-menu-comment-item">
+                            <a href="#">
+                                <fmt:message key="widget.menu.comment"/>
+                            </a>
+                        </li>
+                        <li id="widget-${regionWidget.id}-menu-rate-item">
+                            <a href="#">
+                                <fmt:message key="widget.menu.rate"/>
+                            </a>
+                        </li>
                     </ul>
                 </div>
 

Modified: rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave.js
URL: 
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave.js?rev=1401693&r1=1401692&r2=1401693&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave.js 
(original)
+++ rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave.js Wed 
Oct 24 14:00:24 2012
@@ -1178,8 +1178,14 @@ var rave = rave || (function () {
         window.location.href = rave.getContext() + "page/view" + fragment;
     }
 
-    function viewWidgetDetail(widgetId, referringPageId) {
-        window.location.href = rave.getContext() + "store/widget/" + widgetId 
+ "?referringPageId=" + referringPageId;
+    function viewWidgetDetail(widgetId, referringPageId, jumpToId) {
+       if(jumpToId){
+               jumpToId = '#' + jumpToId;
+       }
+       else{
+               jumpToId = '';
+       }
+       window.location.href = rave.getContext() + "store/widget/" + widgetId + 
"?referringPageId=" + referringPageId  + jumpToId;
     }
 
     /**

Modified: 
rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave_layout.js
URL: 
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave_layout.js?rev=1401693&r1=1401692&r2=1401693&view=diff
==============================================================================
--- 
rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave_layout.js 
(original)
+++ 
rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave_layout.js 
Wed Oct 24 14:00:24 2012
@@ -618,6 +618,9 @@ rave.layout = rave.layout || (function()
         var $menuItemMove;
         var $menuItemDelete;
         var $menuItemMaximize;
+        var $menuItemAbout;
+        var $menuItemComment;
+        var $menuItemRate;
 
         /**
          * Hides the widget menu for a specific widget
@@ -706,6 +709,34 @@ rave.layout = rave.layout || (function()
                     event.stopPropagation();
                 });
             }
+            
+            // setup the comment on this widget menu item
+            $menuItemComment  = $("#widget-" + widgetId + 
"-menu-comment-item");
+            if (!$menuItemComment.hasClass("menu-item-disabled")) {
+                $menuItemComment.bind('click', function(event) {
+                    var regionWidget = 
rave.getRegionWidgetById(rave.getObjectIdFromDomId(this.id));
+
+                    // go to the widget detail page
+                    rave.viewWidgetDetail(regionWidget.widgetId, 
getCurrentPageId(), 'widgetComments');
+                    // prevent the menu button click event from bubbling up to 
parent
+                    // DOM object event handlers such as the page tab click 
event
+                    event.stopPropagation();
+                });
+            }
+            
+            // setup the Rate this widget menu item
+            $menuItemRate  = $("#widget-" + widgetId + "-menu-rate-item");
+            if (!$menuItemRate.hasClass("menu-item-disabled")) {
+                $menuItemRate.bind('click', function(event) {
+                    var regionWidget = 
rave.getRegionWidgetById(rave.getObjectIdFromDomId(this.id));
+
+                    // go to the widget detail page
+                    rave.viewWidgetDetail(regionWidget.widgetId, 
getCurrentPageId(), 'widgetRatings');
+                    // prevent the menu button click event from bubbling up to 
parent
+                    // DOM object event handlers such as the page tab click 
event
+                    event.stopPropagation();
+                });
+            }
         }
         
         /**


Reply via email to