Currently it's possible to modify how different types of field are presented (with attribute partials), and to modify the title used when displaying a resource (with display_resource
), BUT there's no straightforward way to modify how an individual field is displayed, beyond creating a custom field type for each field (which feels like a bit of a hack).
One use case for this is when a resource has a field which stores some kind of numeric code, and it's desirable to display a text description of the code instead of the code itself.
This PR is an attempt to resurrect https://github.com/thoughtbot/administrate/pull/843 (big credit to @pustomytnyk). It started with a rebase of that PR, but has been heavily modified - in particular the refactorings required to move responsibility for resources into the Collection
page have been separated out into their own commits.
The overall change is kind of complicated and touches a lot of files, but please see the individual commit messages for a description of the what's and why's of each step.
There are a number of bits of remaining awkwardness and awkward naming which I'd love to get some input on.
TODO:
-
Document internal API changes -
Check the first page of reverse dependencies for any breaking changes: -
administrate-field-password -
administrate-field-active_storage -
administrate-field-enum -
administrate-field-nested_has_many -
administrate-field-belongs_to_search -
administrate-field-image -
administrate-field-carrierwave -
administrate-field-paperclip -
administrate-field-date_picker -
administrate_exportable -
administrate-field-ckeditor -
administrate-field-jsonb -
administrate-field-money -
administrate-field-country -
administrate-field-lat_lng -
administrate-field-json -
administrate-field-simple_markdown -
administrate-field-boolean_to_yes_no -
administrate-base_controller -
administrate-field-select -
administrate-field-boolean_emoji -
administrate-field-lazy_belongs_to -
administrate-field-jsontable -
administrate-field-hidden -
administrate-field-time -
administrate-field-refile -
administrate-field-froala -
administrate-field-state_machine -
administrate-field-collection_select -
administrate-field-globalize-string
-