implement basic channel query string for downloads page

This commit is contained in:
simon 2022-10-05 15:47:17 +02:00
parent c9e936da21
commit fbb52dc93f
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 13 additions and 4 deletions

View File

@ -362,7 +362,7 @@ class DownloadView(ArchivistResultsView):
def get(self, request):
"""handle get request"""
self.initiate_vars(request)
self._update_view_data()
self._update_view_data(request)
self.find_results()
self.context.update(
{
@ -372,15 +372,24 @@ class DownloadView(ArchivistResultsView):
)
return render(request, "home/downloads.html", self.context)
def _update_view_data(self):
def _update_view_data(self, request):
"""update downloads view specific data dict"""
if self.context["show_ignored_only"]:
filter_view = "ignore"
else:
filter_view = "pending"
must_list = [{"term": {"status": {"value": filter_view}}}]
channel_filter = request.GET.get("channel", False)
if channel_filter:
must_list.append(
{"term": {"channel_id": {"value": channel_filter}}}
)
self.data.update(
{
"query": {"term": {"status": {"value": filter_view}}},
"query": {"bool": {"must": must_list}},
"sort": [{"timestamp": {"order": "asc"}}],
}
)

View File

@ -140,7 +140,7 @@ function toggleCheckbox(checkbox) {
var payload = JSON.stringify(payloadDict);
sendPost(payload);
setTimeout(function(){
var currPage = window.location.pathname;
var currPage = window.location.pathname + window.location.search;
window.location.replace(currPage);
return false;
}, 500);