thoughtbot / thoughtbot/administrate
Provide more context to fields
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
A common issue for users of Administrate is that fields do not receive enough context. The most typical use case is that they cannot modify the configuration of a field depending on the current user: hiding/showing the field, showing different select options, etc.
These are some relevant issues, marked https://github.com/thoughtbot/administrate/labels/fields-context. Some of these refer directly to the lack of context, others are a bit more indirect but still related:
- https://github.com/thoughtbot/administrate/issues/1342
- https://github.com/thoughtbot/administrate/issues/1586
- https://github.com/thoughtbot/administrate/issues/1862
- https://github.com/thoughtbot/administrate/issues/1988
- https://github.com/thoughtbot/administrate/issues/2060
My initial intuition would be to pass the current controller down to fields, so that it can be used as provider of context. This can be passed in turn to the call-able that some options take, as well to new options such as hide_if or something like that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the linked fields-context issues to identify the recurring requirements around current-user access, conditional visibility, and dynamic select options. Then trace how fields receive configuration and how callable options are evaluated; done should provide a decided, documented context mechanism that supports these use cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100