-
Notifications
You must be signed in to change notification settings - Fork 814
Initial docs for Bellissima Routes #6016
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fa1c424
Initial docs for routes
enkelmedia 4b31f60
Update 14/umbraco-cms/extending-backoffice/routes.md
alina-tincas a190946
Update 14/umbraco-cms/extending-backoffice/routes.md
alina-tincas 9ebc086
Update 14/umbraco-cms/extending-backoffice/routes.md
enkelmedia 9b15948
Update 14/umbraco-cms/extending-backoffice/routes.md
enkelmedia 7d3e748
Update 14/umbraco-cms/extending-backoffice/routes.md
enkelmedia 8c06849
Update 14/umbraco-cms/extending-backoffice/routes.md
enkelmedia 02f75c2
Update 14/umbraco-cms/extending-backoffice/routes.md
enkelmedia 06d3b9f
Update 14/umbraco-cms/extending-backoffice/routes.md
enkelmedia 510e045
Update 14/umbraco-cms/extending-backoffice/routes.md
enkelmedia c18bcb0
Update 14/umbraco-cms/extending-backoffice/routes.md
alina-tincas 8aa0736
Update 14/umbraco-cms/extending-backoffice/routes.md
alina-tincas 9f1c62e
Update 14/umbraco-cms/extending-backoffice/routes.md
alina-tincas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| --- | ||
| description: Get started with Routing in the backoffice. | ||
| --- | ||
|
|
||
| {% hint style="warning" %} | ||
| This page is a work in progress. It will be updated as the software evolves. | ||
| {% endhint %} | ||
|
|
||
| # Routing | ||
| The routing in the backoffice is flexible and customizable. In this article, you can find a couple of starting points for routing. | ||
|
|
||
| The overall **divider** is the [Section](extension-types/sections-and-trees/README.md) which is a `ManifestSection` extension type. It is also used internally by the following sections: Content, Media, Settings, Members, and so on. | ||
|
|
||
| Depending on which section you are working on, there are different options: | ||
|
|
||
| * **SectionView**: The [Section View](extension-types/sections-and-trees/section-view.md) is a view in a section and one of the automatic router extension types. It can be an entry point to a section. If a section has multiple views defined (or both dashboards and views) then the tabs and icons will be rendered. As some examples, you can check the **Packages** and **Member** sections. | ||
| * **Dashboard**: The [Dashboard](extension-types/dashboards.md) is an entry point to a section. If there is more than one section view or dashboard then the defined tabs and icons will be rendered to make it possible to navigate. | ||
| * **Workspace**: The [Workspace](extension-types/workspaces/README.md) concept has built-in features to facilitate editing of an entity of a certain entity type. It is used by many entities in the backoffice like content, media, content types, data types, dictionaries and so on. | ||
| * **Custom element**: A Custom Element is a section that can be configured to use any web component as the **entry point**. The `element()` can be configured in the manifest. By doing this we'll disable the possibility of using dashboards and section views for the section since they will not be automatically routed/rendered. This option should be used only when necessary. | ||
|
|
||
| ## Building routing | ||
| Almost any component can host routable sub-components by defining a list of routes and render a `umb-router-slot` element. Let's assume we have a **custom section** with pathname `custom-section` and a **section view** with pathname `organization`. In this context we can create an element with routes, like this: | ||
|
|
||
| ```typescript | ||
| @state() | ||
| _routes: UmbRoute[] = [ | ||
| { | ||
| // Adding :personId as a parameter | ||
| path: 'person/:personId', | ||
| component: () => import('./person.element.js'), | ||
| setup: (_component, info) => { | ||
|
|
||
| console.log('personId:',info.match.params.personId); | ||
| }, | ||
| }, | ||
| { | ||
| path: 'people', | ||
| component: () => import('./people.element.js'), | ||
| setup: (_component, info) => { | ||
|
|
||
| console.log('view-route-info',info); | ||
|
|
||
| }, | ||
| }, | ||
| { | ||
| path: '', | ||
| redirectTo: 'people', | ||
| }, | ||
| ]; | ||
| ``` | ||
| {% hint style="info" %} | ||
| The order in which the routes are defined is important as the first match will be used. So make sure to add more specific routes in the beginning. | ||
| {% endhint %} | ||
|
|
||
| In the render method of the element, render the `umb-router-slot`: | ||
|
|
||
| ```html | ||
| <umb-router-slot .routes=${this._routes}></umb-router-slot> | ||
| ``` | ||
|
|
||
| One can create links to allow navigation to a given route: | ||
|
|
||
| ```html | ||
| <a href="/umbraco/section/custom-section/organization/people">People</a> | ||
| <a href="/umbraco/section/custom-section/organization/person/1">Person 1</a> | ||
| <a href="/umbraco/section/custom-section/organization/person/2">Person 2</a> | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.