Customizable attribute value display #159
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wanted a clean way to customize the display of attribute values for (primarily) the index/search results view and for un-editable fields on the show page.
What I've ended up creating seems pretty close to acting like a decorator/presenter, but it does fit in nicely with the established models in Upmin. It uses the same rendering pipeline and partial naming scheme. Partials should be created under
app/views/upmin/partials/attribute_values.Perhaps someone has a better idea of how to implement this, perhaps leveraging Draper or one of the existing decorator gems? One thing that would be nice is an ability to customize the attribute label along with the value, but under this model it would require yet another folder full of (usually) one-line partials.