incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject svn commit: r1307987 - in /incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard: ./ layouts/ layouts/templates/
Date Sun, 01 Apr 2012 01:36:26 GMT
Author: gjm
Date: Sun Apr  1 01:36:26 2012
New Revision: 1307987

URL: http://svn.apache.org/viewvc?rev=1307987&view=rev
Log:
Dashboard code import: BH_Dashboard: Initial version of Bootstrap button toolbar layout. Toolbar
only

Added:
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar.html
  (with props)
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar_full.html
  (with props)
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
  (with props)
Modified:
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/bootstrap.py
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_grid.html
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/bootstrap.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/bootstrap.py?rev=1307987&r1=1307986&r2=1307987&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/bootstrap.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/bootstrap.py Sun Apr
 1 01:36:26 2012
@@ -39,20 +39,57 @@ class BootstrapLayout(Component):
         """Supported layouts.
         """
         yield 'bootstrap_grid'
+        yield 'bootstrap_btnbar'
 
     def get_layout_description(self, name):
         """Return plain text description of the layout with specified name.
         """
-        return "Bootstrap grid system " \
-                "http://twitter.github.com/bootstrap/scaffolding.html#layouts"
+        return { 
+                'bootstrap_grid' : "Bootstrap grid system " \
+                    "http://twitter.github.com/bootstrap/scaffolding.html#layouts",
+                'bootstrap_btnbar' : "Button toolbar acting as tabs nav"
+            }[name]
 
     def expand_layout(self, name, context, options):
         """Specify bootstrap layout template
         """
         req = context.req
         add_stylesheet(req, 'dashboard/bootstrap.css')
