MrDys / blacklight

Blacklight Plugin
http://projectblacklight.org/
Other
1 stars 1 forks source link

easy custom field value method checking #557

Open MrDys opened 12 years ago

MrDys commented 12 years ago

CODEBASE-386:

MrDys commented 12 years ago

Original reporter: tastyhat

MrDys commented 12 years ago

tastyhat: this is about making it such that there is an auto-checked method for adding custom logic to what value should be displayed.

such that if there was a field defined in config such :holdings_info

and there was a helper function: holdings_info_field_custom_value

it would call that rather than document.get(:holdings_info) to get the value.

MrDys commented 12 years ago

tastyhat: draper / use configuration instead

MrDys commented 12 years ago

jrochkind: theoretically both could be supported, if you're interested in writing it.

I could imagine that in display field config, there's an optional:

helper_method => :holdings_info_field_custom_value

Or even, if you want to stick to convention-over-configuraton for method name, also supporting a default:

helper_method => true  # means, yes, use a helper method, use conventional name to look it up

And ALSO another optional config value:

presenter_class => SomeDraperClass

or whatever.

You don't neccesarily need to implement both right away, I personally think it's fine to use helper methods here, and if that's the feature you want, I think it's fine to add to BL, so long as it's not crazy complicated code or something (it won't be).