Valider 6b9d3aab rédigé par RastaPopoulos's avatar RastaPopoulos
Parcourir les fichiers

fix #4069 : harmonisation entre la manière de chercher les options pour les...

fix #4069 : harmonisation entre la manière de chercher les options pour les champs date et heure, utilisation de la fonction data() puisque c'est ce qu'on cherche, commentaires. Il y a toujours un pas par défaut global en amont et définissable avec heure_pas dans l'inclusion, mais on harmonise avec la recherche d'options directement sur les champs, et directement avec le nom des options. Du coup au passage on ajoute startTime et endTime.
parent 2776e336
Chargement en cours
Chargement en cours
Chargement en cours
Chargement en cours
+35 −8
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -33,21 +33,48 @@ function date_picker_options(){
		yearRange: "c-60:c+40"
	};
}
function time_picker_options() {
	return {
		step: #ENV{heure_pas,30},
	};
}
function date_picker_init(){
	// Initialisation du sélecteur sur les champs de date
	jQuery('input.date').not('.datePicker')
		.addClass('datePicker').each(function() {
			// Pour chaque champ, on regarde s'il y a des options propres
			var options = {showOn: 'button'};
			if (jQuery(this).attr('data-startDate'))
				options.minDate = jQuery(this).attr('data-startDate');
			if (jQuery(this).attr('data-endDate'))
				options.maxDate = jQuery(this).attr('data-endDate');
			if (jQuery(this).attr('data-yearRange'))
				options.yearRange = jQuery(this).attr('data-yearRange');
			if (jQuery(this).data('startDate')) {
				options.minDate = jQuery(this).data('startDate');
			}
			if (jQuery(this).data('endDate')) {
				options.maxDate = jQuery(this).data('endDate');
			}
			if (jQuery(this).data('yearRange')) {
				options.yearRange = jQuery(this).data('yearRange');
			}
			jQuery(this)
				.datepicker(jQuery.extend(date_picker_options(),options))
				.trigger('datePickerLoaded');
		});
	jQuery("input.heure").not('.timePicker').addClass('timePicker').timePicker({step:#ENV{heure_pas,30}});
	
	// Initialisation du sélecteur sur les champs d'heure
	jQuery("input.heure").not('.timePicker')
		.addClass('timePicker').each(function() {
			// Pour chaque champ, on regarde s'il y a des options propres
			var options = {};
			if (jQuery(this).data('startTime')) {
				options.startTime = jQuery(this).data('startTime');
			}
			if (jQuery(this).data('endTime')) {
				options.endTime = jQuery(this).data('endTime');
			}
			if (jQuery(this).data('step')) {
				options.step = jQuery(this).data('step');
			}
			jQuery(this)
				.timePicker(jQuery.extend(time_picker_options(), options));
		});
}
var date_picker_loading;
if (window.jQuery){