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

Refactor admin/* routing logic from LeftAndMain into its own abstract class #1761

Closed
7 tasks done
GuySartorelli opened this issue May 30, 2024 · 1 comment
Closed
7 tasks done

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented May 30, 2024

We often subclass LeftAndMain just to get controllers routed in the admin section, and then hide them because they're not actually left and main sections.

We should instead have an abstract controller class we can use as the superclass for those which doesn't include all of the complexity of LeftAndMain.

Related

Notes

  • The exact name of the class isn't important - if you think of a better name, feel free.
    • I'm going with AdminController for now, as it's less likely to be confused with AdminRootController.

Acceptance criteria

  • A new abstract AdminRouteController class is created
  • AdminRootController checks for (non-abstract) subclasses of the new class instead of subclasses of LeftAndMain to set up routing rules
  • Methods, properties, and configuration required for routing or permissions are moved from LeftAndMain to the new class (see this comment for recommendations about this)
  • LeftAndMain subclasses the new class
  • Any controller in supported modules that currently subclasses LeftAndMain but only needs the routing and permissions logic is made to subclass the new class instead.
  • Any controller in supported modules that uses an admin route but which doesn't currently subclass LeftAndMain is made a subclass of the new class instead.
  • Documentation is updated to indicate best practice for controllers using a /admin/ route

PRs

kitchen sink run
Compare with CI run in silverstripe/recipe-kitchen-sink

@GuySartorelli
Copy link
Member Author

GuySartorelli commented Oct 14, 2024

Unfortunately most classes that subclass LeftAndMain but aren't left or main require form schema functionality. But this paves the way to liberate them.
See #1762 for the next stage in the process.

@GuySartorelli GuySartorelli removed their assignment Oct 16, 2024
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

3 participants