Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Fachgruppenwebseite Metadaten
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fginfo
Fachgruppenwebseite Metadaten
Commits
b62e0e81
Verified
Commit
b62e0e81
authored
2 years ago
by
Jake
Browse files
Options
Downloads
Patches
Plain Diff
improved menu rendering
parent
8c33aafa
No related branches found
No related tags found
No related merge requests found
Pipeline
#313231
passed
2 years ago
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theme/templates/base.html
+2
-22
2 additions, 22 deletions
theme/templates/base.html
theme/templates/macros/nav.html
+24
-0
24 additions, 0 deletions
theme/templates/macros/nav.html
with
26 additions
and
22 deletions
theme/templates/base.html
+
2
−
22
View file @
b62e0e81
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
{%- import 'macros/cards.html' as cards with context -%}
{%- import 'macros/cards.html' as cards with context -%}
{%- import 'macros/renderers.html' as render with context -%}
{%- import 'macros/renderers.html' as render with context -%}
{%- import 'macros/content_renderer.html' as content_renderer with context -%}
{%- import 'macros/content_renderer.html' as content_renderer with context -%}
{%- import 'macros/nav.html' as nav with context -%}
<html
lang=
"{%- block html_lang -%}{{ l }}{%- endblock html_lang -%}"
>
<html
lang=
"{%- block html_lang -%}{{ l }}{%- endblock html_lang -%}"
>
<head>
<head>
...
@@ -40,28 +41,7 @@
...
@@ -40,28 +41,7 @@
<label
for=
"show-header-menu"
class=
"show-header-menu"
>
☰
</label>
<label
for=
"show-header-menu"
class=
"show-header-menu"
>
☰
</label>
<input
type=
"checkbox"
id=
"show-header-menu"
role=
"button"
>
<input
type=
"checkbox"
id=
"show-header-menu"
role=
"button"
>
<label
for=
"show-header-menu"
class=
"show-header-menu-bg"
>
</label>
<label
for=
"show-header-menu"
class=
"show-header-menu-bg"
>
</label>
<nav>
{{ nav.render_menu(config.menuitems, l) }}
<ul>
{% for item in config.menuitems -%}
{%- if item.tag is defined -%}
{%- call(tagtitle, tagcolor, tagurl, tagpage, tagpages) get.tag_by_name(item.tag, l) -%}
<li
style=
"--category-color: {{ tagcolor }}"
><a
href=
"{{ siteurl }}/{{ tagurl }}"
>
{{ tagtitle|e }}
</a></li>
{%- endcall -%}
{%- elif item.slug is defined -%}
{%- call(page) get.page_by_slug(item.slug, l) -%}
{%- call(cattitle, catcolor, caturl, catpage, catpages) get.tag_by_name(page.category, l) -%}
<li
style=
"--category-color: {{ catcolor }}"
><a
href=
"{{ siteurl }}/{{ page.url }}"
>
{{ page.title|e }}
</a></li>
{%- endcall -%}
{%- endcall -%}
{%- else -%}
<br
/>
<strong>
ERROR: menuitems: Cannot parse item: {{ item|string|e }}
</strong><br
/>
<br
/>
{%- endif -%}
{#- TODO add active class if this is the current site -#}
{%- endfor %}
</ul>
</nav>
</div>
</div>
<main>
<main>
{% block content %}
{% block content %}
...
...
This diff is collapsed.
Click to expand it.
theme/templates/macros/nav.html
0 → 100644
+
24
−
0
View file @
b62e0e81
{%- import 'macros/link.html' as link with context -%}
{%- macro render_menu(items, lang) -%}
<nav>
<ul>
{% for item in items -%}
{{ render_menu_item(item, lang) }}
{%- endfor %}
</ul>
</nav>
{%- endmacro -%}
{%- macro render_menu_item(item, lang) -%}
{%- if item is string -%}
{%- set url = item -%}
{%- call(parsedurl, anchor, reflang, is_external, reftype, refid, refpage, tagcattitle, tagcatcolor) link.parse_url(url, lang) -%}
<li
style=
"--category-color: {{ tagcatcolor }}"
>
{{ link.render(url, None, lang) }}
</li>
{%- endcall -%}
{%- else -%}
TODO: handle custom menu items
{%- endif -%}
{%- endmacro -%}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment