RaythaHQ / raytha

Raytha is a powerful CMS with an easy-to-use interface and fast performance. It offers custom content types, a template engine, and various access controls. It supports multiple storage providers and an automatically generated REST API. Upgrade your development workflow with Raytha.
MIT License
143 stars 30 forks source link

Menus feature #182

Open apexdodge opened 3 months ago

apexdodge commented 3 months ago

The purpose of this feature is so that menus throughout a Raytha site need not be hardcoded into templates. They can be generated dynamically and managed through a UI similar to WordPress.

Task:

"Navigation Menus" should be added to the left side navigation of the admin panel and only accessible if the logged in administrator belongs to a role with the "Manage Content Types" permission. Route should be /raytha/menus

The data model should be:

Menu:

We should be able to "Set as main menu" similar to what we do with home page.

image

The list of menu items should be a nav item on the right side following our pattern:

image

MenuItem:

It should follow the same pattern as a content type settings where you can add a menu item or reorder the menu items.

image

You cannot delete the main menu. There should always be 1 main menu.

Two built-in liquid functions should be added to Templates functionality.

The function should pull the respective menu and generate a tree structure (use recursion) to create an object that can be used to render the necessary HTML for the template creator.

The render object should render as:

And this MenuItems should be the top-level menu items rendered as:

We need to update the:

GET Requests only: