Skip to content

Commit

Permalink
(SIO-2082) Improved portal navigation
Browse files Browse the repository at this point in the history
I have added breadcrumbs and modified left menu navigation and navbar
menu nabigation on portals both on small and large devices.

Change-Id: I322c286915e1fe0755b56c6918f430d14a4565a1
  • Loading branch information
Norbi-S committed Apr 17, 2018
1 parent 1f779ca commit 63c53db
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 84 deletions.
5 changes: 5 additions & 0 deletions oioioi/portals/templates/portals/base-node.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
{% endblock %}

{% block main-content %}
<div class="hidden-sm hidden-xs">
{% block portal_breadcrumbs %}
{% include "portals/breadcrumbs.html" %}
{% endblock %}
</div>
{% generate_menu portal_admin_menu %}
{% if menu %}
<ul class="nav nav-tabs nav-margin">
Expand Down
17 changes: 17 additions & 0 deletions oioioi/portals/templates/portals/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% load i18n portal_url simple_tags %}

<!-- https://stackoverflow.com/questions/12194573/bootstrap-dropdown-within-breadcrumb -->

<ol class="breadcrumb">
{% for node in current_node.get_ancestors_including_self %}
<li class="breadcrumb-item {% if node == current_node %}active{% endif %}">
{% if node != current_node %}
<a href="{% portal_url node=node %}">
{% endif %}
{{ node.full_name }}
{% if node != current_node %}
</a>
{% endif %}
</li>
{% endfor %}
</ol>
53 changes: 10 additions & 43 deletions oioioi/portals/templates/portals/menu.html
Original file line number Diff line number Diff line change
@@ -1,48 +1,15 @@
{% load i18n portal_url simple_tags %}

<div class="panel panel-default">
<div class="panel-heading">{% trans "Navigation" %}</div>
<div class="list-group">
{% if current_node.is_root_node and current_node.is_leaf_node %}
<a class="list-group-item active" href="{% portal_url node=current_node %}">{{ current_node.full_name }}</a>
{% else %}
{% for node in current_node.get_ancestors_including_self %}
{% if not node.is_leaf_node %}
{% if node.get_siblings %}
<div class="list-group-item dropdown">
<button class="btn dropdown-toggle {% if node == current_node %}btn-primary{% else %}btn-default{% endif %}"
type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{ node.full_name }} <span class="glyphicon glyphicon-chevron-right pull-right"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right">
{% for sibling in node.get_siblings_including_self %}
<li><a href="{% portal_url node=sibling %}">{{ sibling.full_name }}</a></li>
{% endfor %}
</ul>
</div>
{% else %}
<a href="{% portal_url node=node %}" class="list-group-item {% if node == current_node %}active{% endif %}">
{{ node.full_name }}
</a>
{% endif %}
{% endif %}
{% endfor %}
</div>
</div>
<div class="panel panel-default">
{% if not current_node.is_leaf_node %}
<div class="panel-heading">{{ current_node.full_name }}</div>
<div class="list-group"></div>
{% for node in current_node.get_children %}
<a class="list-group-item" href="{% portal_url node=node %}">{{ node.full_name }}</a>
{% endfor %}
{% else %}
<div class="panel-heading">{{ current_node.parent.full_name }}</div>
<div class="list-group"></div>
{% for node in current_node.get_siblings_including_self %}
<a class="list-group-item {% if node == current_node %}active{% endif %}"
href="{% portal_url node=node %}">{{ node.full_name }}</a>
{% endfor %}
{% endif %}
<div class="panel-heading">Menu</div>
{% if current_node.is_leaf_node %}
<p class="text-center">
<small><em>no child nodes</em></small>
</p>
{% else %}
<div class="list-group"></div>
{% for node in current_node.get_children %}
<a class="list-group-item" href="{% portal_url node=node %}">{{ node.full_name }}</a>
{% endfor %}
{% endif %}
</div>
55 changes: 14 additions & 41 deletions oioioi/portals/templates/portals/navbar-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,18 @@
<span class="glyphicon glyphicon-menu-hamburger"></span>
</a>
<ul class="dropdown-menu">
{% if current_node.is_root_node and current_node.is_leaf_node %}
<li><a class="active" href="{% portal_url node=current_node %}">{{ current_node.full_name }}</a></li>
{% else %}
{% for node in current_node.get_ancestors_including_self %}
{% if not node.is_leaf_node %}
{% if node.get_siblings %}
{% for sibling in node.get_siblings_including_self %}
<li><a href="{% portal_url node=sibling %}">
<span class="glyphicon glyphicon-chevron-right"></span>
{{ sibling.full_name }}
</a></li>
{% endfor %}
<li class="divider" role="separator"></li>
<li><a href="#" class="dropdown-toggle" data-toggle="dropdown">
{{ node.full_name }}
</a></li>
{% else %}
<li><a href="{% portal_url node=node %}">
{{ node.full_name }}
</a></li>
{% endif %}
{% endif %}
{% endfor %}

{% if not current_node.is_leaf_node %}
{% for node in current_node.get_children %}
<li><a href="{% portal_url node=node %}">
<span class="glyphicon glyphicon-chevron-right"></span>
{{ node.full_name }}
</a></li>
{% endfor %}
{% else %}
{% for node in current_node.get_siblings_including_self %}
<li><a href="{% portal_url node=node %}">
<span class="glyphicon glyphicon-chevron-right"></span>
{{ node.full_name }}
</a></li>
{% endfor %}
{% endif %}
{% endif %}
{% for ancestor in current_node.get_ancestors %}
<li class="hidden-md hidden-lg"><a href="{% portal_url node=ancestor %}">
{{ ancestor.full_name }}
</a></li>
<li class="divider hidden-md hidden-lg" role="separator"></li>
{% endfor %}
<li><a class="active" href="{% portal_url node=current_node %}">{{ current_node.full_name }}</a></li>
{% for child in current_node.get_children %}
<li><a href="{% portal_url node=child %}">
<span class="glyphicon glyphicon-chevron-right"></span>
{{ child.full_name }}
</a></li>
{% endfor %}
</ul>
</div>
</div>

0 comments on commit 63c53db

Please sign in to comment.