From 9fb45403dfcdcd86e390a75a0a02393fd74d3105 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 9 Nov 2022 19:40:28 -0800 Subject: [PATCH] Fix jinja use of search kwargs dotdict. --- .../etiquette_flask/templates/search.html | 85 ++++++++++--------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/frontends/etiquette_flask/templates/search.html b/frontends/etiquette_flask/templates/search.html index a0c0432..fa04d60 100644 --- a/frontends/etiquette_flask/templates/search.html +++ b/frontends/etiquette_flask/templates/search.html @@ -193,12 +193,12 @@
{% for tagtype in ["musts", "mays", "forbids"] %} -
+
Tag {{tagtype}}:
    {% set key="tag_" + tagtype %} - {% if search_kwargs[key] %} - {% for tag in search_kwargs[key] %} + {% if search_kwargs|attr(key) %} + {% for tag in search_kwargs|attr(key) %}
  • {{cards.create_tag_card(tag, link='info', with_alt_description=True)}}
{% endfor %} -
+
Tag Expression:
Order by
    - {% if "orderby" in search_kwargs and search_kwargs["orderby"] %} - {% for orderby in search_kwargs["orderby"] %} + {% if search_kwargs.orderby %} + {% for orderby in search_kwargs.orderby %} {% set column, sorter=orderby.split("-") %} {{ create_orderby_li(selected_column=column, selected_sorter=sorter) }} {% endfor %} @@ -235,97 +235,98 @@ Min-max values
    Other filters + {% if total_tags %}

    Tags on this page:

    @@ -381,9 +382,9 @@
    {% for result in results %} {% if result.__class__.__name__ == 'Photo' %} - {{cards.create_photo_card(result, view=search_kwargs["view"])}} + {{cards.create_photo_card(result, view=search_kwargs.view)}} {% elif result.__class__.__name__ == 'Album' %} - {{cards.create_album_card(result, view=search_kwargs["view"])}} + {{cards.create_album_card(result, view=search_kwargs.view)}} {% endif %} {% endfor %}
    @@ -403,7 +404,7 @@ selected form values are these. const PARAM_DEFAULTS = { 'limit': 50, 'view': 'grid', - 'yield_albums': 'yes', + 'yield_albums': 'no', 'yield_photos': 'yes' } @@ -731,8 +732,8 @@ const inputted_mays = []; const inputted_forbids = []; {% for tagtype in ["musts", "mays", "forbids"] %} {% set key="tag_" + tagtype %} - {% if search_kwargs[key] %} - {% for tag in search_kwargs[key] %} + {% if search_kwargs|attr(key) %} + {% for tag in search_kwargs|attr(key) %} inputted_{{tagtype}}.push("{{tag.name|safe}}"); {% endfor %} {% endif %}