Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GuySartorelli opened this issue May 30, 2024 · 0 comments
Open

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented May 30, 2024

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants