diff --git a/iwm_browser/main.py b/iwm_browser/main.py index be8c38e..504a19f 100644 --- a/iwm_browser/main.py +++ b/iwm_browser/main.py @@ -23,6 +23,7 @@ template_env = jinja2.Environment( error_template = template_env.get_template("error.html") template_env.globals["convert_times"] = utils.convert_times +template_env.globals["isSelected"] = utils.isSelected template_env.globals["generate_thumbnail_url"] = utils.generate_thumbnail_url template_env.globals["__version__"] = __version__ diff --git a/iwm_browser/templates/search.html b/iwm_browser/templates/search.html index 14a0068..4ac1efe 100644 --- a/iwm_browser/templates/search.html +++ b/iwm_browser/templates/search.html @@ -1,8 +1,9 @@ - + IWM Browser - {{ QueryValues["q"] }} + @@ -32,26 +33,30 @@
More options + {% macro option(name, value, key) -%} + + {%- endmacro %}
@@ -61,15 +66,15 @@
{% for map in searchResults %}
-
+
-
Difficulty: {{ '▲' * map['AverageUserDifficulty']|int }}
+
Difficulty: {{ '▲' * map['AverageUserDifficulty']|int }}
{{ map['NumThumbsUp'] }} 👍 {{ map['NumThumbsDown'] }} 👎
{% if map['Description'] != ''%}
{{ map['Description'] }}
{% endif %} -
Code:
+
First Clear: {{ map['FirstClearUsername'] }}
diff --git a/iwm_browser/utils.py b/iwm_browser/utils.py index 948b8c0..feda0db 100644 --- a/iwm_browser/utils.py +++ b/iwm_browser/utils.py @@ -27,6 +27,13 @@ def config_value(key: str, default_value=None): return default_value +def isSelected(selection, value): + """Returns 'selected' if values are equal. + Intended for selection boxes""" + print(f"DBG: {selection} {value},") + return 'selected="true"' if selection == value else '' + + # Specify default imgproxy instance. global_imgproxy_url = None global_imgproxy_params = None