From 0cc130092f60adf88a22bad4f7b7bbb087d10797 Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Wed, 25 Oct 2023 20:01:48 +0200 Subject: [PATCH 1/6] Added a search tab for the conso page --- apps/note/templates/note/conso_form.html | 51 +++++++++++++++++++++++ apps/note/views.py | 12 +++++- locale/de/LC_MESSAGES/django.po | 52 +++++++++++++++--------- locale/es/LC_MESSAGES/django.po | 52 +++++++++++++++--------- locale/fr/LC_MESSAGES/django.po | 48 +++++++++++++--------- 5 files changed, 153 insertions(+), 62 deletions(-) diff --git a/apps/note/templates/note/conso_form.html b/apps/note/templates/note/conso_form.html index d6044b87..c341ec4b 100644 --- a/apps/note/templates/note/conso_form.html +++ b/apps/note/templates/note/conso_form.html @@ -103,6 +103,11 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endfor %} + @@ -123,6 +128,20 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endfor %} + @@ -182,5 +201,37 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endif %} {% endfor %} {% endfor %} + + {% for button in search_results %} + {% if button.display %} + $("#search_button{{ button.id }}").click(function() { + addConso({{ button.destination_id }}, {{ button.amount }}, + {{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}", + {{ button.id }}, "{{ button.name|escapejs }}"); + }); + {% endif %} + {% endfor %} + searchbar = document.getElementById("search-input") + + const parser = new DOMParser(); + old_pattern = null; + function updateSearch(force = false) { + let pattern = searchbar.value + if ((pattern === old_pattern || pattern === "") && !force) + return; + + const xhr = new XMLHttpRequest(); + xhr.open("GET", location.pathname + "?search=" + + encodeURI(pattern) + "#search", true) + xhr.onload = () => { + document.getElementById("search-results").innerHTML = + parser.parseFromString(xhr.responseText, "text/html").getElementById("search-results").innerHTML + }; + xhr.send(); + } + + searchbar.addEventListener("input", function (e) { + debounce(updateSearch)() + }); {% endblock %} diff --git a/apps/note/views.py b/apps/note/views.py index 1224f2f8..d8015ad1 100644 --- a/apps/note/views.py +++ b/apps/note/views.py @@ -10,12 +10,12 @@ from django.core.exceptions import PermissionDenied from django.db.models import Q, F from django.utils.translation import gettext_lazy as _ from django.views.generic import CreateView, UpdateView, DetailView -from django_tables2 import SingleTableView from django.urls import reverse_lazy +from django_tables2 import SingleTableView from activity.models import Entry -from note_kfet.inputs import AmountInput from permission.backends import PermissionBackend from permission.views import ProtectQuerysetMixin +from note_kfet.inputs import AmountInput from .forms import TransactionTemplateForm, SearchTransactionForm from .models import TemplateCategory, Transaction, TransactionTemplate, RecurrentTransaction, NoteSpecial, Note @@ -190,6 +190,14 @@ class ConsoView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView): ).order_by('name').all() context['polymorphic_ctype'] = ContentType.objects.get_for_model(RecurrentTransaction).pk + if "search" in self.request.GET and self.request.GET["search"]: + pattern = self.request.GET["search"] + context['search_results'] = TransactionTemplate.objects.filter( + name__iregex=pattern + ).filter( + PermissionBackend.filter_queryset(self.request, TransactionTemplate, "view") + ).filter(display=True).order_by('name').all() + return context diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 7316395a..4fa2bdac 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-18 17:27+0200\n" +"POT-Creation-Date: 2023-10-25 19:12+0200\n" "PO-Revision-Date: 2020-11-16 20:02+0000\n" "Last-Translator: bleizi \n" "Language-Team: German \n" @@ -1286,16 +1286,16 @@ msgstr "Rollen in diesen Club bearbeiten" msgid "Members of the club" msgstr "Mitlglieder dieses Club" -#: apps/note/admin.py:129 apps/note/models/transactions.py:109 +#: apps/note/admin.py:139 apps/note/models/transactions.py:109 msgid "source" msgstr "Sender" -#: apps/note/admin.py:137 apps/note/admin.py:205 +#: apps/note/admin.py:147 apps/note/admin.py:215 #: apps/note/models/transactions.py:56 apps/note/models/transactions.py:122 msgid "destination" msgstr "Empfänger" -#: apps/note/admin.py:210 apps/note/models/transactions.py:60 +#: apps/note/admin.py:220 apps/note/models/transactions.py:60 #: apps/note/models/transactions.py:140 msgid "amount" msgstr "Anzahl" @@ -1643,7 +1643,7 @@ msgstr "" msgid "Add back" msgstr "Neue Bus" -#: apps/note/tables.py:262 apps/note/templates/note/conso_form.html:132 +#: apps/note/tables.py:262 apps/note/templates/note/conso_form.html:151 #: apps/wei/tables.py:49 apps/wei/tables.py:50 #: apps/wei/templates/wei/base.html:89 #: apps/wei/templates/wei/bus_detail.html:20 @@ -1684,15 +1684,27 @@ msgstr "Konsumieren!" msgid "Highlighted buttons" msgstr "Hervorgehobene Tasten" -#: apps/note/templates/note/conso_form.html:138 +#: apps/note/templates/note/conso_form.html:108 +#, fuzzy +#| msgid "Search WEI" +msgid "Search" +msgstr "WEI finden" + +#: apps/note/templates/note/conso_form.html:133 +#, fuzzy +#| msgid "Search button" +msgid "Search button..." +msgstr "Tatsen finden" + +#: apps/note/templates/note/conso_form.html:157 msgid "Single consumptions" msgstr "Solo Modus" -#: apps/note/templates/note/conso_form.html:143 +#: apps/note/templates/note/conso_form.html:162 msgid "Double consumptions" msgstr "Doppelte Modus" -#: apps/note/templates/note/conso_form.html:154 +#: apps/note/templates/note/conso_form.html:173 #: apps/note/templates/note/transaction_form.html:163 msgid "Recent transactions history" msgstr "Verlauf der letzten Transaktionen" @@ -1826,7 +1838,7 @@ msgstr "Verbräuche" msgid "You can't see any button." msgstr "Sie können keine Taste sehen." -#: apps/note/views.py:200 +#: apps/note/views.py:208 msgid "Search transactions" msgstr "Transaktion finden" @@ -2402,12 +2414,12 @@ msgid "Yes" msgstr "Ja" #: apps/treasury/templates/treasury/invoice_confirm_delete.html:10 -#: apps/treasury/views.py:180 +#: apps/treasury/views.py:173 msgid "Delete invoice" msgstr "Rechnung löschen" #: apps/treasury/templates/treasury/invoice_confirm_delete.html:15 -#: apps/treasury/views.py:184 +#: apps/treasury/views.py:177 msgid "This invoice is locked and can't be deleted." msgstr "Eine Rechnung kann nicht gelöscht werden, wenn sie gesperrt ist." @@ -2593,36 +2605,36 @@ msgstr "Neue Rechnung" msgid "Invoices list" msgstr "Rechnunglist" -#: apps/treasury/views.py:112 apps/treasury/views.py:286 -#: apps/treasury/views.py:412 +#: apps/treasury/views.py:105 apps/treasury/views.py:275 +#: apps/treasury/views.py:401 msgid "You are not able to see the treasury interface." msgstr "Sie können die Quaestor-App nicht sehen." -#: apps/treasury/views.py:122 +#: apps/treasury/views.py:115 msgid "Update an invoice" msgstr "Rechnung bearbeiten" -#: apps/treasury/views.py:247 +#: apps/treasury/views.py:240 msgid "Create a new remittance" msgstr "Neue Überweisung" -#: apps/treasury/views.py:274 +#: apps/treasury/views.py:267 msgid "Remittances list" msgstr "Überweisungliste" -#: apps/treasury/views.py:337 +#: apps/treasury/views.py:326 msgid "Update a remittance" msgstr "Überweisung bearbeiten" -#: apps/treasury/views.py:360 +#: apps/treasury/views.py:349 msgid "Attach a transaction to a remittance" msgstr "Fügen Sie einer Überweisung eine Transaktion hinzu" -#: apps/treasury/views.py:404 +#: apps/treasury/views.py:393 msgid "List of credits from the Société générale" msgstr "Kreditliste von Société générale" -#: apps/treasury/views.py:449 +#: apps/treasury/views.py:438 msgid "Manage credits from the Société générale" msgstr "Krediten von der Société générale handeln" diff --git a/locale/es/LC_MESSAGES/django.po b/locale/es/LC_MESSAGES/django.po index f702922b..fe8e4950 100644 --- a/locale/es/LC_MESSAGES/django.po +++ b/locale/es/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-18 17:27+0200\n" +"POT-Creation-Date: 2023-10-25 19:12+0200\n" "PO-Revision-Date: 2022-04-11 23:12+0200\n" "Last-Translator: bleizi \n" "Language-Team: \n" @@ -1272,16 +1272,16 @@ msgstr "Gestionar los papeles de un usuario en el club" msgid "Members of the club" msgstr "Miembros del club" -#: apps/note/admin.py:129 apps/note/models/transactions.py:109 +#: apps/note/admin.py:139 apps/note/models/transactions.py:109 msgid "source" msgstr "fuente" -#: apps/note/admin.py:137 apps/note/admin.py:205 +#: apps/note/admin.py:147 apps/note/admin.py:215 #: apps/note/models/transactions.py:56 apps/note/models/transactions.py:122 msgid "destination" msgstr "destino" -#: apps/note/admin.py:210 apps/note/models/transactions.py:60 +#: apps/note/admin.py:220 apps/note/models/transactions.py:60 #: apps/note/models/transactions.py:140 msgid "amount" msgstr "monto" @@ -1627,7 +1627,7 @@ msgstr "Añadir como amig@" msgid "Add back" msgstr "Añadir en retorno" -#: apps/note/tables.py:262 apps/note/templates/note/conso_form.html:132 +#: apps/note/tables.py:262 apps/note/templates/note/conso_form.html:151 #: apps/wei/tables.py:49 apps/wei/tables.py:50 #: apps/wei/templates/wei/base.html:89 #: apps/wei/templates/wei/bus_detail.html:20 @@ -1668,15 +1668,27 @@ msgstr "¡ Consumir !" msgid "Highlighted buttons" msgstr "Botones resaltados" -#: apps/note/templates/note/conso_form.html:138 +#: apps/note/templates/note/conso_form.html:108 +#, fuzzy +#| msgid "Search WEI" +msgid "Search" +msgstr "Buscar un WEI" + +#: apps/note/templates/note/conso_form.html:133 +#, fuzzy +#| msgid "Search button" +msgid "Search button..." +msgstr "Buscar un botón" + +#: apps/note/templates/note/conso_form.html:157 msgid "Single consumptions" msgstr "Consumiciones simples" -#: apps/note/templates/note/conso_form.html:143 +#: apps/note/templates/note/conso_form.html:162 msgid "Double consumptions" msgstr "Consumiciones dobles" -#: apps/note/templates/note/conso_form.html:154 +#: apps/note/templates/note/conso_form.html:173 #: apps/note/templates/note/transaction_form.html:163 msgid "Recent transactions history" msgstr "Historial de las transacciones recientes" @@ -1806,7 +1818,7 @@ msgstr "Consumiciones" msgid "You can't see any button." msgstr "Usted no puede ver ningún botón." -#: apps/note/views.py:200 +#: apps/note/views.py:208 msgid "Search transactions" msgstr "Buscar transacciones" @@ -2378,12 +2390,12 @@ msgid "Yes" msgstr "Sí" #: apps/treasury/templates/treasury/invoice_confirm_delete.html:10 -#: apps/treasury/views.py:180 +#: apps/treasury/views.py:173 msgid "Delete invoice" msgstr "Suprimir la factura" #: apps/treasury/templates/treasury/invoice_confirm_delete.html:15 -#: apps/treasury/views.py:184 +#: apps/treasury/views.py:177 msgid "This invoice is locked and can't be deleted." msgstr "Esta factura esta bloqueada y no puede ser suprimida." @@ -2559,36 +2571,36 @@ msgstr "Crear una nueva factura" msgid "Invoices list" msgstr "Lista de las facturas" -#: apps/treasury/views.py:112 apps/treasury/views.py:286 -#: apps/treasury/views.py:412 +#: apps/treasury/views.py:105 apps/treasury/views.py:275 +#: apps/treasury/views.py:401 msgid "You are not able to see the treasury interface." msgstr "Usted no tiene derecho a ver la interfaz de tesorería." -#: apps/treasury/views.py:122 +#: apps/treasury/views.py:115 msgid "Update an invoice" msgstr "Modificar una factura" -#: apps/treasury/views.py:247 +#: apps/treasury/views.py:240 msgid "Create a new remittance" msgstr "Crear un nuevo descuento" -#: apps/treasury/views.py:274 +#: apps/treasury/views.py:267 msgid "Remittances list" msgstr "Lista de los descuentos" -#: apps/treasury/views.py:337 +#: apps/treasury/views.py:326 msgid "Update a remittance" msgstr "Modificar un descuento" -#: apps/treasury/views.py:360 +#: apps/treasury/views.py:349 msgid "Attach a transaction to a remittance" msgstr "Unir una transacción con un descuento" -#: apps/treasury/views.py:404 +#: apps/treasury/views.py:393 msgid "List of credits from the Société générale" msgstr "Lista de los créditos de la Société Générale" -#: apps/treasury/views.py:449 +#: apps/treasury/views.py:438 msgid "Manage credits from the Société générale" msgstr "Gestionar los créditos de la Société Générale" diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index d1912275..36bfd028 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-18 17:27+0200\n" +"POT-Creation-Date: 2023-10-25 19:12+0200\n" "PO-Revision-Date: 2022-04-11 22:05+0200\n" "Last-Translator: bleizi \n" "Language-Team: French \n" @@ -1274,16 +1274,16 @@ msgstr "Gérer les rôles d'un utilisateur dans le club" msgid "Members of the club" msgstr "Membres du club" -#: apps/note/admin.py:129 apps/note/models/transactions.py:109 +#: apps/note/admin.py:139 apps/note/models/transactions.py:109 msgid "source" msgstr "source" -#: apps/note/admin.py:137 apps/note/admin.py:205 +#: apps/note/admin.py:147 apps/note/admin.py:215 #: apps/note/models/transactions.py:56 apps/note/models/transactions.py:122 msgid "destination" msgstr "destination" -#: apps/note/admin.py:210 apps/note/models/transactions.py:60 +#: apps/note/admin.py:220 apps/note/models/transactions.py:60 #: apps/note/models/transactions.py:140 msgid "amount" msgstr "montant" @@ -1630,7 +1630,7 @@ msgstr "Ajouter en ami" msgid "Add back" msgstr "Ajouter" -#: apps/note/tables.py:262 apps/note/templates/note/conso_form.html:132 +#: apps/note/tables.py:262 apps/note/templates/note/conso_form.html:151 #: apps/wei/tables.py:49 apps/wei/tables.py:50 #: apps/wei/templates/wei/base.html:89 #: apps/wei/templates/wei/bus_detail.html:20 @@ -1671,15 +1671,23 @@ msgstr "Consommer !" msgid "Highlighted buttons" msgstr "Boutons mis en avant" -#: apps/note/templates/note/conso_form.html:138 +#: apps/note/templates/note/conso_form.html:108 +msgid "Search" +msgstr "Recherche" + +#: apps/note/templates/note/conso_form.html:133 +msgid "Search button..." +msgstr "Chercher un bouton..." + +#: apps/note/templates/note/conso_form.html:157 msgid "Single consumptions" msgstr "Consommations simples" -#: apps/note/templates/note/conso_form.html:143 +#: apps/note/templates/note/conso_form.html:162 msgid "Double consumptions" msgstr "Consommations doubles" -#: apps/note/templates/note/conso_form.html:154 +#: apps/note/templates/note/conso_form.html:173 #: apps/note/templates/note/transaction_form.html:163 msgid "Recent transactions history" msgstr "Historique des transactions récentes" @@ -1809,7 +1817,7 @@ msgstr "Consommations" msgid "You can't see any button." msgstr "Vous ne pouvez pas voir le moindre bouton." -#: apps/note/views.py:200 +#: apps/note/views.py:208 msgid "Search transactions" msgstr "Rechercher des transactions" @@ -2382,12 +2390,12 @@ msgid "Yes" msgstr "Oui" #: apps/treasury/templates/treasury/invoice_confirm_delete.html:10 -#: apps/treasury/views.py:180 +#: apps/treasury/views.py:173 msgid "Delete invoice" msgstr "Supprimer la facture" #: apps/treasury/templates/treasury/invoice_confirm_delete.html:15 -#: apps/treasury/views.py:184 +#: apps/treasury/views.py:177 msgid "This invoice is locked and can't be deleted." msgstr "Cette facture est verrouillée et ne peut pas être supprimée." @@ -2567,36 +2575,36 @@ msgstr "Créer une nouvelle facture" msgid "Invoices list" msgstr "Liste des factures" -#: apps/treasury/views.py:112 apps/treasury/views.py:286 -#: apps/treasury/views.py:412 +#: apps/treasury/views.py:105 apps/treasury/views.py:275 +#: apps/treasury/views.py:401 msgid "You are not able to see the treasury interface." msgstr "Vous n'êtes pas autorisé à voir l'interface de trésorerie." -#: apps/treasury/views.py:122 +#: apps/treasury/views.py:115 msgid "Update an invoice" msgstr "Modifier la facture" -#: apps/treasury/views.py:247 +#: apps/treasury/views.py:240 msgid "Create a new remittance" msgstr "Créer une nouvelle remise" -#: apps/treasury/views.py:274 +#: apps/treasury/views.py:267 msgid "Remittances list" msgstr "Liste des remises" -#: apps/treasury/views.py:337 +#: apps/treasury/views.py:326 msgid "Update a remittance" msgstr "Modifier la remise" -#: apps/treasury/views.py:360 +#: apps/treasury/views.py:349 msgid "Attach a transaction to a remittance" msgstr "Joindre une transaction à une remise" -#: apps/treasury/views.py:404 +#: apps/treasury/views.py:393 msgid "List of credits from the Société générale" msgstr "Liste des crédits de la Société générale" -#: apps/treasury/views.py:449 +#: apps/treasury/views.py:438 msgid "Manage credits from the Société générale" msgstr "Gérer les crédits de la Société générale" From 405479e5ad34428f51726beee5615dbc210e3600 Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Thu, 26 Oct 2023 00:10:56 +0200 Subject: [PATCH 2/6] Execute script to add behavior to searched buttons --- apps/note/templates/note/conso_form.html | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/apps/note/templates/note/conso_form.html b/apps/note/templates/note/conso_form.html index c341ec4b..ac8910bd 100644 --- a/apps/note/templates/note/conso_form.html +++ b/apps/note/templates/note/conso_form.html @@ -182,7 +182,7 @@ SPDX-License-Identifier: GPL-3.0-or-later + {% endblock %} From 08b2fabe07a62e7b7401612a9e8f321dd0496b66 Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Thu, 26 Oct 2023 00:22:51 +0200 Subject: [PATCH 3/6] Removing jquery means changing the event API... --- apps/note/templates/note/conso_form.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/note/templates/note/conso_form.html b/apps/note/templates/note/conso_form.html index ac8910bd..6c598a29 100644 --- a/apps/note/templates/note/conso_form.html +++ b/apps/note/templates/note/conso_form.html @@ -182,7 +182,7 @@ SPDX-License-Identifier: GPL-3.0-or-later - {% endblock %} diff --git a/apps/note/views.py b/apps/note/views.py index d8015ad1..13b0c118 100644 --- a/apps/note/views.py +++ b/apps/note/views.py @@ -190,17 +190,14 @@ class ConsoView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView): ).order_by('name').all() context['polymorphic_ctype'] = ContentType.objects.get_for_model(RecurrentTransaction).pk - if "search" in self.request.GET and self.request.GET["search"]: - pattern = self.request.GET["search"] - context['search_results'] = TransactionTemplate.objects.filter( - name__iregex=pattern - ).filter( - PermissionBackend.filter_queryset(self.request, TransactionTemplate, "view") - ).filter(display=True).order_by('name').all() + context['all_buttons'] = TransactionTemplate.objects.filter( + PermissionBackend.filter_queryset(self.request, TransactionTemplate, "view") + ).filter(display=True).order_by('name').all() return context + class TransactionSearchView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): model = Note context_object_name = "note" From e32c267995bc8b94286539c2fa82534df8f210ce Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Thu, 26 Oct 2023 19:10:43 +0200 Subject: [PATCH 5/6] Moved js code to the external conso file --- apps/note/static/note/js/consos.js | 36 ++++++++++++++++++++++++ apps/note/templates/note/conso_form.html | 36 ------------------------ 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/apps/note/static/note/js/consos.js b/apps/note/static/note/js/consos.js index 6f9dc61e..199a0a19 100644 --- a/apps/note/static/note/js/consos.js +++ b/apps/note/static/note/js/consos.js @@ -258,3 +258,39 @@ function consume (source, source_alias, dest, quantity, amount, reason, type, ca }) }) } + +const searchbar = document.getElementById("search-input") +const search_results = document.getElementById("search-results") + +var old_pattern = null; +var firstMatch = null; +/** + * Updates the button search tab + * @param force Forces the update even if the pattern didn't change + */ +function updateSearch(force = false) { + let pattern = searchbar.value + if (pattern === "") + firstMatch = null; + if ((pattern === old_pattern || pattern === "") && !force) + return; + firstMatch = null; + const re = new RegExp(pattern, "i"); + Array.from(search_results.children).forEach(function(b) { + if (re.test(b.innerText)) { + b.hidden = false; + if (firstMatch === null) { + firstMatch = b; + } + } else + b.hidden = true; + }); +} + +searchbar.addEventListener("input", function (e) { + debounce(updateSearch)() +}); +searchbar.addEventListener("keyup", function (e) { + if (firstMatch && e.key === "Enter") + firstMatch.click() +}); diff --git a/apps/note/templates/note/conso_form.html b/apps/note/templates/note/conso_form.html index 5d9007d4..25015c90 100644 --- a/apps/note/templates/note/conso_form.html +++ b/apps/note/templates/note/conso_form.html @@ -211,41 +211,5 @@ SPDX-License-Identifier: GPL-3.0-or-later }); {% endif %} {% endfor %} - - const searchbar = document.getElementById("search-input") - const search_results = document.getElementById("search-results") - - var old_pattern = null; - var firstMatch = null; - /** - * Updates the button search tab - * @param force Forces the update even if the pattern didn't change - */ - function updateSearch(force = false) { - let pattern = searchbar.value - if (pattern === "") - firstMatch = null; - if ((pattern === old_pattern || pattern === "") && !force) - return; - firstMatch = null; - const re = new RegExp(pattern, "i"); - Array.from(search_results.children).forEach(function(b) { - if (re.test(b.innerText)) { - b.hidden = false; - if (firstMatch === null) { - firstMatch = b; - } - } else - b.hidden = true; - }); - } - - searchbar.addEventListener("input", function (e) { - debounce(updateSearch)() - }); - searchbar.addEventListener("keyup", function (e) { - if (firstMatch && e.key === "Enter") - firstMatch.click() - }); {% endblock %} From 988b4c9e88a61ff38947105bb0942474045442e4 Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Thu, 26 Oct 2023 21:03:48 +0200 Subject: [PATCH 6/6] Linting --- apps/note/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/note/views.py b/apps/note/views.py index 13b0c118..0cdfe370 100644 --- a/apps/note/views.py +++ b/apps/note/views.py @@ -197,7 +197,6 @@ class ConsoView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView): return context - class TransactionSearchView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): model = Note context_object_name = "note"