1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-29 19:02:21 +00:00
nk20/static/admin/js/change_form.js
Pierre-antoine Comby 70c09da9f8 add static files
2020-02-25 22:15:46 +01:00

21 lines
712 B
JavaScript

/*global showAddAnotherPopup, showRelatedObjectLookupPopup showRelatedObjectPopup updateRelatedObjectLinks*/
(function($) {
'use strict';
$(document).ready(function() {
var modelName = $('#django-admin-form-add-constants').data('modelName');
$('body').on('click', '.add-another', function(e) {
e.preventDefault();
var event = $.Event('django:add-another-related');
$(this).trigger(event);
if (!event.isDefaultPrevented()) {
showAddAnotherPopup(this);
}
});
if (modelName) {
$('form#' + modelName + '_form :input:visible:enabled:first').focus();
}
});
})(django.jQuery);