From 5eb927565d19c179b6eb07a145f50002aa9208c9 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 4 Jun 2018 11:53:28 +0100 Subject: [PATCH] Add 'only' filtering by facet. --- sourcing/templates/home.html | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/sourcing/templates/home.html b/sourcing/templates/home.html index 16c194f..329fb56 100644 --- a/sourcing/templates/home.html +++ b/sourcing/templates/home.html @@ -24,29 +24,33 @@
item type
{% for item_type in 'xanadoc', 'xanalink', 'sourcedoc' %}
- + + – only
{% endfor %}
user
{% for item_user in users %}
- -
+ + + – only
{% endfor %}
link type
{% for link_type in link_types %}
- -
+ + + – only
{% endfor %}
years
{% for year in years %}
- -
+ + + – only
{% endfor %} @@ -106,6 +110,16 @@ } $('#lower-buttons').toggle(visible_count != 0); + + $('a.only').click(function(e) { + e.preventDefault(); + var facet = this.className.split(' ').filter(cls => cls.startsWith('facet_'))[0].substr(6); + var value = $(this).data('facet-value'); + var pick = $('input#' + facet + '_' + value); + pick.prop('checked', true); + $('input.facet_' + facet).not(pick).prop('checked', false); + update_list(); + }); } $(update_list());