explicit context passing

This commit is contained in:
justcool393 2023-02-16 23:50:48 -06:00
parent c5cea4f8fa
commit f8ed83a696
8 changed files with 15 additions and 15 deletions

View file

@ -1,5 +1,5 @@
{% extends "settings2.html" %} {% extends "settings2.html" %}
{%- import 'component/sorting_time.html' as sorting_time with context -%} {%- import 'component/sorting_time.html' as sorting_time -%}
{% block pagetitle %}Changelog{% endblock %} {% block pagetitle %}Changelog{% endblock %}
@ -36,7 +36,7 @@
</div> </div>
<div class="text-small font-weight-bold ml-3 mr-2"></div> <div class="text-small font-weight-bold ml-3 mr-2"></div>
{{sorting_time.sort_dropdown(false)}} {{sorting_time.sort_dropdown(sort, t, SORTS_POSTS)}}
</div> </div>
{% endblock %} {% endblock %}
</div> </div>

View file

@ -1,4 +1,4 @@
{%- macro sort_dropdown(is_comment, extra_query) -%} {%- macro sort_dropdown(sort, t, all_sorts, extra_query='') -%}
{% set all_sorts = SORTS_COMMENTS if is_comment else SORTS_POSTS %} {% set all_sorts = SORTS_COMMENTS if is_comment else SORTS_POSTS %}
<div class="dropdown dropdown-actions"> <div class="dropdown dropdown-actions">
<button class="btn btn-secondary dropdown-toggle" role="button" id="dropdownMenuButton2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button class="btn btn-secondary dropdown-toggle" role="button" id="dropdownMenuButton2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

View file

@ -1,5 +1,5 @@
{% extends "default.html" %} {% extends "default.html" %}
{%- import 'component/sorting_time.html' as sorting_time with context -%} {%- import 'component/sorting_time.html' as sorting_time -%}
{% block desktopBanner %} {% block desktopBanner %}
{% if v and environ.get("FP") %} {% if v and environ.get("FP") %}
@ -74,7 +74,7 @@
</div> </div>
</div> </div>
{% set ccmode_text = 'ccmode=' . ccmode %} {% set ccmode_text = 'ccmode=' . ccmode %}
{{sorting_time.sort_dropdown(false, ccmode_text)}} {{sorting_time.sort_dropdown(sort, t, SORTS_POSTS, ccmode_text)}}
</div> </div>
{% endblock %} {% endblock %}
</div> </div>

View file

@ -1,5 +1,5 @@
{% extends "default.html" %} {% extends "default.html" %}
{%- import 'component/sorting_time.html' as sorting_time with context -%} {%- import 'component/sorting_time.html' as sorting_time -%}
{% block sortnav %}{% endblock %} {% block sortnav %}{% endblock %}
@ -31,7 +31,7 @@
</div> </div>
<div class="text-small font-weight-bold ml-3 mr-2"></div> <div class="text-small font-weight-bold ml-3 mr-2"></div>
{{sorting_time.sort_dropdown(true)}} {{sorting_time.sort_dropdown(sort, t, SORTS_COMMENTS)}}
</div> </div>
</div> </div>

View file

@ -1,5 +1,5 @@
{% extends "home.html" %} {% extends "home.html" %}
{%- import 'component/sorting_time.html' as sorting_time with context -%} {%- import 'component/sorting_time.html' as sorting_time -%}
{% block pagetype %}search{% endblock %} {% block pagetype %}search{% endblock %}
@ -32,7 +32,7 @@
</div> </div>
{% set query_text = 'q=' ~ query | urlencode %} {% set query_text = 'q=' ~ query | urlencode %}
{{sorting_time.sort_dropdown(false, query_text)}} {{sorting_time.sort_dropdown(sort, t, SORTS_POSTS, query_text)}}
</div> </div>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,5 +1,5 @@
{% extends "default.html" %} {% extends "default.html" %}
{%- import 'component/sorting_time.html' as sorting_time with context -%} {%- import 'component/sorting_time.html' as sorting_time -%}
{% if p.should_hide_score %} {% if p.should_hide_score %}
{% set ups="" %} {% set ups="" %}
@ -447,7 +447,7 @@
<div class="row border-md-0 comment-section pb-3"> <div class="row border-md-0 comment-section pb-3">
<div class="col border-top"> <div class="col border-top">
<div class="comments-count py-3"> <div class="comments-count py-3">
{{sorting_time.sort_dropdown(true)}} {{sorting_time.sort_dropdown(sort, t, SORTS_COMMENTS)}}
{% if comment_info and p.comment_count >= 2%} {% if comment_info and p.comment_count >= 2%}
<pre></pre> <pre></pre>
<div class="total"><a href="{{p.permalink}}">View entire discussion</a></div> <div class="total"><a href="{{p.permalink}}">View entire discussion</a></div>

View file

@ -1,5 +1,5 @@
{% extends "default.html" %} {% extends "default.html" %}
{%- import 'component/sorting_time.html' as sorting_time with context -%} {%- import 'component/sorting_time.html' as sorting_time -%}
{% block pagetype %}userpage{% endblock %} {% block pagetype %}userpage{% endblock %}
@ -593,7 +593,7 @@
</div> </div>
<div class="text-small font-weight-bold ml-3 mr-2"></div> <div class="text-small font-weight-bold ml-3 mr-2"></div>
{{sorting_time.sort_dropdown(false)}} {{sorting_time.sort_dropdown(sort, t, SORTS_POSTS)}}
</div> </div>
</div> </div>
{% endif %} {% endif %}

View file

@ -1,5 +1,5 @@
{% extends "userpage.html" %} {% extends "userpage.html" %}
{%- import 'component/sorting_time.html' as sorting_time with context -%} {%- import 'component/sorting_time.html' as sorting_time -%}
{% block content %} {% block content %}
@ -53,7 +53,7 @@
</div> </div>
<div class="text-small font-weight-bold ml-3 mr-2"></div> <div class="text-small font-weight-bold ml-3 mr-2"></div>
{{sorting_time.sort_dropdown(true)}} {{sorting_time.sort_dropdown(sort, t, SORTS_COMMENTS)}}
</div> </div>
</div> </div>
{% endif %} {% endif %}