mirror of
https://github.com/nanoy42/coope
synced 2024-11-05 01:16:28 +00:00
20 lines
712 B
JavaScript
20 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);
|