A bare website showing various examples of creating content editable menus.
- Create a database named 'Cofoundry.Samples.Menus' and check the Cofoundry connection string in the appsettings.json file is correct for your SQL Server instance
- Run the website and navigate to "/admin", which will display the setup screen
- Enter an application name and setup your user account. Submit the form to complete the site setup.
- Either log in and enter your own data or follow the steps below to import some test data
To get you started we've put together some optional test data:
- Run
InitData\Init.sql
script against your db to populate some initial pages - Either restart the site, or go to the settings module in the admin panel and clear the cache.
Each menu type is created using Custom Entities to store the data and asp.net View Components to render the data.
The simple menu demonstrates how you can build a content manageable list of pages using the [PageCollection]
attribute.
The nested menu demonstrates how you can build menus with a pre-defined number of menu levels. This is achieved using nested data models and the [NestedDataModelCollection]
attribute.
This example only contains one nested menu level, but you could define more by creating and nested more menu types. To use an indeterminate number of menu levels (i.e. a tree structure) have a look at the multi-level menu example.
The multi-level menu example demonstrates how to create a menu with an unlimited number of menu levels (i.e a tree structure) using a recursive data model definition.