Permalink
Browse files

Fixed #12882 - Moved the admin's jQuery into our own namespace to low…

…er the risk of a clash with third party apps that use jQuery.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12966 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 35f4150 commit 1fcf747b131308c5573de23858e6116f8630ee45 @jezdez jezdez committed Apr 13, 2010
@@ -76,7 +76,8 @@ def __init__(self, form, name=None, readonly_fields=(), fields=(), classes=(),
def _media(self):
if 'collapse' in self.classes:
- return forms.Media(js=['%sjs/collapse.min.js' % settings.ADMIN_MEDIA_PREFIX])
+ js = ['js/jquery.min.js', 'js/jquery.init.js', 'js/collapse.min.js']
+ return forms.Media(js=['%s%s' % (settings.ADMIN_MEDIA_PREFIX, url) for url in js])
return forms.Media()
media = property(_media)
@@ -108,4 +108,4 @@
allToggle: "#action-toggle",
selectedClass: "selected"
}
-})(jQuery);
+})(django.jQuery);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -24,4 +24,4 @@
}
);
});
-})(jQuery);
+})(django.jQuery);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -145,4 +145,4 @@
added: null, // Function called each time a new form is added
removed: null // Function called each time a form is deleted
}
-})(jQuery);
+})(django.jQuery);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,4 @@
+// Puts the included jQuery into our own namespace
+var django = {
+ "jQuery": jQuery.noConflict(true)
+};
@@ -31,4 +31,4 @@
dependencies.keyup(populate).change(populate).focus(populate);
});
};
-})(jQuery.noConflict());
+})(django.jQuery);
@@ -271,7 +271,7 @@ def _media(self):
js = ['js/core.js', 'js/admin/RelatedObjectLookups.js']
if self.actions is not None:
- js.extend(['js/jquery.min.js', 'js/actions.min.js'])
+ 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')
@@ -1199,7 +1199,7 @@ def __init__(self, parent_model, admin_site):
def _media(self):
from django.conf import settings
- js = ['js/jquery.min.js', 'js/inlines.min.js']
+ 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')
@@ -9,7 +9,7 @@
{% url admin:jsi18n as jsi18nurl %}
<script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
{% endif %}
- {{ media }}
+ {{ media.css }}
{% if not actions_on_top and not actions_on_bottom %}
<style>
#changelist table thead th:first-child {width: inherit}
@@ -19,13 +19,14 @@
{% block extrahead %}
{{ block.super }}
+{{ media.js }}
{% if action_form %}{% if actions_on_top or actions_on_bottom %}
<script type="text/javascript">
(function($) {
$(document).ready(function($) {
$("tr input.action-select").actions();
});
-})(jQuery.noConflict());
+})(django.jQuery);
</script>
{% endif %}{% endif %}
{% endblock %}
@@ -75,5 +75,5 @@
})
});
});
-})(jQuery.noConflict());
+})(django.jQuery);
</script>
@@ -121,5 +121,5 @@
})
});
});
-})(jQuery.noConflict());
+})(django.jQuery);
</script>
@@ -19,5 +19,5 @@
$(field.id).data('dependency_list', field['dependency_list'])
.prepopulate($(field['dependency_ids'].join(',')), field.maxLength);
{% endfor %}
-})(jQuery.noConflict());
+})(django.jQuery);
</script>

0 comments on commit 1fcf747

Please sign in to comment.