]> git.parisson.com Git - telemeta.git/commitdiff
add condition on checkboxes display in search results
authorafilsaime <shadow_kungfu@hotmail.fr>
Tue, 2 Jun 2015 09:07:11 +0000 (11:07 +0200)
committerafilsaime <shadow_kungfu@hotmail.fr>
Tue, 2 Jun 2015 09:07:11 +0000 (11:07 +0200)
telemeta/templates/search/mediaitem_listhaystack.html

index 4a7ed19961dfb05fab70d0385d8f4b3cf8332ba3..103fb6940d0e1d93cd9559bb15c533eb45e57d24 100644 (file)
@@ -8,8 +8,12 @@
 
 <table class="listing">
 <tr>
-    <th class="highlight"><input id="selectAll" type="checkbox"/> select all </th>
-    <th>{% trans "Title" %}</th>
+    {% if user.is_authenticated %}
+        <th class="highlight"><input id="selectAll" type="checkbox"/> select all </th>
+        <th>{% trans "Title" %}</th>
+    {% else %}
+        <th class="highlight">{% trans "Title" %}</th>
+    {% endif %}
     <th>{% trans "Digitized" %}</th>
     <th>{% trans "Recordist" %}</th>
     {% if location_name %}
     <th>{% trans "Year of recording" %}</th>
     <th>{% trans "Code" %}</th>
 </tr>
-{% for result in page.object_list %}
-<tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
-    <td class="highlight"><input type="checkbox" class="check1"/></td>
-    <td>
-        <a href="{% url "telemeta-item-detail" result.object.public_id %}">{{ result.object }}</a></br>
-    </td>
-    <td align="center">
-        {% if result.object.file %}
-         <a href="{% url "telemeta-item-detail" result.object.public_id %}">
-          <center><span class="glyphicon glyphicon-volume-up" style="font-size: 1.3em;"></span></center>
+{% if user.is_authenticated %}
+    {% for result in page.object_list %}
+    <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
+        <td class="highlight"><input type="checkbox" class="check1"/></td>
+        <td>
+            <a href="{% url "telemeta-item-detail" result.object.public_id %}">{{ result.object }}</a></br>
+        </td>
+        <td align="center">
+            {% if result.object.file %}
+             <a href="{% url "telemeta-item-detail" result.object.public_id %}">
+              <center><span class="glyphicon glyphicon-volume-up" style="font-size: 1.3em;"></span></center>
+            {% endif %}
+        </td>
+
+        <td>{{ result.object.collector }}</td>
+        <td>{{ result.object.location.name }}</td>
+        <td>
+        {% if result.object.recorded_from_date %}
+            {{ result.object.recorded_from_date.year }}
+            {% if result.object.recorded_to_date and not result.object.recorded_to_date.year|equals:result.object.recorded_from_date.year %}
+                - {{ result.object.recorded_to_date.year }}
+            {% endif %}
         {% endif %}
-    </td>
-
-    <td>{{ result.object.collector }}</td>
-    <td>{{ result.object.location.name }}</td>
-    <td>
-    {% if result.object.recorded_from_date %}
-        {{ result.object.recorded_from_date.year }}
-        {% if result.object.recorded_to_date and not result.object.recorded_to_date.year|equals:result.object.recorded_from_date.year %}
-            - {{ result.object.recorded_to_date.year }}
+        </td>
+        <td>
+            {{ result.object.code|default:result.object.old_code }}
+        </td>
+    </tr>
+    {% endfor %}
+{% else %}
+    {% for result in page.object_list %}
+    <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
+        <td class="highlight">
+            <a href="{% url "telemeta-item-detail" result.object.public_id %}">{{ result.object }}</a></br>
+        </td>
+        <td align="center">
+            {% if result.object.file %}
+             <a href="{% url "telemeta-item-detail" result.object.public_id %}">
+              <center><span class="glyphicon glyphicon-volume-up" style="font-size: 1.3em;"></span></center>
+            {% endif %}
+        </td>
+
+        <td>{{ result.object.collector }}</td>
+        <td>{{ result.object.location.name }}</td>
+        <td>
+        {% if result.object.recorded_from_date %}
+            {{ result.object.recorded_from_date.year }}
+            {% if result.object.recorded_to_date and not result.object.recorded_to_date.year|equals:result.object.recorded_from_date.year %}
+                - {{ result.object.recorded_to_date.year }}
+            {% endif %}
         {% endif %}
-    {% endif %}
-    </td>
-    <td>
-        {{ result.object.code|default:result.object.old_code }}
-    </td>
-</tr>
-{% endfor %}
+        </td>
+        <td>
+            {{ result.object.code|default:result.object.old_code }}
+        </td>
+    </tr>
+    {% endfor %}
+{% endif %}
+
 </table>
 {% else %}
     <p>{% trans "No results found" %}</p>