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

Inline the attachment form for taxon icons #3932

Merged

Conversation

elia
Copy link
Member

@elia elia commented Feb 12, 2021

Description

There's no explicit support for multiple taxon attachment anywhere else in the solidus codebase, and the attachment_partial_name was using "paperclip" even for active_storage.

Given attachment adapters are substantially dormant prior to Rails 6.1 we just need to explain the change in the changelog without the burden of an overcomplex deprecation cycle.

Original PR: #3308

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

@@ -20,7 +20,20 @@
</div>
<% end %>

<%= render "spree/admin/taxons/attachment_forms/#{f.object.attachment_partial_name}", f: f %>
<%= f.field_container :icon do %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO It still needs to iterate over the attachment definitions, it is pretty common to add more than icon attachment to taxons, hero image, mobile hero image, brand logo, etc

Copy link
Member Author

@elia elia Feb 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against that in principle, I just thought that if done it should have its own documentation/guide/tests with complete support.

On the same note might make sense to completely remove the icon from the taxon and let individual store add it if needed, allowing to manage the whole attachment configuration (e.g. pick sizes, attach a video instead, etc.).

In my experience it's always the case that a store has it's own rules for images and attachments.

@softr8 would any of these alternative work for you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi folks

I'm jumping in as we've added a lot of different attachments to our taxon object and do not use the default icon.
So as @elia, I'm in favour of removing the icon from the core model. And maybe move it into an extension if some store use only that icon, but my guess is that it won't be used that much.

Copy link
Member

@aldesantis aldesantis Feb 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to someone trying to change my mind, but it feels like removing support for multiple taxon attachments, even if not documented/explicitly supported, would effectively constitute a breaking change.

As soon as we release some kind of public API, we must assume that people are using it and we can't just pull the rug from under their feet, no matter how badly documented it is, or whether it was introduced intentionally or by mistake.

With that said, I agree that we should probably remove the default "icon" attachment altogether and simply let people define their own attachments — but I also think that should be considered a breaking change.

Curious to hear if anyone from @solidusio/core-team feels differently about this.

Copy link
Member Author

@elia elia Feb 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the usual deprecation/configuration harness
I added the required deprecations 👍

@elia elia marked this pull request as ready for review February 15, 2021 16:13
@elia elia force-pushed the elia/inline-the-taxon-attachment-form branch from a868fc3 to 9963a93 Compare February 26, 2021 09:57
@elia elia marked this pull request as draft February 26, 2021 09:57
@elia elia force-pushed the elia/inline-the-taxon-attachment-form branch from 9963a93 to 56ebf01 Compare February 26, 2021 10:15
@elia elia requested a review from aldesantis February 26, 2021 10:50
@elia elia marked this pull request as ready for review February 26, 2021 10:50
@@ -20,7 +20,24 @@
</div>
<% end %>

<%= render "spree/admin/taxons/attachment_forms/#{f.object.attachment_partial_name}", f: f %>
<% if Spree::Config.keep_legacy_backend_support_for_multiple_taxon_attachments %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really get why the preference is needed. I think deprecating the partial and those methods in the _attachment files is enough.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

There's no explicit support for multiple taxon attachment anywhere
else in the solidus codebase, and the attachment_partial_name was
using "paperclip" even for active_storage.
@elia elia force-pushed the elia/inline-the-taxon-attachment-form branch from 56ebf01 to b5baa36 Compare February 26, 2021 12:27
@elia elia requested a review from kennyadsl February 26, 2021 12:30
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@aldesantis aldesantis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @elia!

Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elia looks good! 👍

@kennyadsl
Copy link
Member

We are going to backport this one since 2.11 is ActiveStorage friendly

@kennyadsl kennyadsl added Needs Backport changelog:solidus_backend Changes to the solidus_backend gem labels Feb 26, 2021
@kennyadsl kennyadsl merged commit 51546c8 into solidusio:master Feb 26, 2021
@kennyadsl kennyadsl deleted the elia/inline-the-taxon-attachment-form branch February 26, 2021 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_backend Changes to the solidus_backend gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants