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 @@ + + + + +
+ +
+ + 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 @@ + + + + + $title + + + + +
+
+ Note: See + BloodhoundDashboard + for help on using the dashboard. +
+
+ + 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="" > -
-

${w.title}

- - -   $itm - - -    -
- - Download - - -
-
- ${w.content} -
+
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 @@ + + +
+

${w.title}

+ + +   $itm + + +    +
+ + Download + + +
+
+ ${w.content} +
+ 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" : [