summaryrefslogtreecommitdiff
path: root/website/static/admin/js/change_form.js
diff options
context:
space:
mode:
Diffstat (limited to 'website/static/admin/js/change_form.js')
-rw-r--r--website/static/admin/js/change_form.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/website/static/admin/js/change_form.js b/website/static/admin/js/change_form.js
new file mode 100644
index 0000000..994b523
--- /dev/null
+++ b/website/static/admin/js/change_form.js
@@ -0,0 +1,20 @@
+/*global showAddAnotherPopup, showRelatedObjectLookupPopup showRelatedObjectPopup updateRelatedObjectLinks*/
+
+(function($) {
+ 'use strict';
+ $(document).ready(function() {
+ var modelName = $('#django-admin-form-add-constants').data('modelName');
+ $('.add-another').click(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);