Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !1773

Support for decorating resources - revised

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Duncan Stuart requested to merge github/fork/dgmstuart/decorators-revised into main Sep 20, 2020
  • Overview 12
  • Commits 5
  • Pipelines 1
  • Changes 23

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
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/dgmstuart/decorators-revised