From af747e6e3f66a0512317c0c6ea22e19bf622f192 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 21 Feb 2024 10:03:09 +0100 Subject: [PATCH 1/2] UI - Sorted alphabetical tag list and list of tags in groups setting (#2205) --- changedetectionio/blueprint/tags/__init__.py | 3 ++- .../tags/templates/groups-overview.html | 2 +- changedetectionio/flask_app.py | 25 +++++++++++-------- .../templates/watch-overview.html | 20 ++++++++------- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/changedetectionio/blueprint/tags/__init__.py b/changedetectionio/blueprint/tags/__init__.py index 10e226d4..ba20cb4a 100644 --- a/changedetectionio/blueprint/tags/__init__.py +++ b/changedetectionio/blueprint/tags/__init__.py @@ -11,9 +11,10 @@ def construct_blueprint(datastore: ChangeDetectionStore): def tags_overview_page(): from .form import SingleTag add_form = SingleTag(request.form) + sorted_tags = sorted(datastore.data['settings']['application'].get('tags').items(), key=lambda x: x[1]['title']) output = render_template("groups-overview.html", form=add_form, - available_tags=datastore.data['settings']['application'].get('tags', {}), + available_tags=sorted_tags, ) return output diff --git a/changedetectionio/blueprint/tags/templates/groups-overview.html b/changedetectionio/blueprint/tags/templates/groups-overview.html index cab8d5e6..7d942f43 100644 --- a/changedetectionio/blueprint/tags/templates/groups-overview.html +++ b/changedetectionio/blueprint/tags/templates/groups-overview.html @@ -40,7 +40,7 @@ No website organisational tags/groups configured {% endif %} - {% for uuid, tag in available_tags.items() %} + {% for uuid, tag in available_tags %} Mute notifications diff --git a/changedetectionio/flask_app.py b/changedetectionio/flask_app.py index 84e804f7..d9004a98 100644 --- a/changedetectionio/flask_app.py +++ b/changedetectionio/flask_app.py @@ -404,17 +404,21 @@ def changedetection_app(config=None, datastore_o=None): global datastore from changedetectionio import forms - limit_tag = request.args.get('tag', '').lower().strip() + active_tag_req = request.args.get('tag', '').lower().strip() + active_tag_uuid = active_tag = None # Be sure limit_tag is a uuid - for uuid, tag in datastore.data['settings']['application'].get('tags', {}).items(): - if limit_tag == tag.get('title', '').lower().strip(): - limit_tag = uuid + if active_tag_req: + for uuid, tag in datastore.data['settings']['application'].get('tags', {}).items(): + if active_tag_req == tag.get('title', '').lower().strip() or active_tag_req == uuid: + active_tag = tag + active_tag_uuid = uuid + break # Redirect for the old rss path which used the /?rss=true if request.args.get('rss'): - return redirect(url_for('rss', tag=limit_tag)) + return redirect(url_for('rss', tag=active_tag_uuid)) op = request.args.get('op') if op: @@ -425,7 +429,7 @@ def changedetection_app(config=None, datastore_o=None): datastore.data['watching'][uuid].toggle_mute() datastore.needs_write = True - return redirect(url_for('index', tag = limit_tag)) + return redirect(url_for('index', tag = active_tag_uuid)) # Sort by last_changed and add the uuid which is usually the key.. sorted_watches = [] @@ -436,7 +440,7 @@ def changedetection_app(config=None, datastore_o=None): if with_errors and not watch.get('last_error'): continue - if limit_tag and not limit_tag in watch['tags']: + if active_tag_uuid and not active_tag_uuid in watch['tags']: continue if watch.get('last_error'): errored_count += 1 @@ -455,11 +459,12 @@ def changedetection_app(config=None, datastore_o=None): total=total_count, per_page=datastore.data['settings']['application'].get('pager_size', 50), css_framework="semantic") - + sorted_tags = sorted(datastore.data['settings']['application'].get('tags').items(), key=lambda x: x[1]['title']) output = render_template( "watch-overview.html", # Don't link to hosting when we're on the hosting environment - active_tag=limit_tag, + active_tag=active_tag, + active_tag_uuid=active_tag_uuid, app_rss_token=datastore.data['settings']['application']['rss_access_token'], datastore=datastore, errored_count=errored_count, @@ -474,7 +479,7 @@ def changedetection_app(config=None, datastore_o=None): sort_attribute=request.args.get('sort') if request.args.get('sort') else request.cookies.get('sort'), sort_order=request.args.get('order') if request.args.get('order') else request.cookies.get('order'), system_default_fetcher=datastore.data['settings']['application'].get('fetch_backend'), - tags=datastore.data['settings']['application'].get('tags'), + tags=sorted_tags, watches=sorted_watches ) diff --git a/changedetectionio/templates/watch-overview.html b/changedetectionio/templates/watch-overview.html index 186efe42..16a56294 100644 --- a/changedetectionio/templates/watch-overview.html +++ b/changedetectionio/templates/watch-overview.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% block content %} -{% from '_helpers.jinja' import render_simple_field, render_field, render_nolabel_field %} +{% from '_helpers.jinja' import render_simple_field, render_field, render_nolabel_field, sort_by_title %} @@ -13,7 +13,7 @@
{{ render_nolabel_field(form.url, placeholder="https://...", required=true) }} - {{ render_nolabel_field(form.tags, value=tags[active_tag].title if active_tag else '', placeholder="watch label / tag") }} + {{ render_nolabel_field(form.tags, value=active_tag.title if active_tag else '', placeholder="watch label / tag") }} {{ render_nolabel_field(form.watch_submit_button, title="Watch this URL!" ) }} {{ render_nolabel_field(form.edit_and_watch_submit_button, title="Edit first then Watch") }}
@@ -46,11 +46,13 @@ {% if search_q %}
Searching "{{search_q}}"
{% endif %}
All - {% for uuid, tag in tags.items() %} - {% if tag != "" %} - {{ tag.title }} - {% endif %} - {% endfor %} + + + {% for uuid, tag in tags %} + {% if tag != "" %} + {{ tag.title }} + {% endif %} + {% endfor %}
{% set sort_order = sort_order or 'asc' %} @@ -197,8 +199,8 @@ {% endif %}
  • - Recheck - all {% if active_tag%} in "{{tags[active_tag].title}}"{%endif%} + Recheck + all {% if active_tag_uuid %} in "{{active_tag.title}}"{%endif%}
  • RSS Feed From 1c099cdba694342c6ddbfe38f16c6e2d7b3d29ac Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 21 Feb 2024 10:28:59 +0100 Subject: [PATCH 2/2] Update stock-not-in-stock.js --- changedetectionio/content_fetchers/res/stock-not-in-stock.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changedetectionio/content_fetchers/res/stock-not-in-stock.js b/changedetectionio/content_fetchers/res/stock-not-in-stock.js index ddf78237..3f7cc600 100644 --- a/changedetectionio/content_fetchers/res/stock-not-in-stock.js +++ b/changedetectionio/content_fetchers/res/stock-not-in-stock.js @@ -60,11 +60,13 @@ function isItemInStock() { 'tickets unavailable', 'tijdelijk uitverkocht', 'unavailable tickets', + 'vorbestellung ist bald möglich', 'we do not currently have an estimate of when this product will be back in stock.', 'we don\'t know when or if this item will be back in stock.', 'zur zeit nicht an lager', '品切れ', '已售完', + '已售', '품절' ];