]> git.0d.be Git - panikweb.git/commitdiff
special case the "all untoggled" case to display all emissions/sounds
authorFrédéric Péters <fpeters@0d.be>
Wed, 11 Sep 2013 13:28:49 +0000 (15:28 +0200)
committerFrédéric Péters <fpeters@0d.be>
Wed, 11 Sep 2013 13:28:49 +0000 (15:28 +0200)
panikweb_templates/static/js/specifics.js
panikweb_templates/templates/emissions/nav.html
panikweb_templates/templates/listen/nav.html

index 2668d1a53dbe30a5cf64814f171be249e3fa42e2..64ba242cd18ee293a4e9675abef3dabc8e2c02ac 100644 (file)
@@ -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');
index 4711632a8ffe10dcc76687195b84af05d7e825a5..cec66f1e38d38cd241efe8022e1d42981ccef20d 100644 (file)
                <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>
index 59bbfa1e710f2b348b3949db7c13fe5833fb68a4..14e1e5c4a8b1783f5c77ca0e7365df378dbf0305 100644 (file)
@@ -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>