Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: jQuery loss (can't use jQuery after import image_cropping.js) #69

Closed
FedeG opened this issue Mar 30, 2015 · 10 comments
Closed

BUG: jQuery loss (can't use jQuery after import image_cropping.js) #69

FedeG opened this issue Mar 30, 2015 · 10 comments

Comments

@FedeG
Copy link

FedeG commented Mar 30, 2015

Can't use jQuery after: "jQuery.noConflict(true)(function() {image_cropping.init();}); "
in: https://github.com/jonasundderwolf/django-image-cropping/blob/master/image_cropping/static/image_cropping/image_cropping.js

@FedeG
Copy link
Author

FedeG commented Mar 30, 2015

Because "jQuery.noConflict(true)" overwrites $ and jQuery with previous version.
The correct usage is jQuery.noConflict() directly

View details in: http://sundropsoftware.com/how-to-use-jquery-noconflict-the-right-way/

@FedeG FedeG changed the title jQuery loss (can't use jQuery after import image_cropping.js) BUG: jQuery loss (can't use jQuery after import image_cropping.js) Mar 30, 2015
@anrie
Copy link
Member

anrie commented Mar 31, 2015

There is an older issue (#19) concerning the same subject.

All we do is to remove the jQuery that we included to make the widget work.
So you shouldn't rely on this jQuery version for anything you do in the admin.
Nevertheless django.jQuery and every jQuery you included separately should stay intact.

The only potential problem I can see is the recently added option to make Image Cropping NOT include its own jQuery version: https://github.com/jonasundderwolf/django-image-cropping#custom-jquery
Have you eventually set IMAGE_CROPPING_JQUERY_URL to None?

@FedeG
Copy link
Author

FedeG commented Mar 31, 2015

Yes, i tried to configure the IMAGE_CROPPING_JQUERY_URL to None but neither worked.

Additionally, i tried to configure the IMAGE_CROPPING_JQUERY_URL with a valid url jQuery and load jQuery after but neither worked.

@anrie
Copy link
Member

anrie commented Apr 1, 2015

I can see the issue in the first case and we'll look into it.

Concerning the second case: As I said, this is the intended behaviour.
Either you include another jQuery yourself or you use Django's jQuery which is available as django.jQuery

@RaphaelKimmig
Copy link

I'm having the same issue.
Using jquery.noconflict removes the existing jquery. When combined with IMAGE_CROPPING_JQUERY_URL = None this means no more jquery for me :-(

@anrie
Copy link
Member

anrie commented Aug 28, 2015

@RaphaelKimmig Yes, I can see the issue.
There should be a check in image_cropping.js if IMAGE_CROPPING_JQUERY_URL was set to None and if this is the case, we shouldn't use .noConflict() so the JQuery provided by the user is left intact.

However I start thinking that the None-Option was maybe not best idea in the first place and we should simply restore the old behavior.

@anrie
Copy link
Member

anrie commented Aug 30, 2015

@RaphaelKimmig
Copy link

@anrie Indeed it does. Thank you very much :-)

On another note - when installing django-image-cropping directly from git (via setup.py install) the static files are not included in the app folder. I noticed they are not listed in the manifest. Is that a bug or am I doing something wrong here?

@anrie
Copy link
Member

anrie commented Sep 9, 2015

Okay, there is a new release (1.0.2) that should solve this issue.

@RaphaelKimmig The static files should now be included if you install directly from Github.

@anrie anrie closed this as completed Sep 9, 2015
@RaphaelKimmig
Copy link

@anrie Awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants