Skip to content

Commit

Permalink
feat: Add template for sidebar menu (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
xmnlab authored Nov 2, 2023
1 parent 578b283 commit f2b37ae
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 11 deletions.
5 changes: 5 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ nav:
- Ambassadors: 'programs/ambassadors/index.md'
- Incubator: 'programs/incubator/index.md'
- Internship: 'programs/internship/index.md'
# - Internship:
# - index: 'programs/internship/index.md'
# - "Mentors' Guide": 'programs/internship/guides/mentors/index.md'
# - "Interns' Guide": 'programs/internship/guides/interns/index.md'
# - "Cycle 2023-01": 'programs/internship/cycles/2023-01.md'
- Mentoring: 'programs/mentoring/index.md'
- "Package Support": 'programs/packaging-support/index.md'
- Partners: 'programs/partners/index.md'
Expand Down
1 change: 0 additions & 1 deletion pages/programs/internship/2023-01.md

This file was deleted.

9 changes: 9 additions & 0 deletions pages/programs/internship/cycles/2023-01.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "OSL Internship Program Guideline"
description: "Internship Program Guideline"
date: "2023-10-30"
authors: ["OSL Team"]
template: single-sidebar.html
---

# Internship Program 2023 - 01
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ title: "OSL Internship Program Guideline"
description: "Internship Program Guideline"
date: "2023-10-30"
authors: ["OSL Team"]
template: single-sidebar.html
---
7 changes: 7 additions & 0 deletions pages/programs/internship/guides/interns/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "OSL Internship Program Guideline"
description: "Internship Program Guideline"
date: "2023-10-30"
authors: ["OSL Team"]
template: single-sidebar.html
---
7 changes: 7 additions & 0 deletions pages/programs/internship/guides/mentors/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "OSL Internship Program Guideline"
description: "Internship Program Guideline"
date: "2023-10-30"
authors: ["OSL Team"]
template: single-sidebar.html
---
1 change: 1 addition & 0 deletions pages/programs/internship/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: "OSL Internship Program"
description: "Internship Program about"
date: "2023-08-24"
authors: ["OSL Team"]
# template: single-sidebar.html
---

# Open Science Labs Internship Program
Expand Down
28 changes: 19 additions & 9 deletions theme/base.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% set menu_2nd_level_selected = [] %}

<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -78,6 +80,9 @@
<div class="d-block d-sm-block d-md-none">
{% for nav_child in nav_item.children %}
{% if nav_child.title != "index" %}
{% if nav_item.active and nav_item == nav_child.parent %}
{{ menu_2nd_level_selected.append(nav_child) or "" }}
{% endif %}

<div class="nav {% if nav_child.active %}nav_active{% endif %}">
<a href="{{ nav_child.url|url }}" class="nav_item" title="{{ nav_child.title }}">
Expand Down Expand Up @@ -142,21 +147,26 @@
<nav class="nav d-none d-sm-none d-md-block">
<div class='nav_body nav_extra extra'>
<!-- SUB-MENU -->
{% if nav|length>1 %}
{% for nav_item in nav %}
{% if nav_item.active and nav_item.children %}
{% for nav_child in nav_item.children %}
{% if nav_child.title != "index" %}
{# Extract the url for a nested menu from the index child -#}
{% for nav_child in menu_2nd_level_selected -%}
{% if not nav_child.children -%}
<div class="{% if nav_child.active %}nav_active{% endif %}" style="border-top:1px solid white;">
<a href="{{ nav_child.url|url }}" class="nav_item" title="{{ nav_child.title }}">
{{ nav_child.title }}
</a>
</div>
{% endif%}
{% endfor %}
{% endif %}
{% else %}
{% for subsubmenu in nav_child.children -%}
{% if subsubmenu.title == "index" -%}
<div class="{% if nav_child.active %}nav_active{% endif %}" style="border-top:1px solid white;">
<a href="{{ subsubmenu.url|url }}" class="nav_item" title="{{ nav_child.title }}">
{{ nav_child.title }}
</a>
</div>
{% endif -%}
{% endfor %}
{% endif -%}
{% endfor %}
{% endif %}
</div>
</nav>
</header>
Expand Down
2 changes: 1 addition & 1 deletion theme/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</div>

<div class="col-md-75 col-xl-6 col-xxl-5 text-md-start text-center">
<h1 class="fw-bolder fs-2 fs-xxl-7 mb-2">Open ScienceLabs,</h1>
<h1 class="fw-bolder fs-2 fs-xxl-7 mb-2">Open Science Labs,</h1>
<p class="fs-1 mb-2">
La comunidad abierta para la ciencia y tecnología.
</p>
Expand Down
63 changes: 63 additions & 0 deletions theme/single-sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{% extends "base.html" %}

{% block header_extra %}
<style>
.main-nav>li>a {
color: #000000 !important;
}
</style>
{% endblock header_extra%}

{% block content %}

<section>
<div class="row pt-5">
{% block side_menu %}

{# prepare the nav3 content inside the side block -#}
{% set nav3_selected = [] -%}
{% for nav1 in nav -%}
{% for nav2 in (nav1.children or []) -%}
{% if nav2.active %}
{% for nav3 in (nav2.children or []) -%}
{% if nav3.title != "index" -%}
{{ nav3_selected.append(nav3) or "" -}}
{% endif %}
{% endfor -%}
{% endif -%}
{% endfor -%}
{% endfor %}

<div class="col">
<!-- List group for sidebar menu -->
<div class="list-group pt-4">
{% for nav3_item in nav3_selected %}
<a
href="/{{ nav3_item.url }}"
class="list-group-item list-group-item-action{% if nav3_item.active %} active{% endif %}"
{%- if nav3_item.active %} aria-current="true"{% endif -%}
>
{{ nav3_item.title }}
</a>
{% endfor %}
</div>

{% if menu_3rd_level_selected %}
<div>
{% for menu_item_3rd_level in menu_3rd_level_selected %}
<p>
<a href="{{ menu_item_3rd_level.url }}">{{ menu_item_3rd_level.title }}</a>
</p>
{% endfor %}
</div>
{% endif %}
</div>
{% endblock side_menu %}
<div class="col-md-9 mx-auto">
{% block content_inner %}
{{ page.content }}
{% endblock content_inner %}
</div>
</div>
</section>
{% endblock content %}

0 comments on commit f2b37ae

Please sign in to comment.