[dd-sso/api] Cover all cases, add docs for megamenu internal links

These documentation convering these changes should be visible in:
https://dd.digitalitzacio-democratica.xnet-x.net/docs/customising.ca/
merge-requests/43/head
Evilham 2022-11-23 12:44:33 +01:00
parent 97b4916983
commit ca8b29dd5e
No known key found for this signature in database
GPG Key ID: AE3EE30D970886BF
2 changed files with 69 additions and 9 deletions

View File

@ -78,15 +78,22 @@ class Menu:
apps_internal = []
for app in system["apps_internal"]:
if app["href"].startswith('/') and 'subdomain' in app:
app["href"] = (
"https://"
+ app["subdomain"]
+ "."
+ application.config["DOMAIN"]
+ app["href"]
)
del app["subdomain"]
app_href = app["href"] if app.get("href", "") else "/"
# Only modify href if it is a relative URL
if app_href.startswith("/") or app_href.startswith("#"):
# Get the subdomain part, not using it if it is missing
subdomain_part = ""
if "subdomain" in app:
# We pop 'subdomain' so it is not in apps_internal
# note this includes a trailing dot if defined
subdomain_part = f"{ app.pop('subdomain') }.".lstrip(".")
# Actually construct the full URL
app["href"] = "".join([
"https://",
subdomain_part,
application.config["DOMAIN"],
app_href,
])
apps_internal.append(app)
with open(r"menu/custom.yaml") as yml:

View File

@ -1,5 +1,58 @@
# Personalitzacions
## Enllaços al Megamenú
[El Megamenú][megamenu-internes] te dues parts:
- [Interna / de sistema][megamenu-internes]
- [Externa / configurable][megamenu-externes]
[megamenu-internes]: https://dd.digitalitzacio-democratica.xnet-x.net/manual-usuari/menu-principal-dd/
[megamenu-externes]: https://dd.digitalitzacio-democratica.xnet-x.net/manual-usuari/eines-externes-megamenu/
Els enllaços [externs del Megamenú][megamenu-externes] es poden modificar fent
servir la interfície a `https://admin.DOMINI`, els enllaços
[interns][megamenu-internes] no.
En ambdós casos es pot fer aprovisionament o personalització avançada d'aquests
enllaços fent servir els fitxers `custom/menu/custom.yaml` i
`custom/menu/system.yaml`.
Un exemple d'aquests fitxers, i el seu contingut per defecte es troba a
`custom.sample/menu/custom.yaml` i `custom.sample/menu/system.yaml`.
### `custom/menu/system.yaml`
Pel fitxer `custom/menu/system.yaml` cal tenir en compte que en funció dels
valors de `href` i i la presència o absència de `subdomain`, els enllaços es
generen de manera diferent.
També cal tenir en compte que les adreces relatives han de començar amb
`/` o `#`.
```yaml
# Exemple de apps_internal a custom/menu/system.yaml
apps_internal:
# Això resulta en un enllaç https://moodle.DOMINI/ADREÇA
- subdomain: moodle
href: /ADREÇA
icon: fa fa-graduation-cap
name: Aules
shortname: courses
# Això resulta en un enllaç https://ADREÇA_EXTERNA
# perquè href és un enllaç absolut
- href: https://ADREÇA_EXTERNA
icon: fa fa-book
name: Manual
shortname: manual
# Això resulta en un enllaç https://DOMINI/ADREÇA_DOMINI_PRINCIPAL
- href: /ADREÇA_DOMINI_PRINCIPAL
icon: fa fa-rss
name: Quant a
shortname: about
```
## Peu de pàgina en el login
El peu de pàgina fa part del tema de login de Keycloak, per tal de modificar-lo,