emencia / cmsplugin-blocks

A set of DjangoCMS plugins for structured contents in CMS pages
https://cmspluginblocks.readthedocs.io/
MIT License
2 stars 0 forks source link

File inputs are not properly displayed from all plugins #20

Closed sveetch closed 1 year ago

sveetch commented 1 year ago

Describe the bug Card, Hero and Container plugins does not have the correct layout on input file as it could be expected from SmartMediaField usage.

It is related to this SmartMedia issue: https://github.com/sveetch/django-smart-media/issues/12

To Reproduce

  1. Create a plugin content with a Card, Hero or Container
  2. The file input is working but not displayed as it should;
  3. Save the plugin content and open it again for edition;
  4. The file input is still not displayed as it should

Expected behavior All input file managed with SmartMediaField should look like the preview from https://django-smart-media.readthedocs.io/en/latest/references.html#preview

Desktop (If applicable):

Versions:

Additional context There is two problems here:

  1. Plugin form miss the definition of widget in their metaclass attribute widgets , SmartMedia probably can not resolve this since it is probably related to Django Admin/CMS plugin. We have to define this widget on plugin forms;
  2. Once defined, the form field endorse SmartMedia widget render but it miss needed CSS+Js as it is reported in SmartMedia issue 12 (as given in introduction);
  3. Once asset have been forced on the plugin form, there is a problem with the widget template that miss variable(s) to be able to display the preview;

Album and Slider are not subject to this since they work a little bit differently with their plugin form.

sveetch commented 1 year ago

Fixed in 1.1.0-pre.1 with an upgrade to django-smart-media>=0.3.0 to inherit from SmartAdminMixin in plugin