Files
openfoodnetwork/app/assets/javascripts/admin/util.js.erb
Jean-Baptiste Bellet e06ea6ccd3 remove unused options
as we use flatpickr, we don't need these options
2021-02-08 22:09:06 +01:00

28 lines
836 B
Plaintext

$(document).ready(function(){
window.FLATPICKR_DATE_DEFAULT = {
dateFormat: Spree.translations.flatpickr_date_format,
locale: I18n.locale
}
window.FLATPICKR_DATETIME_DEFAULT = Object.assign(
{},
window.FLATPICKR_DATE_DEFAULT,
{
enableTime: true,
time_24hr: true,
}
);
flatpickr(".datetimepicker", window.FLATPICKR_DATETIME_DEFAULT);
$('a.close').click(function(event){
event.preventDefault();
$(this).parent().slideUp(250);
});
// Spree locates hidden with prev(), which with our current version of jQuery
// does not locate the hidden field, resulting in the delete failing. This
// handler updates the hidden field, fixing the problem.
$('body').on('click', 'a.remove_fields', function() {
$(this).next("input[type=hidden]").val("1");
return false;
});
});