changeset 814:77ff2e80b69d

Make size and style of charts configurable (applying patch from #426).
author hodgestar
date Wed, 15 Sep 2010 20:49:01 +0000
parents 29a5793c452a
children 947eb92a7400
files bitten/templates/bitten_config.html bitten/web_ui.py
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/templates/bitten_config.html
+++ b/bitten/templates/bitten_config.html
@@ -107,7 +107,7 @@
     </py:when><py:when test="'view_config'">
       <div id="charts"><py:for each="chart in config.charts">
         <h3 id="chart_${chart.category}_title" style="text-align: center;"/>
-        <div id="chart_${chart.category}" style="width:220px;height:220px;"></div>
+        <div id="chart_${chart.category}" style="${chart.style}"></div>
         <script type="text/javascript">
           $(document).ready(function() { 
                
--- a/bitten/web_ui.py
+++ b/bitten/web_ui.py
@@ -20,6 +20,7 @@
 from genshi.builder import tag
 from trac.attachment import AttachmentModule, Attachment
 from trac.core import *
+from trac.config import Option
 from trac.mimeview.api import Context
 from trac.resource import Resource
 from trac.timeline import ITimelineEventProvider
@@ -150,6 +151,11 @@
 
     implements(IRequestHandler, IRequestFilter, INavigationContributor)
 
+    # Configuration options
+
+    chart_style = Option('bitten', 'chart_style', 'height: 220px; width: 220px;', doc=
+        """Style attribute for charts. Mostly useful for setting the height and width.""")
+
     # INavigationContributor methods
 
     def get_active_navigation_item(self, req):
@@ -427,6 +433,7 @@
                         chart_generators.append({
                             'href': req.href.build(config.name, 'chart/' + category),
                             'category': category,
+                            'style': self.config.get('bitten', 'chart_style'),
                         })
             data['config']['charts'] = chart_generators
 
Copyright (C) 2012-2017 Edgewall Software