-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Making taxon form to render attachment definitions dynamically
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.
- Loading branch information
Showing
3 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
backend/app/views/spree/admin/taxons/attachment_forms/_paperclip.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<% f.object.class.attachment_definitions.each do |attachment, definition| %> | ||
<%= f.field_container attachment do %> | ||
<%= f.label attachment %><br> | ||
<%= f.file_field attachment %> | ||
<%= image_tag f.object.send(attachment, definition[:default_style]) if f.object.send(attachment).present? %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters