only show "hot" sort in specific places

master
Aevann 2023-09-29 05:05:21 +03:00
parent 14df8b5223
commit 92aba70f3b
4 changed files with 10 additions and 5 deletions

View File

@ -83,7 +83,7 @@
{%- import 'util/macros.html' as macros with context -%}
{{- macros.time_filter_buttons() -}}
{{- macros.sorting_buttons(POST_SORTS) -}}
{{- macros.sorting_buttons(POST_SORTS, True) -}}
</div>
{% endblock %}
</div>

View File

@ -299,7 +299,7 @@
<div class="col border-top">
<div class="comments-count py-3">
{%- import 'util/macros.html' as macros with context -%}
{{- macros.sorting_buttons(COMMENT_SORTS) -}}
{{- macros.sorting_buttons(COMMENT_SORTS, True) -}}
</div>
{{macros.comment_reply_box(p.fullname, 'comment-reply-' + p.fullname, subwrapper_css_classes='mb-3', enable_cancel_button=false)}}

View File

@ -59,7 +59,7 @@
<div class="comments-count py-3">
{%- import 'util/macros.html' as macros with context -%}
{{- macros.sorting_buttons(COMMENT_SORTS) -}}
{{- macros.sorting_buttons(COMMENT_SORTS, True) -}}
</div>
<div class="comment-section">

View File

@ -370,14 +370,19 @@
</div>
{% endmacro %}
{% macro sorting_buttons(sorts) %}
{% macro sorting_buttons(sorts, hot_allowed) %}
<div class="dropdown dropdown-actions">
<button type="button" class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton2" data-bs-toggle="dropdown">
<i class="fas fa-{{sorts[sort]}} mr-1"></i>
{{sort | capitalize}}
</button>
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px">
{% for new_sort, icon in sorts.items() %}
{% set sorts = sorts.items()|list %}
{% if not hot_allowed %}
{% set sorts = sorts[1:] %}
{% endif %}
{% for new_sort, icon in sorts %}
{% if sort != new_sort %}
<a class="dropdown-item" href="{{'sort'|change_arg(new_sort, request.full_path)|safe}}">
<i class="fas fa-{{icon}} mr-2"></i>