Skip to content

Make an abstract class for managing hierarchical data in a tree view #2951

Open
@GuySartorelli

Description

SiteTree is not the only model with hierarchical data. It would be good to be able to manage other hierarchical data in the same way we currently manage SiteTree records.

Related

Notes

  • The exact name of the class isn't important - if you think of a better name, feel free. Though note this class does go hand-in-hand with the Hierarchy extension.
  • There's a RecordTypes() method and a getRecordTypes() method which seem to have different purposes. Maybe rename one of those to something different.

Acceptance Criteria

  • Make a new abstract HierarchyModelAdmin class and move all of the code from CMSMain into it. This class should live in the admin module
  • getCMSTreeTitle() in HierarchyModelAdmin returns something sensible instead of the site name (this is used as the "root" of the tree)
  • Make CMSMain subclass HierarchyModelAdmin and only give it what it needs as a unique admin section (e.g. url segment, section title, model class)
  • Delete the subclasses of CMSMain and instead make them action methods implemented in HierarchyModelAdmin
    • Make sure the correct (renamed) templates are used for these actions
  • Rename all of the CMSMain templates so that they are named after the new class instead, and move them to the admin module
  • Any JS and CSS which applied to HierarchyModelAdmin is moved to the admin module
  • The HierarchyModelAdmin works without needing anything from the cms module
  • Double check the extends() and invokeWithExtensions() that are being called on records and see if they would be better as extension hooks on the new class instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions