-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Making taxon form to render attachment definitions dynamically #3308
Making taxon form to render attachment definitions dynamically #3308
Conversation
<%= image_tag f.object.icon(:mini) if f.object.icon_present? %> | ||
<% f.object.class.attachment_definitions.each do |attachment, definition| %> | ||
<%= f.field_container attachment do %> | ||
<%= f.label attachment %><br /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tag br
is a void element, it must end with >
and not />
.
@softr8 can you please handle the small nitpick from Hound? Apart from that, I think this is a great improvement, thank you for noticing that there was room for it 👍 ❤️ |
7cfc7b5
to
746fde7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's something I'd like to discuss, in the meantime thanks for the contribution @softr8!
<%= f.label :icon %><br /> | ||
<%= f.file_field :icon %> | ||
<%= image_tag f.object.icon(:mini) if f.object.icon_present? %> | ||
<% f.object.class.attachment_definitions.each do |attachment, definition| %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this work for Paperclip only? I don't think ActiveStorage has a attachment_definitions
class method. Maybe we should also make this partial loaded conditionally if we are using the paperclip adapter, similar to what we do for payment method partials. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aha!! Good idea, just adjusted my code to support multiple attachment adapters 👍
746fde7
to
7bf0161
Compare
Solidus now allows to inject easily more attachment definitions via configurable modules, if a user adds a new attachment, it would have to override the partial _form to add this new attachment, this change takes all definitions and render the inputs dinalycally, it also allows to specify what partial to render depending on the attachment adapter.
7bf0161
to
333c192
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is a great change!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@softr8 thank you 👍
Description
Solidus now allows to inject easily more attachment definitions via
configurable modules (#3237), if a user adds a new attachment, it would be needed
to override the partial _form and add this new attachment, this change
takes all definitions and render the inputs dynamically.
Checklist: