Skip to content

Commit

Permalink
Merge pull request #304 from PetrDlouhy/bootstrap5
Browse files Browse the repository at this point in the history
add bootstrap5 templates
  • Loading branch information
idlesign committed Aug 6, 2021
2 parents 8685369 + d3fe2d4 commit 7a1a429
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 5 deletions.
16 changes: 15 additions & 1 deletion docs/source/templatesmod.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Nevertheless pay attention that menu template also uses two CSS classes marking
* **current_item** — marks item in the tree, corresponding to current page;
* **current_branch** — marks all ancestors of current item, and current item itself.

If needed, you can set extra CSS classes to the *ul* element with `extra_class_ul` variable. For example::

{% with extra_class_ul="flex-wrap flex-row" %}
{% sitetree_menu from "footer_3" include "trunk,topmenu" template "sitetree/menu_bootstrap5.html" %}
{% endwith %}


.. _overriding-built-in-templates:

Expand Down Expand Up @@ -125,7 +131,11 @@ The following templates are bundled with SiteTree:

* `sitetree/menu_bootstrap4.html`

The same as above but for Bootstrap version 3.
The same as above but for Bootstrap version 4.

* `sitetree/menu_bootstrap5.html`

The same as above but for Bootstrap version 5.

* `sitetree/menu_bootstrap_dropdown.html`

Expand All @@ -139,6 +149,10 @@ The following templates are bundled with SiteTree:

The same as above but for Bootstrap version 4.

* `sitetree/menu_bootstrap5_dropdown.html`

The same as above but for Bootstrap version 5.

* `sitetree/menu_bootstrap_navlist.html`

This template can be used to construct a Bootstrap Nav list.
Expand Down
2 changes: 1 addition & 1 deletion sitetree/templates/sitetree/menu_bootstrap.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load sitetree %}
<ul class="nav">
<ul class="nav {{ extra_class_ul }}">
{% for item in sitetree_items %}
<li class="{% if item.has_children %}dropdown{% endif %} {% if item.is_current or item.in_current_branch %}active{% endif %}">
<a href="{% if item.has_children %}#{% else %}{% sitetree_url for item %}{% endif %}" {% if item.has_children %}class="dropdown-toggle" data-toggle="dropdown"{% endif %}>
Expand Down
2 changes: 1 addition & 1 deletion sitetree/templates/sitetree/menu_bootstrap3.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load sitetree %}
<ul class="nav navbar-nav">
<ul class="nav navbar-nav {{ extra_class_ul }}">
{% for item in sitetree_items %}
<li class="{% if item.has_children %}dropdown{% endif %} {% if item.is_current or item.in_current_branch %}active{% endif %}">
<a href="{% if item.has_children %}#{% else %}{% sitetree_url for item %}{% endif %}" {% if item.has_children %}class="dropdown-toggle" data-toggle="dropdown"{% endif %}>
Expand Down
2 changes: 1 addition & 1 deletion sitetree/templates/sitetree/menu_bootstrap4.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load sitetree %}
<ul class="navbar-nav mr-auto">
<ul class="navbar-nav mr-auto {{ extra_class_ul }}">
{% for item in sitetree_items %}
<li class="nav-item {% if item.has_children %}dropdown{% endif %}">
<a href="{% if item.has_children %}#{% else %}{% sitetree_url for item %}{% endif %}" class="nav-link {% if item.is_current or item.in_current_branch %}active{% endif %} {% if item.has_children %}dropdown-toggle" aria-haspopup="true" id="navitem-{{ item.id }}" data-toggle="dropdown{% endif %}">
Expand Down
13 changes: 13 additions & 0 deletions sitetree/templates/sitetree/menu_bootstrap5.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% load sitetree %}
<ul class="navbar-nav mr-auto {{ extra_class_ul }}">
{% for item in sitetree_items %}
<li class="nav-item {% if item.has_children %}dropdown{% endif %}">
<a href="{% if item.has_children %}#{% else %}{% sitetree_url for item %}{% endif %}" class="nav-link {% if item.is_current or item.in_current_branch %}active{% endif %} {% if item.has_children %}dropdown-toggle" aria-haspopup="true" id="navitem-{{ item.id }}" data-bs-toggle="dropdown{% endif %}">
{{ item.title_resolved }}
</a>
{% if item.has_children %}
{% sitetree_children of item for menu template "sitetree/menu_bootstrap5_dropdown.html" %}
{% endif %}
</li>
{% endfor %}
</ul>
6 changes: 6 additions & 0 deletions sitetree/templates/sitetree/menu_bootstrap5_dropdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% load sitetree %}
<div class="dropdown-menu" aria-labelledby="navitem-{{ item.id }}">
{% for item in sitetree_items %}
<a class="dropdown-item {% if item.is_current or item.in_current_branch %}active{% endif %}" href="{% sitetree_url for item %}" {% if item.hint %}title="{{ item.hint }}"{% endif %}>{{ item.title_resolved }}</a>
{% endfor %}
</div>
2 changes: 1 addition & 1 deletion sitetree/templates/sitetree/menu_foundation.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load sitetree %}
<ul class="nav-bar">
<ul class="nav-bar {{ extra_class_ul }}">
{% for item in sitetree_items %}
<li class="{% if item.is_current or item.in_current_branch %}active{% endif %} {% if item.has_children %}has-flyout{% endif %}">
<a href="{% if item.has_children %}#{% else %}{% sitetree_url for item %}{% endif %}">{{ item.title_resolved }}</a>
Expand Down

0 comments on commit 7a1a429

Please sign in to comment.