-        return {
-              'template' : options.get('embed') and \
-                      'bs_grid.html' or 'bs_grid_full.html',
+
+        if name == 'bootstrap_btnbar':
+            self._process_btnbar(options)
+
+        results = {
+                ('bootstrap_grid', False) : {
+                        'template' : 'bs_grid_full.html',
+                    },
+                ('bootstrap_grid', True) : {
+                        'template' : 'bs_grid.html',
+                    },
+                ('bootstrap_btnbar', False) : {
+                        'template' : 'bs_btnbar_full.html',
+                    },
+                ('bootstrap_btnbar', True) : {
+                        'template' : 'bs_btnbar.html',
+                    },
             }
+        return results[( name , bool(options.get('embed')) )]
+
+    # Internal methods
+    def _process_btnbar(self, options):
+        """Determine toolbar groups
+        """
+        layout_data = options['schema']
+        orig_tb = layout_data.get('toolbar', [])
+        ready = layout_data.get('ready')
+        if not ready:
+            layout_data['toolbar'] = tb = [[]]
+            last_group = tb[0]
+            for caption, idx in orig_tb:
+                if caption == '|' :
+                    last_group = []
+                    tb.append(last_group)
+                else:
+                    last_group.append({ 'caption' : caption, 'widget' :idx })
+        layout_data['ready'] = True
 

Added: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar.html?rev=1307987&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar.html
(added)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar.html
Sun Apr  1 01:36:26 2012
@@ -0,0 +1,18 @@
+<html
+    xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:py="http://genshi.edgewall.org/"
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    py:strip="" >
+
+  <xi:include href="widget_macros.html" />
+
+  <div class="btn-toolbar">
+    <div data-toggle="buttons-radio" class="btn-group offset1"
+        py:for="g in layout.toolbar" >
+      <a href="#" class="btn" py:for="tb_item in g">
+        ${tb_item.caption}
+      </a>
+    </div>
+  </div>
+</html>
+

Propchange: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar_full.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar_full.html?rev=1307987&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar_full.html
(added)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar_full.html
Sun Apr  1 01:36:26 2012
@@ -0,0 +1,22 @@
+<!DOCTYPE html
+    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:py="http://genshi.edgewall.org/"
+      xmlns:xi="http://www.w3.org/2001/XInclude">
+  <xi:include href="layout.html" />
+  <head>
+    <title>$title</title>
+  </head>
+
+  <body>
+    <xi:include href="bs_btnbar.html" />
+    <div id="ft" class="row">
+      <div id="help">
+        <strong>Note:</strong> See 
+        <a href="${href.wiki('BloodhoundDashboard')}">BloodhoundDashboard</a>
+        for help on using the dashboard.
+      </div>
+    </div>  
+  </body>
+</html>

Propchange: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar_full.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_btnbar_full.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_grid.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_grid.html?rev=1307987&r1=1307986&r2=1307987&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_grid.html
(original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/bs_grid.html
Sun Apr  1 01:36:26 2012
@@ -4,29 +4,7 @@
     xmlns:xi="http://www.w3.org/2001/XInclude"
     py:strip="" >
 
-  <div py:def="widget_container(w)" role="application">
-    <h1 style="display: inline;">${w.title}</h1>
-    <py:if test="w.ctxtnav">
-      <py:for each="itm in w.ctxtnav">
-        &nbsp;&nbsp;$itm
-      </py:for>
-    </py:if>
-    &nbsp;&nbsp;
-    <div class="btn-group" py:if="w.altlinks" style="display: inline-block;">
-      <a class="btn btn-mini dropdown-toggle" href="#" data-toggle="dropdown">
-        <i class="icon-download-alt"></i>Download<b class="caret"></b>
-      </a>
-      <ul class="dropdown-menu">
-        <li py:for="idx, link in enumerate(w.altlinks)"
-            class="${first_last(idx, w.altlinks)}">
-          <a rel="nofollow" href="${link.href}" class="link.class"
-              py:content="link.title"></a>
-        </li>
-      </ul>
-    </div>
-    <br/>
-    ${w.content}
-  </div>
+  <xi:include href="widget_macros.html" />
 
   <div py:def="bsdiv(ui)" class="${ui._class}">
     <py:choose test="">

Added: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html?rev=1307987&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
(added)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
Sun Apr  1 01:36:26 2012
@@ -0,0 +1,30 @@
+<html 
+    xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:py="http://genshi.edgewall.org/"
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    py:strip="" >
+
+  <div py:def="widget_container(w)" role="application">
+    <h1 style="display: inline;">${w.title}</h1>
+    <py:if test="w.ctxtnav">
+      <py:for each="itm in w.ctxtnav">
+        &nbsp;&nbsp;$itm
+      </py:for>
+    </py:if>
+    &nbsp;&nbsp;
+    <div class="btn-group" py:if="w.altlinks" style="display: inline-block;">
+      <a class="btn btn-mini dropdown-toggle" href="#" data-toggle="dropdown">
+        <i class="icon-download-alt"></i>Download<b class="caret"></b>
+      </a>
+      <ul class="dropdown-menu">
+        <li py:for="idx, link in enumerate(w.altlinks)"
+            class="${first_last(idx, w.altlinks)}">
+          <a rel="nofollow" href="${link.href}" class="link.class"
+              py:content="link.title"></a>
+        </li>
+      </ul>
+    </div>
+    <br/>
+    ${w.content}
+  </div>
+</html>

Propchange: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py?rev=1307987&r1=1307986&r2=1307987&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/web_ui.py Sun Apr  1 01:36:26
2012
@@ -154,20 +154,17 @@ class DashboardModule(Component):
                         },
                         {
                             'args' : ['Container', None, 
-                                    {'args' : {'layout' : 'bootstrap_grid',
+                                    {'args' : {'layout' : 'bootstrap_btnbar',
                                             'schema' : """
                                             {
-                                              "div" : [{
-                                                "_class" : "row",
-                                                "div" : [{
-                                                    "_class" : "span3",
-                                                    "widgets" : [0]
-                                                  },
-                                                  {
-                                                    "_class" : "span5",
-                                                    "widgets" : [1]
-                                                  }]
-                                                }],
+                                              "toolbar" : [
+                                                  ["Products", null],
+                                                  ["My Tickets", 1],
+                                                  ["All tickets", 2],
+                                                  ["|", null],
+                                                  ["Projects", null],
+                                                  ["Components", 0]
+                                                ],
                                               "widgets" : [
                                                 {
                                                   "args" : [



Mime
View raw message