From 7db6b0a8a6094eb5abafdfd957c643553c67120e Mon Sep 17 00:00:00 2001 From: jdcaballerov Date: Mon, 14 Dec 2020 12:11:44 -0500 Subject: [PATCH] Preserve query string between snapshot list views --- archivebox/themes/admin/base.html | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/archivebox/themes/admin/base.html b/archivebox/themes/admin/base.html index 36f25402..c5cb51c8 100644 --- a/archivebox/themes/admin/base.html +++ b/archivebox/themes/admin/base.html @@ -108,8 +108,8 @@ {% endif %} {% trans 'Log out' %} | - - ⣿⣿   + + ⣿⣿ {% endblock %} {% endif %} @@ -182,8 +182,27 @@ }); } }; + + function redirectWithQuery(uri){ + uri_query = uri + document.location.search; + window.location = uri_query; + + }; + + function bindSnapshotViewsClick() { + $( document ).ready(function() { + $("#snapshotListView").click(function() { + redirectWithQuery("{% url 'admin:core_snapshot_changelist' %}"); + }); + $("#snapshotGridView").click(function() { + redirectWithQuery("{% url 'admin:grid' %}"); + }); + + }); + }; $(function () { fix_actions(); + bindSnapshotViewsClick(); }); })(django.jQuery);