Open tfe opened 9 years ago
I'm not sure what this does. How is this different from just overriding an attribute partial? Can you add an example to the README?
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.
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.