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
  • !191

Improve default resource display

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge gw-display-resource into master Nov 08, 2015
  • Overview 7
  • Commits 1
  • Pipelines 0
  • Changes 54

Created by: gracewashere

Closes #129 (closed)

Problem:

Administrate relies on #to_s to display resources throughout the system. In order to get Administrate working correctly, developers must define #to_s on all models that will be displayed in the admin dashboard.

This process is not documented, can be confusing, and gets in the way of a zero-configuration dashboard.

Solution:

Add Administrate::BaseDashboard#display_resource, which takes a resource and returns a sensible string representation. Devs can overwrite this method on a per-dashboard basis to customize how their resources are displayed.

In order to document this method, we generate comments in each dashboard class that follow the format:

  # Overwrite this method to customize how line items are displayed
  # across all pages of the admin dashboard.
  #
  # def display_resource(line_item)
  #   "LineItem ##{line_item.id}"
  # end

TODO

  • Add comments to generated dashboards
  • CHANGELOG
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: gw-display-resource