From 77a1d2bd4d87e49dac1b0af6509c3f55fec74a0b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier Date: Tue, 22 Jun 2021 12:39:21 +0200 Subject: [PATCH] feature: allow external link on menu --- README.md | 19 +++++++++++++++++++ src/views/partials/menu-left.pug | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/README.md b/README.md index beea84a..5ef74a3 100644 --- a/README.md +++ b/README.md @@ -734,6 +734,25 @@ Module declaration, on `config.json`: You need the experimental routing enabled to have a Profile Directory. +### Add link to left menu + +``` + { + "type": "link", + "parameters": { + "icon": "icon-docs", + "name": "some.path", + "target": "https://startinblox.com" + }, + "route": true + }, +``` + +Where: +* `parameters.icon` is a valid simple line icon +* `parameters.name` is a path to a translation. You can create your own with the lang component +* `parameters.target` is the target URL + ### Route generation Orbit will, by default, generate an unique route for every of your module. You can customize this route by setting a `route` attribute on your module declaration. diff --git a/src/views/partials/menu-left.pug b/src/views/partials/menu-left.pug index bb40e84..2fd8c5a 100644 --- a/src/views/partials/menu-left.pug +++ b/src/views/partials/menu-left.pug @@ -168,6 +168,12 @@ solid-router#navbar-router(default-route=defaultRoute) div.segment.icon.icon-small.icon-calendar div.segment.text-uppercase.text-letter-spacing-large(data-trans="menuLeft.events") div.divider + if component.type == "link" + a.menu-tab.segment.full.padding-xsmall.text-semibold.text-color-white.heading-active.bg-color-heading.transparent-background.hover.active(href=component.parameters.target, target="_blank") + div.segment.margin-right-xxsmall + div.segment.icon.icon-small&attributes({"class": component.parameters.icon}) + div.segment.text-uppercase.text-letter-spacing-large(data-trans=component.parameters.name) + div.divider if componentSet.has('registering') solid-route(name='join-community', use-id, hidden) solid-route(name='login', hidden)