Commit 928088bf authored by fred's avatar fred
Browse files

special case the "all untoggled" case to display all emissions/sounds

parent 4f14dfa5
......@@ -310,9 +310,22 @@ $(function() {
$(this).trigger('uncheck');
});
$('[data-toggle]').on('check',function(){
/* make sure all other unchecked items are hidden */
$('[data-toggle].icon-check-empty').each(function() {
$($(this).attr('data-about')).find($(this).attr('data-toggle')).hide();
});
$($(this).attr('data-about')).find($(this).attr('data-toggle')).show();
}).on('uncheck',function(){
$($(this).attr('data-about')).find($(this).attr('data-toggle')).hide();
if ($('[data-toggle].icon-check').length == 0) {
/* special case the situation where all toggles
* are unchecked, as we want that to mean
* "everything", not "nothing".
*/
$('[data-toggle].icon-check-empty').each(function() {
$($(this).attr('data-about')).find($(this).attr('data-toggle')).show();
});
}
}).on('click',function(){
$(this).toggleClass('icon-check icon-check-empty');
if($(this).hasClass('icon-check')){$(this).trigger('check');
......
......@@ -26,13 +26,13 @@
<nav id="gridNav" class="checkable">
<ul class="by{{ categories.count }}">
{% if class = "emissions" %}
<li><button class="check icon-check" data-about="#Main" data-toggle=".nocat">?</button></li>
<li><button class="check icon-check-empty" data-about="#Main" data-toggle=".nocat">?</button></li>
{% endif %}
{% for category in categories %}
{% if class = "grid" %}
<li><button class="check icon-check-empty" data-about="#Main" data-highlight=".{{ category|slugify }}">{{ category }}&nbsp;<span class="icon-{{category|slugify}}"></span></button></li>
{% else %}
<li><button class="check icon-check" data-about="#Main" data-toggle=".{{ category|slugify }}">{{ category }}&nbsp;<span class="icon-{{category|slugify}}"></span></button></li>
<li><button class="check icon-check-empty" data-about="#Main" data-toggle=".{{ category|slugify }}">{{ category }}&nbsp;<span class="icon-{{category|slugify}}"></span></button></li>
{% endif %}
{% endfor %}
</ul>
......
......@@ -17,9 +17,9 @@
{% if categories and class != "archives" %}
<nav id="gridNav" class="checkable">
<ul class="by{{ categories.count }}">
<li><button class="check icon-check" data-about="#Main" data-toggle=".nocat">?</button></li>
<li><button class="check icon-check-empty" data-about="#Main" data-toggle=".nocat">?</button></li>
{% for category in categories %}
<li><button class="check icon-check" data-about="#Main" data-toggle=".{{ category|slugify }}">{{ category }}</button></li>
<li><button class="check icon-check-empty" data-about="#Main" data-toggle=".{{ category|slugify }}">{{ category }}</button></li>
{% endfor %}
</ul>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment