2010-10-15 05:48:39 +02:00
|
|
|
(function($) {
|
2011-08-16 04:58:17 +02:00
|
|
|
/**
|
|
|
|
* Initialize and open a datepicker
|
|
|
|
* live() doesn't have "onmatch", and jQuery.entwine is a bit too
|
|
|
|
* heavyweight for this, so we need to do this onclick.
|
|
|
|
*/
|
|
|
|
var fields = $('.field.date input.text');
|
|
|
|
|
|
|
|
fields.siblings("button").addClass("ui-icon ui-icon-calendar");
|
|
|
|
|
|
|
|
fields.live('click', function() {
|
2011-04-22 13:28:26 +02:00
|
|
|
var holder = $(this).parents('.field.date:first'), config = holder.metadata({type: 'class'});
|
2010-10-19 00:22:56 +02:00
|
|
|
if(!config.showcalendar) return;
|
2010-10-15 05:48:39 +02:00
|
|
|
|
|
|
|
if(config.locale && $.datepicker.regional[config.locale]) {
|
|
|
|
config = $.extend(config, $.datepicker.regional[config.locale], {});
|
|
|
|
}
|
2011-08-16 04:58:17 +02:00
|
|
|
|
2010-10-15 05:48:39 +02:00
|
|
|
$(this).datepicker(config);
|
|
|
|
$(this).datepicker('show');
|
|
|
|
});
|
|
|
|
}(jQuery));
|