Add 'only' filtering by facet.
This commit is contained in:
parent
9084dba5c1
commit
5eb927565d
|
@ -24,29 +24,33 @@
|
||||||
<h5>item type</h5>
|
<h5>item type</h5>
|
||||||
{% for item_type in 'xanadoc', 'xanalink', 'sourcedoc' %}
|
{% for item_type in 'xanadoc', 'xanalink', 'sourcedoc' %}
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" checked="checked" id="type_{{ item_type }}">
|
<input class="form-check-input facet_type" type="checkbox" checked="checked" id="type_{{ item_type }}">
|
||||||
<label class="form-check-label" for="type_{{ item_type }}"> {{ item_type }}</label>
|
<label class="form-check-label" for="type_{{ item_type }}"> {{ item_type }}</label>
|
||||||
|
– <a href="#" class="only facet_type" data-facet-value="{{ item_type }}">only</a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<h5>user</h5>
|
<h5>user</h5>
|
||||||
{% for item_user in users %}
|
{% for item_user in users %}
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" checked="checked" id="user_{{ item_user }}">
|
<input class="form-check-input facet_user" type="checkbox" checked="checked" id="user_{{ item_user }}">
|
||||||
<label class="form-check-label" for="user_{{ item_user }}">{{ item_user }}</label><br/>
|
<label class="form-check-label" for="user_{{ item_user }}">{{ item_user }}</label>
|
||||||
|
– <a href="#" class="only facet_user" data-facet-value="{{ item_user }}">only</a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<h5>link type</h5>
|
<h5>link type</h5>
|
||||||
{% for link_type in link_types %}
|
{% for link_type in link_types %}
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" checked="checked" id="link_type_{{ link_type }}">
|
<input class="form-check-input facet_link_type" type="checkbox" checked="checked" id="link_type_{{ link_type }}">
|
||||||
<label class="form-check-label" for="link_type_{{ link_type }}">{{ link_type }}</label><br/>
|
<label class="form-check-label" for="link_type_{{ link_type }}">{{ link_type }}</label>
|
||||||
|
– <a href="#" class="only facet_link_type" data-facet-value="{{ link_type }}">only</a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<h5>years</h5>
|
<h5>years</h5>
|
||||||
{% for year in years %}
|
{% for year in years %}
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" checked="checked" id="year_{{ year }}">
|
<input class="form-check-input facet_year" type="checkbox" checked="checked" id="year_{{ year }}">
|
||||||
<label class="form-check-label" for="year_{{ year }}">{{ year }}</label><br/>
|
<label class="form-check-label" for="year_{{ year }}">{{ year }}</label>
|
||||||
|
– <a href="#" class="only facet_year" data-facet-value="{{ year }}">only</a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</form>
|
</form>
|
||||||
|
@ -106,6 +110,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#lower-buttons').toggle(visible_count != 0);
|
$('#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());
|
$(update_list());
|
||||||
|
|
Loading…
Reference in a new issue