[Cubicweb] JQueryTimePicker patch

Vincent Godard vincent at secondweb.fr
Mon Mar 8 13:13:58 CET 2010


Hi,

jquery.timePicker offers the possibility to set the time separator
character. ( set to ':' by default)

We propose the following patch of web/formwidgets.py to let people set
this separator through the widget.


diff -r 4dd94a51c2c1 web/formwidgets.py
--- a/web/formwidgets.py	Mon Feb 22 17:50:45 2010 +0100
+++ b/web/formwidgets.py	Mon Mar 08 13:02:40 2010 +0100
@@ -451,16 +451,18 @@
     needs_js = ('jquery.timePicker.js',)
     needs_css = ('jquery.timepicker.css',)

-    def __init__(self, timestr=None, timesteps=30, **kwargs):
+    def __init__(self, timestr=None, timesteps=30, separator=u':', **kwargs):
         super(JQueryTimePicker, self).__init__(**kwargs)
         self.timestr = timestr
         self.timesteps = timesteps
+        self.separator = separator

     def _render(self, form, field, renderer):
         req = form._cw
         domid = field.dom_id(form, self.suffix)
-        req.add_onload(u'jqNode("%s").timePicker({selectedTime: "%s",
step: %s})' % (
-            domid, self.timestr, self.timesteps))
+        req.add_onload(u'jqNode("%s").timePicker({selectedTime: "%s", '
+                       u'step: %s, separator: "%s"})' % (
+            domid, self.timestr, self.timesteps, self.separator))
         if self.timestr is None:
             value = self.values(form, field)[0]
         else:



Regards,
Vincent, Secondweb



More information about the Cubicweb mailing list