Open
Conversation
…lay using different partials than the normal attribute partial (which usually has form elements).
…pecifically in search results.
Contributor
|
I'm not sure what this does. How is this different from just overriding an attribute partial? |
Contributor
Author
|
It's been a long time since I looked at this and I'd need to refresh my memory about why I did it. It's possible that I overlooked an existing way of accomplishing the same thing. But I think my goal was to customize only the value part of the display, rather than the whole form field or label/value combination. And yes, I neglected documentation on all this stuff. It just came out of my own needs for a client project, so publicly consumable features wasn't my primary goal. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.