Skip to content

Commit

Permalink
Breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp committed Jun 22, 2024
1 parent cb5fac0 commit c3bd8f5
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 7 deletions.
38 changes: 38 additions & 0 deletions frontend/src/style/misago/breadcrumbs.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
margin-bottom: @line-height-computed / 2;
padding: 0;
list-style: none;
white-space: nowrap;
}

.breadcrumbs-item a {
display: flex;
flex-wrap: nowrap;
align-items: center;
text-decoration: none;

Expand All @@ -42,3 +44,39 @@
.breadcrumbs-item .material-icon {
margin-right: 4px;
}

// Fix breadcrumbs displayed in toolbar
.toolbar-item .breadcrumbs {
width: 100%;
white-space: nowrap;
margin: 0;
}

.toolbar-item .breadcrumbs-item {
margin-bottom: 0;
}

// Make breadcrumbs responsive
.breadcrumbs-compact {
display: none;
}

@media screen and (max-width: @screen-xs-max) {
.breadcrumbs {
display: none;
}

.breadcrumbs-compact {
display: flex;
}

.breadcrumbs-item {
flex: 0 1 auto;
overflow: hidden;
}

.breadcrumbs-item:last-child {
flex-shrink: 0;
margin-right: 0;
}
}
4 changes: 4 additions & 0 deletions frontend/src/style/misago/toolbar.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
margin: 0 floor(@grid-gutter-width * -0.25);
}

.toolbar-over-footer {
margin-bottom: @line-height-computed * -2.5;
}

.toolbar-section {
justify-items: center;
display: flex;
Expand Down
8 changes: 4 additions & 4 deletions misago/static/misago/admin/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion misago/static/misago/admin/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion misago/static/misago/css/misago.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion misago/static/misago/css/misago.css.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions misago/templates/misago/categories/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,19 @@
{% else %}
{% include "misago/categories/header.html" %}
{% endif %}

<div class="container page-container">

{% pluginoutlet CATEGORIES_LIST_START %}
{% if categories_list %}
{% include "misago/categories/categories_list_body.html" with items=categories_list %}
{% else %}
{% include "misago/categories/empty_message.html" %}
{% endif %}
{% pluginoutlet CATEGORIES_LIST_END %}

{% include "misago/gototop_toolbar.html" %}

</div>
</div>
{% endblock content %}
26 changes: 26 additions & 0 deletions misago/templates/misago/category/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<ul class="breadcrumbs hidden-xs">
<li class="breadcrumbs-item">
<a href="/">
<span class="material-icon">chevron_right</span>
<span class="breadcrumbs-item-name">{{ main_menu_index.label }}</span>
</a>
</li>
{% for item in breadcrumbs %}
<li class="breadcrumbs-item">
<a href="{{ item.url }}">
<span class="material-icon"{% if item.color %} style="color: {{ item.color }};"{% endif %}>label</span>
<span class="breadcrumbs-item-name">{{ item.name }}</span>
</a>
</li>
{% endfor %}
</ul>
<ul class="breadcrumbs breadcrumbs-compact">
{% for item in breadcrumbs %}
<li class="breadcrumbs-item">
<a href="{{ item.url }}">
<span class="material-icon"{% if item.color %} style="color: {{ item.color }};"{% endif %}>label</span>
<span class="breadcrumbs-item-name">{{ item.short_name|default:item.name }}</span>
</a>
</li>
{% endfor %}
</ul>
8 changes: 8 additions & 0 deletions misago/templates/misago/category/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@
<div class="page-header-banner page-header-banner-category">
<div class="page-header-banner-bg-image">
<div class="page-header-banner-bg-overlay">
{% include "misago/category/breadcrumbs.html" %}
<h1>{{ category.name }}</h1>
</div>
</div>
</div>
{% if category.description %}
<div class="page-header-details">
<div class="page-header-message">
{{ category.description|force_escape|urlize|linebreaks|safe }}
</div>
</div>
{% endif %}
</div>
</div>
</div>
Expand Down
17 changes: 17 additions & 0 deletions misago/templates/misago/category/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@
{% endif %}
{% endif %}

<div class="toolbar toolbar-over-footer">
<div class="toolbar-section hidden-xs">
<div class="toolbar-item">
{% include "misago/category/breadcrumbs.html" %}
</div>
</div>
<div class="toolbar-spacer"></div>
<div class="toolbar-section">
<div class="toolbar-item">
<a href="#" class="btn btn-muted btn-block">
<span class="material-icon">arrow_upward</span>
{% trans "Go to top" context "go up button" %}
</a>
</div>
</div>
</div>

</div>
</div>
{% endblock content %}
12 changes: 12 additions & 0 deletions misago/templates/misago/gototop_toolbar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% load i18n %}
<div class="toolbar toolbar-over-footer">
<div class="toolbar-spacer"></div>
<div class="toolbar-section">
<div class="toolbar-item">
<a href="#" class="btn btn-muted btn-block">
<span class="material-icon">arrow_upward</span>
{% trans "Go to top" context "go up button" %}
</a>
</div>
</div>
</div>
4 changes: 4 additions & 0 deletions misago/templates/misago/private_threads/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
{% block content %}
<div class="page page-private-threads">
{% include "misago/private_threads/header.html" %}

<div class="container page-container">

{% include "misago/gototop_toolbar.html" %}

</div>
</div>
{% endblock content %}
2 changes: 2 additions & 0 deletions misago/templates/misago/threads/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
{% endif %}
{% endif %}

{% include "misago/gototop_toolbar.html" %}

</div>
</div>
{% endblock content %}
3 changes: 3 additions & 0 deletions misago/threads/views/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ def get_context(self, request: HttpRequest, kwargs: dict):
else:
threads = None

path = request.categories.get_category_path(category.id, include_self=False)

return {
"request": request,
"category": category,
"threads": threads,
"breadcrumbs": path,
}

def get_category(self, request: HttpRequest, kwargs: dict):
Expand Down

0 comments on commit c3bd8f5

Please sign in to comment.