You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by rj...@apache.org on 2013/05/30 22:56:25 UTC

svn commit: r1488010 - in /bloodhound/trunk/bloodhound_dashboard/bhdashboard: templates/widget_macros.html web_ui.py

Author: rjollos
Date: Thu May 30 20:56:25 2013
New Revision: 1488010

URL: http://svn.apache.org/r1488010
Log:
Refs #526: Added a `hide_disabled` meta-parameter to widgets. Patch by Olemis.

Modified:
    bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/widget_macros.html
    bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py

Modified: bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/widget_macros.html
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/widget_macros.html?rev=1488010&r1=1488009&r2=1488010&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/widget_macros.html (original)
+++ bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/widget_macros.html Thu May 30 20:56:25 2013
@@ -26,7 +26,7 @@
 
   <!--! Helper functions (py:def) -->
 
-  <div py:def="widget_container(w)" role="application">
+  <div py:def="widget_container(w)" role="application" py:if="w.visible">
     <py:if test="w.title">
       <h3 style="display: inline;">${w.title}</h3>
       <py:if test="w.ctxtnav">
@@ -110,8 +110,12 @@
   <py:match path="bh:widget">
     <py:choose test="">
       <py:when test="bhdb"
-          py:with="wnm = unicode(select('@urn')); args = select('bh:args/bh:arg') or {}; altlinks = unicode(select('@altlinks')) != 'false'; ctxtnav = unicode(select('@ctxtnav')) != 'false';">
-        ${widget_container(bhdb.expand_widget(context, dict(args=[wnm, None, {'args': args}], altlinks=altlinks, ctxtnav=ctxtnav)))}
+               py:with="wnm = unicode(select('@urn'));
+                        args = select('bh:args/bh:arg') or {};
+                        altlinks = unicode(select('@altlinks')).lower() != 'false';
+                        ctxtnav = unicode(select('@ctxtnav')).lower() != 'false';
+                        hide_disabled = unicode(select('@hide_disabled')).lower() == 'true';">
+        ${widget_container(bhdb.expand_widget(context, dict(args=[wnm, None, {'args': args}], altlinks=altlinks, ctxtnav=ctxtnav, hide_disabled=hide_disabled)))}
       </py:when>
       <py:otherwise>
         ${bhnotfound()}

Modified: bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py?rev=1488010&r1=1488009&r2=1488010&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py (original)
+++ bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py Thu May 30 20:56:25 2013
@@ -312,7 +312,9 @@ class DashboardModule(Component):
                          'ctxtnav': w.get('ctxtnav', True) and
                                     data.get('ctxtnav') or None,
                          'altlinks': w.get('altlinks', True) and
-                                     data.get('altlinks') or None}
+                                     data.get('altlinks') or None,
+                         'visible': w['c'] is not None or
+                                    not w.get('hide_disabled', False)}
                      ] for k, w, (template, data, wctx) in data_strm)
 
     def alert_disabled(self):