django-cms / django-filer

File and Image Management Application for django
https://django-filer.readthedocs.io/
Other
1.78k stars 581 forks source link

thumbnail behavior in widget broken - does not disappear on clear #1505

Open gradel opened 1 month ago

gradel commented 1 month ago

Possible bug introduced here: https://github.com/django-cms/django-filer/commit/f919cbfce877c334ef7b33e329f2749f46fe5876#diff-b4f795d97b769d1875bca80a02e74dd46438e9ebd2a39a818d3999ad8fea0ca3L29 This leads to detail becoming True in file_icon templatetag and then in file_icon_context and get_aspect_ratio_and_download_url , where therefore download_url gets added to the context what in turn in file_icon.html lets the img element get selected which is lacking the thumbnail_img class. The filer_clear function in addons/widget.js thus can not find the img: var thumbnail = container.find('.thumbnail_img');.

cobia commented 2 weeks ago

I have somewhat similar problems. Needed to override admin_file.html and removed detail=True.

django==4.2.16 django-filer==3.2.3

mrbazzan commented 2 weeks ago

@gradel How do I recreate this issue? I would like to give it a try

gradel commented 2 weeks ago

@mrbazzan Just use the current version of django-filer. Then in the admin interface add a image, save the model (page or whatever the ImageField is attached to). When now clicking the red "clear" X the image doesn't disappear.

Screenshot from 2024-11-14 00-26-00

@cobia yes, I replaced "detail" with the former '80x80' string.

mrbazzan commented 1 week ago

@mrbazzan Just use the current version of django-filer. Then in the admin interface add a image, save the model (page or whatever the ImageField is attached to). When now clicking the red "clear" X the image doesn't disappear.

I have added an image, saved the model and can still remove the image. Am I doing something wrong?

Screenshot from 2024-11-14 00-26-00

I am unable to view this image.

gradel commented 1 week ago

@mrbazzan The issue is not about saving/removing the image from its model. Its just about the javascript driven behavior of the editing interface before saving. As soon as the remove button is clicked the thumbnail used to disappear immediately. And as soon as you chose another image a thumbnail of it used to be displayed immediately before any saving of the model.

Image is here too:

https://www.gerald-hien.de/media/filer_public/08/33/0833a824-125c-4998-8b99-909a24bf3d45/screenshot_from_2024-11-14_00-26-00.png

mrbazzan commented 1 week ago

@mrbazzan The issue is not about saving/removing the image from its model. Its just about the javascript driven behavior of the editing interface before saving. As soon as the remove button is clicked the thumbnail used to disappear immediately. And as soon as you chose another image a thumbnail of it used to be displayed immediately before any saving of the model.

Now I understand the problem. Thanks. 👍🏿

Image is here too: Thanks for the image