MINOR: add jquery ui calendar icon to date picker form

This commit is contained in:
Will Rossiter 2011-08-16 14:58:17 +12:00 committed by Ingo Schommer
parent 2bf2c3a15f
commit 65b3c3a894

View File

@ -1,14 +1,21 @@
(function($) {
$('.field.date input.text').live('click', function() {
/**
* 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() {
var holder = $(this).parents('.field.date:first'), config = holder.metadata({type: 'class'});
if(!config.showcalendar) return;
if(config.locale && $.datepicker.regional[config.locale]) {
config = $.extend(config, $.datepicker.regional[config.locale], {});
}
// 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.
$(this).datepicker(config);
$(this).datepicker('show');
});