diff --git a/apps/note/templates/note/conso_form.html b/apps/note/templates/note/conso_form.html
index 6c598a29..5d9007d4 100644
--- a/apps/note/templates/note/conso_form.html
+++ b/apps/note/templates/note/conso_form.html
@@ -130,11 +130,11 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% endfor %}
+ placeholder="{% trans "Search button..." %}" type="search" id="search-input"/>
- {% for button in search_results %}
+ {% for button in all_buttons %}
{% if button.display %}
-
@@ -202,33 +202,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% endfor %}
{% 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 = () => {
- let newdoc = parser.parseFromString(xhr.responseText, "text/html");
- document.getElementById("search-results").innerHTML =
- newdoc.getElementById("search-results").innerHTML;
- eval(newdoc.getElementById("search-script").text);
- };
- xhr.send();
- }
-
- searchbar.addEventListener("input", function (e) {
- debounce(updateSearch)()
- });
-
-
{% 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"