From a33ab1a4ce916bda028362ffb29af89437262ae9 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Tue, 2 Aug 2022 12:04:02 +0200 Subject: use different error when filters return no tracks --- fietsboek/locale/de/LC_MESSAGES/messages.mo | Bin 11111 -> 11214 bytes fietsboek/locale/de/LC_MESSAGES/messages.po | 7 ++++++- fietsboek/locale/en/LC_MESSAGES/messages.mo | Bin 10466 -> 10549 bytes fietsboek/locale/en/LC_MESSAGES/messages.po | 6 +++++- fietsboek/locale/fietslog.pot | 6 +++++- fietsboek/templates/browse.jinja2 | 2 ++ fietsboek/views/browse.py | 4 ++++ 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/fietsboek/locale/de/LC_MESSAGES/messages.mo b/fietsboek/locale/de/LC_MESSAGES/messages.mo index a4cc5dc..97ee495 100644 Binary files a/fietsboek/locale/de/LC_MESSAGES/messages.mo and b/fietsboek/locale/de/LC_MESSAGES/messages.mo differ diff --git a/fietsboek/locale/de/LC_MESSAGES/messages.po b/fietsboek/locale/de/LC_MESSAGES/messages.po index dcc860d..9c93bb4 100644 --- a/fietsboek/locale/de/LC_MESSAGES/messages.po +++ b/fietsboek/locale/de/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-07-30 22:48+0200\n" +"POT-Creation-Date: 2022-08-02 11:57+0200\n" "PO-Revision-Date: 2022-07-02 17:35+0200\n" "Last-Translator: FULL NAME \n" "Language: de\n" @@ -183,6 +183,11 @@ msgid "page.browse.download_multiple" msgstr "ausgewählte Herunterladen" #: fietsboek/templates/browse.jinja2:158 +msgid "page.browse.no_results" +msgstr "" +"Es wurden keine Strecken gefunden, die den Filtern entsprechen." + +#: fietsboek/templates/browse.jinja2:160 msgid "page.browse.no_tracks" msgstr "" "Es wurden keine Strecken gefunden, auf die Du Zugriff hast. Versuche, " diff --git a/fietsboek/locale/en/LC_MESSAGES/messages.mo b/fietsboek/locale/en/LC_MESSAGES/messages.mo index 0d228d8..8887d3d 100644 Binary files a/fietsboek/locale/en/LC_MESSAGES/messages.mo and b/fietsboek/locale/en/LC_MESSAGES/messages.mo differ diff --git a/fietsboek/locale/en/LC_MESSAGES/messages.po b/fietsboek/locale/en/LC_MESSAGES/messages.po index 542a6f9..2ac9f98 100644 --- a/fietsboek/locale/en/LC_MESSAGES/messages.po +++ b/fietsboek/locale/en/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-07-30 22:48+0200\n" +"POT-Creation-Date: 2022-08-02 11:57+0200\n" "PO-Revision-Date: 2022-06-28 13:11+0200\n" "Last-Translator: \n" "Language: en\n" @@ -183,6 +183,10 @@ msgid "page.browse.download_multiple" msgstr "Download selected" #: fietsboek/templates/browse.jinja2:158 +msgid "page.browse.no_results" +msgstr "No results matching the filters were found." + +#: fietsboek/templates/browse.jinja2:160 msgid "page.browse.no_tracks" msgstr "You currently do not have access to any tracks. Try logging in." diff --git a/fietsboek/locale/fietslog.pot b/fietsboek/locale/fietslog.pot index 47d3c6e..2c25251 100644 --- a/fietsboek/locale/fietslog.pot +++ b/fietsboek/locale/fietslog.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-07-30 22:48+0200\n" +"POT-Creation-Date: 2022-08-02 11:57+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -182,6 +182,10 @@ msgid "page.browse.download_multiple" msgstr "" #: fietsboek/templates/browse.jinja2:158 +msgid "page.browse.no_results" +msgstr "" + +#: fietsboek/templates/browse.jinja2:160 msgid "page.browse.no_tracks" msgstr "" diff --git a/fietsboek/templates/browse.jinja2 b/fietsboek/templates/browse.jinja2 index 169309b..0f98192 100644 --- a/fietsboek/templates/browse.jinja2 +++ b/fietsboek/templates/browse.jinja2 @@ -154,6 +154,8 @@ {% endfor %} + {% elif used_filters %} +

{{ _("page.browse.no_results") }}

{% else %}

{{ _("page.browse.no_tracks") }}

{% endif %} diff --git a/fietsboek/views/browse.py b/fietsboek/views/browse.py index e62ca0b..7120b0d 100644 --- a/fietsboek/views/browse.py +++ b/fietsboek/views/browse.py @@ -55,6 +55,9 @@ class TrackFilters: def __init__(self, filters): self._filters = filters + def __bool__(self): + return bool(self._filters) + def apply(self, track): """Apply the filters to the track. @@ -173,6 +176,7 @@ def browse(request): return { 'tracks': tracks, 'mps_to_kph': util.mps_to_kph, + 'used_filters': bool(filters), } -- cgit v1.2.3