Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support for using non namespaced jQuery #1

Closed
nikdoof opened this Issue Mar 31, 2013 · 1 comment

Comments

Projects
None yet
2 participants

nikdoof commented Mar 31, 2013

I noticed while installing this today that it picks up the Django jQuery for widgets, this is fine for admin but if you're not using the namespaced version on custom apps it'll fail.

Quick hack to get around it is to assign jQuery to the namespace (excuse my poor JS skills):

var django = {'jQuery': $}

Ideally the widget should check for a global version before switching to the Django namespaced version, that way it'll work for custom apps and won't flounder in Admin.

I was thinking something along the lines of the following:

if (typeof django == 'undefined' || typeof django.jQuery == 'undefined' ) {
    jq = $;
} else {
    jq = django.jQuery
}
Owner

barraq commented Apr 8, 2013

Hi @nikdoof, could you try the small patch that i just committed on the master? I just added the following:

var ee = {
  'jQuery': (typeof window.django != 'undefined') ? django.jQuery : jQuery.noConflict(true)
};

(function($) {
  ...                
})(ee.jQuery);

@barraq barraq closed this Apr 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment