remove box title for dropdown
authorDavid Douard <david.douard@logilab.fr>
Thu, 08 Mar 2012 10:03:44 +0100
changeset 814 543a03522921
parent 813 7cfec468bed5
child 815 fe853df7286a
remove box title for dropdown
views/tracker.py
--- a/views/tracker.py	Thu Mar 08 10:03:44 2012 +0100
+++ b/views/tracker.py	Thu Mar 08 10:03:44 2012 +0100
@@ -13,6 +13,7 @@
 from cubicweb.web import uicfg
 from cubicweb.web.views import forms
 from cubicweb.web.formfields import StringField, DateField
+from cubicweb.web.views.formrenderers import EntityFormRenderer
 from cubicweb.web import formwidgets as fwdgs, httpcache
 
 from cubes.apycot.views.plots import ERROR_CODES
@@ -56,17 +57,16 @@
 class GraphRefreshForm(forms.FieldsForm):
     """Form to select what graph is being displayed"""
     __regid__ = 'select-graph'
-    graphs = StringField(widget=fwdgs.Select(attrs={'onchange':'this.form.submit()'}),
+    graphs = StringField(widget=fwdgs.Select(attrs={'onchange':'eval($("select#graphs").val())',
+                                                    'onkeyup':'this.blur();this.focus();'}),
                          label=_('Graph:'),
                          choices=available_graphs)
-    form_buttons = [fwdgs.SubmitButton(label=_('Apply'))]
+    form_buttons = []
+    form_renderer_id = 'nomaininfo'
 
-    @property 
-    def onsubmit(self):
-        return u'$("#graph-container").loadxhtml("/json")'
-
-
-
+class NoBoxEntityFormRenderer(EntityFormRenderer):
+    __regid__ = 'nomaininfo'
+    main_form_title = ''
 
 class ProjectTestResultsTab(EntityView):
     """display project's test execution results"""
@@ -75,10 +75,12 @@
 
     def entity_call(self, entity):
         self.w(u'<h3>%s</h3>' % _('Time taken by Test Executions'))
+        form = self._cw.vreg['forms'].select('select-graph', self._cw, rset=self.cw_rset)
+        form.render(w=self.w)
+        self._cw.add_onload('eval($("select#graphs").val())')
         self.w(u'''<table class="plotlegend"><tr>%s</tr></table>
         ''' % ''.join(['<td>%s</td><td style="background:%s">&nbsp;&nbsp;&nbsp;</td>' % (x,y) for x,y in  ERROR_CODES.items()]))
-        form = self._cw.vreg['forms'].select('select-graph', self._cw, rset=self.cw_rset)
-        form.render(w=self.w)
+        self.w(u'<div id="graph-container"></div>')
         rset = self._cw.execute(
             'Any T,TC,T,TB,TST,TET,TF, TS ORDERBY TST DESC WHERE '
             'T status TS, T using_config TC, T branch TB, '