summaryrefslogtreecommitdiff
path: root/django/contrib
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2010-04-13 10:28:44 +0000
committerJannis Leidel <jannis@leidel.info>2010-04-13 10:28:44 +0000
commitc3d1267c15a77bb7bacb59e9e09eb38c32c03c2a (patch)
tree1f29e4eb475b3dd9b9cbc4c166a1a2c9962d09dc /django/contrib
parent1fcf747b131308c5573de23858e6116f8630ee45 (diff)
downloaddjango-c3d1267c15a77bb7bacb59e9e09eb38c32c03c2a.tar.gz
Also minify the JavaScript file for pre-populated form fields in the admin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib')
-rw-r--r--django/contrib/admin/media/js/compress.py5
-rw-r--r--django/contrib/admin/media/js/prepopulate.min.js1
-rw-r--r--django/contrib/admin/options.py4
3 files changed, 6 insertions, 4 deletions
diff --git a/django/contrib/admin/media/js/compress.py b/django/contrib/admin/media/js/compress.py
index bb39229745..5a70b20d7e 100644
--- a/django/contrib/admin/media/js/compress.py
+++ b/django/contrib/admin/media/js/compress.py
@@ -21,12 +21,13 @@ compress all jQuery based files of the admin app."""
compiler = os.path.expanduser(options.compiler)
if not os.path.exists(compiler):
- sys.exit("Compiler jar file %s not found. Please use the -c option to specify the path." % compiler)
+ sys.exit("Closure compiler jar file %s not found. Please use the -c option to specify the path." % compiler)
if not args:
if options.verbose:
sys.stdout.write("No filenames given; defaulting to admin scripts\n")
- args = [os.path.join(here, f) for f in ["actions.js", "collapse.js", "inlines.js"]]
+ args = [os.path.join(here, f) for f in [
+ "actions.js", "collapse.js", "inlines.js", "prepopulate.js"]]
for arg in args:
if not arg.endswith(".js"):
diff --git a/django/contrib/admin/media/js/prepopulate.min.js b/django/contrib/admin/media/js/prepopulate.min.js
new file mode 100644
index 0000000000..f1ca297b80
--- /dev/null
+++ b/django/contrib/admin/media/js/prepopulate.min.js
@@ -0,0 +1 @@
+(function(b){b.fn.prepopulate=function(d,f){return this.each(function(){var a=b(this);a.data("_changed",false);a.change(function(){a.data("_changed",true)});var c=function(){if(a.data("_changed")!=true){var e=[];d.each(function(){b(this).val().length>0&&e.push(b(this).val())});a.val(URLify(e.join(" "),f))}};d.keyup(c).change(c).focus(c)})}})(django.jQuery);
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index e46bd30193..e61b1ac9ef 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -274,7 +274,7 @@ class ModelAdmin(BaseModelAdmin):
js.extend(['js/jquery.min.js', 'js/jquery.init.js', 'js/actions.min.js'])
if self.prepopulated_fields:
js.append('js/urlify.js')
- js.append('js/prepopulate.js')
+ js.append('js/prepopulate.min.js')
if self.opts.get_ordered_objects():
js.extend(['js/getElementsBySelector.js', 'js/dom-drag.js' , 'js/admin/ordering.js'])
@@ -1202,7 +1202,7 @@ class InlineModelAdmin(BaseModelAdmin):
js = ['js/jquery.min.js', 'js/jquery.init.js', 'js/inlines.min.js']
if self.prepopulated_fields:
js.append('js/urlify.js')
- js.append('js/prepopulate.js')
+ js.append('js/prepopulate.min.js')
if self.filter_vertical or self.filter_horizontal:
js.extend(['js/SelectBox.js' , 'js/SelectFilter2.js'])
return forms.Media(js=['%s%s' % (settings.ADMIN_MEDIA_PREFIX, url) for url in js])