← Back to team overview

schooltool-developers team mailing list archive

Re: jQuery UI datepicker customization

 

On 05/20/2011 12:54 PM, Douglas Cerna wrote:
Hey everybody.

I just updated my jquery-ui branch (lp:~replaceafill/schooltool/schooltool_jquery-ui) to include the jQuery UI datepicker widget for our date fields.

Here's what I did:

1. Added the jQuery UI translations files for the datepicker. There are 61! translations files.

2. Removed every reference to zc.datetime: widget base class, widget custom template, package registration in schooltool/common/configure.zcml and setup.py

3. Added a custom class "datepicker-field" to our custom date widget.

4. Created a list of available languages from the translations files. I just copied this approach from the zc.datetimewidget implementation, but I don't like it much.

5. Added a viewlet to the JavaScript manager that extracts the language from the browser locale and inserts the appropriate translation file. This viewlet also binds the datepicker widget to the widget class "datepicker-field". Justas, could you please help me to clean this viewlet code?

6. Broke the tests! I'm getting LocationErrors related to the use of the expression: context/++resource++jquery-ui/theme/jquery-ui.css mostly in the timetable tests. I guess it's a skin problem. I'll fix this.

And that's it. A localized datepicker is shown for the date fields. I updated the testing instance (http://69.164.203.135:7080) so you can see it. Remember to change the language and see the datepicker getting translated.

Let me know what you think.

  Well, nice!

  Gives some food for thought.  Let me get back to you on Mon.

Justas



References