On 08/10/2013 10:58 PM, Chris Travers wrote:
Yes, we can do this, and adding a class name is probably good for themers. It's actually more work to hook up on the JS side than just outputting a data-dojo-type attribute on the HTML tag (as I'm already doing). Dojo supports this really simple declarative syntax -- we can override the base Dojo objects to easily set other defaults, and then just leverage the parser to hook everything up.
Dojo widgets actually encapsulate a template for the HTML it generates, and there's a lot of theming capability built into those templates (and 4 or 5 different themes shipping with the core). So whether or not we explicitly add a class to these elements, there's a lot of room for theming.
That sounds great! If this can be turned into a JS object on the page, this should work fine. Simplest approach is probably to inline this into a script loaded on the page -- the Dojo parser will run after the DOM is ready, so this object should be available by then. Or we can load it as a callback, and require that data in elements that need it -- I would expect this would be a lot of them, though, so this probably isn't good from a performance standpoint, doing an extra Ajax callback on every page...
Oh, right. Yes, wasn't thinking of output. The dojo stuff can handle converting all input to yyyy-mm-dd format, but we'll still have to localize output on reports. To make the client side easier, we should, however, use yyyy-mm-dd format to provide the initial value of date inputs... Dojo can then convert to the appropriate locale format.