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
This commit is contained in:
parent
1fcf747b13
commit
c3d1267c15
|
@ -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"):
|
||||
|
|
|
@ -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);
|
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue