]> git.parisson.com Git - telemeta.git/commitdiff
fix filter display when no facet found
authorafilsaime <shadow_kungfu@hotmail.fr>
Wed, 6 May 2015 13:59:24 +0000 (15:59 +0200)
committerafilsaime <shadow_kungfu@hotmail.fr>
Wed, 6 May 2015 13:59:24 +0000 (15:59 +0200)
telemeta/templates/search/filters.html
telemeta/views/haystack_search.py

index d47b5fc7351f76832c541c0735e271f444b41155..ecb4eb1fc02fafccee258abbeebcbb9f759b00b9 100644 (file)
@@ -7,6 +7,12 @@
                         {% for item_status in facets.fields.item_status %}
                             <td><a href="{{ request.get_full_path }}&amp;selected_facets=item_status_exact:{{ item_status.0|urlencode }}">{{ item_status.0 }}</a> <span style="background-color:#6a0307" class="badge">{{ item_status.1 }}</span></td>
                         {% endfor %}
+                        {% if Published_count == 0 %}
+                            <td> Published <span class="badge">0</span></td><td></td>
+                        {% endif %}
+                        {% if Unpublished_count == 0 %}
+                            <td> Unpublished <span class="badge">0</span></td><td></td>
+                        {% endif %}
                     {% else %}
                         <td>Item Status</td>
                         <td>None</td>
                                     <td><a href="{{ request.get_full_path }}&amp;selected_facets=media_type_exact:{{ media_type.0|urlencode }}">{{ media_type.0 }}</a> <span style="background-color:#6a0307" class="badge">{{ media_type.1 }}</span></td>
                                 {% endifequal %}
                             {% endfor %}
+                            {% if Video_count == 0 %}
+                                <td> Video <span class="badge">0</span></td><td></td>
+                            {% endif %}
+                            {% if Audio_count == 0 %}
+                                <td> Audio <span class="badge">0</span></td><td></td>
+                            {% endif %}
                         {% endif %}
                     </tr>
+                    <tr>
                     <tr>
                         {% if facets.fields.recording_context %}
                             <td>Recording Context</td>
                                     <td><a href="{{ request.get_full_path }}&amp;selected_facets=recording_context_exact:{{ recording_context.0|urlencode }}">{{ recording_context.0 }}</a> <span style="background-color:#6a0307" class="badge">{{ recording_context.1 }}</span></td>
                                 {% endifequal %}
                             {% endfor %}
+                            {% if Terrain_count == 0 %}
+                                <td> Terrain <span class="badge">0</span></td><td></td>
+                            {% endif %}
+                            {% if Radio_count == 0 %}
+                                <td> Radio <span class="badge">0</span></td><td></td>
+                            {% endif %}
+                            {% if Studio_count == 0 %}
+                                <td> Studio <span class="badge">0</span></td><td></td>
+                            {% endif %}
                         {% endif %}
                     </tr>
                     <tr>
                                     <td><a href="{{ request.get_full_path }}&amp;selected_facets=physical_format_exact:{{ physical_format.0|urlencode }}">{{ physical_format.0 }}</a> <span style="background-color:#6a0307" class="badge">{{ physical_format.1 }}</span></td>
                                 {% endifequal %}
                             {% endfor %}
+                            {% if CDR_count == 0 %}
+                                <td> CDR <span class="badge">0</span></td><td></td>
+                            {% endif %}
+                            {% if Disque_count == 0 %}
+                                <td> Disque <span class="badge">0</span></td><td></td>
+                            {% endif %}
+                            {% if Cylindre_count == 0 %}
+                                <td> Cylindre <span class="badge">0</span></a></td><td></td>
+                            {% endif %}
                         {% endif %}
                     </tr>
                 </table>
index 8d138d667064730636ae353d27e119c092b339aa..c7846502db8776d57ddac5b3d2bb741cbaf2d48a 100644 (file)
@@ -52,9 +52,18 @@ class HaystackSearch(FacetedSearchView):
                 else:
                     viewable_total = viewable_total + viewable[1]
 
+            extra['Published_count']=self.get_results().narrow('item_status:Published').count()
+            extra['Unpublished_count']=self.get_results().narrow('item_status:Unpublished').count()
             extra['viewable_count'] = self.get_results().narrow('item_acces:full OR item_acces:mixed').narrow('digitized:T').count()
             extra['digitized_count'] = self.get_results().narrow('digitized:T').count()
-
+            extra['CDR_count']=self.get_results().narrow('physical_format:CDR').count()
+            extra['Disque_count']=self.get_results().narrow('physical_format:Disque').count()
+            extra['Cylindre_count']=self.get_results().narrow('physical_format:Cylindre').count()
+            extra['Studio_count']=self.get_results().narrow('recording_context:Studio').count()
+            extra['Terrain_count']=self.get_results().narrow('recording_context:Terrain').count()
+            extra['Radio_count']=self.get_results().narrow('recording_context:Radio').count()
+            extra['Video_count']=self.get_results().narrow('media_type:Video').count()
+            extra['Audio_count']=self.get_results().narrow('media_type:Audio').count()
         if self.type == 'collection':
             extra['type'] = 'collection'
         else: