summaryrefslogtreecommitdiff
path: root/static/admin/js/prepopulate.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/admin/js/prepopulate.js')
-rw-r--r--static/admin/js/prepopulate.js34
1 files changed, 0 insertions, 34 deletions
diff --git a/static/admin/js/prepopulate.js b/static/admin/js/prepopulate.js
deleted file mode 100644
index 24f24f9..0000000
--- a/static/admin/js/prepopulate.js
+++ /dev/null
@@ -1,34 +0,0 @@
-(function($) {
- $.fn.prepopulate = function(dependencies, maxLength) {
- /*
- Depends on urlify.js
- Populates a selected field with the values of the dependent fields,
- URLifies and shortens the string.
- dependencies - array of dependent fields id's
- maxLength - maximum length of the URLify'd string
- */
- return this.each(function() {
- var field = $(this);
-
- field.data('_changed', false);
- field.change(function() {
- field.data('_changed', true);
- });
-
- var populate = function () {
- // Bail if the fields value has changed
- if (field.data('_changed') == true) return;
-
- var values = [];
- $.each(dependencies, function(i, field) {
- if ($(field).val().length > 0) {
- values.push($(field).val());
- }
- })
- field.val(URLify(values.join(' '), maxLength));
- };
-
- $(dependencies.join(',')).keyup(populate).change(populate).focus(populate);
- });
- };
-})(django.jQuery);