]> git.parisson.com Git - telemeta.git/commitdiff
Select all items in collection (fix #151)
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 4 Aug 2017 21:01:45 +0000 (23:01 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 4 Aug 2017 21:02:25 +0000 (23:02 +0200)
telemeta/static/telemeta/js/mediacollection_list.js [new file with mode: 0644]
telemeta/templates/telemeta/inc/mediaitem_list.html

diff --git a/telemeta/static/telemeta/js/mediacollection_list.js b/telemeta/static/telemeta/js/mediacollection_list.js
new file mode 100644 (file)
index 0000000..99ffcf6
--- /dev/null
@@ -0,0 +1,17 @@
+/**
+ * Created by crem on 19/05/16.
+ */
+$(function () {
+    $("#selectAll").click(function () {
+        if (this.checked) {
+            $(".check1").each(function () {
+                this.checked = true;
+            });
+        }
+        else {
+            $(".check1").each(function () {
+                this.checked = false;
+            });
+        }
+    });
+});
index 93dc3fa4328ff90d4ec3c58c9d21909aad0f6354..819af103c52dfb860fe1f11149057b105beaabbd 100644 (file)
@@ -4,85 +4,85 @@
 {% block extra_javascript %}
 <script src="{{ STATIC_URL }}telemeta/js/popupdiv.js" type="text/javascript"></script>
 <script src="{{ STATIC_URL }}telemeta/js/playlist.js" type="text/javascript"></script>
+<script src="{{ STATIC_URL }}telemeta/js/mediacollection_list.js" type="text/javascript"></script>
 {% endblock %}
 
 {% if items %}
     {% if user.is_authenticated %}
+        <form action="{% url "playlist"%}" method="post">
+        {% csrf_token %}
+    {% endif %}
 
-<form action="{% url "playlist"%}" method="post">
-{% csrf_token %}
+    <table class="listing">
+        <thead>
+            <tr>
+                <th></th>
+                <th>{% trans "Title" %}</th>
+                <th>{% trans "Digitized" %}</th>
+                <th>{% trans "Recordist" %}</th>
+                {% if location_name %}
+                    <th>{% trans "Location" %}</th>
+                {% else %}
+                    <th>{% trans "Country/Continent" %}</th>
+                {% endif %}
+                <th>{% trans "Year of recording" %}</th>
+                <th>{% trans "Code" %}</th>
+                {% if user.is_authenticated %}
+                    <th class="highlight"><input id="selectAll" type="checkbox"/> select all </th>
+                {% endif %}
+            </tr>
+        </thead>
+    <tbody>
 
-{% endif %}
+    {% for item in items %}
+    <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
+        <!-- Add the button to listen the item -->
+        <td align="center" style="vertical-align:middle;">
+            {% if item.file %}
+                <a href="#" id="{% url 'telemeta-item-export' item.public_id 'mp3' %}" onclick="playlistUtils.changeGlyph(this.id)" class="glyphicon glyphicon-play" style="font-size: 1.3em;text-decoration: none"><p style="opacity:0;font-size:0">d</p></a>
+            {% endif %}
+        </td>
+        <td>
+            <a href="{% url "telemeta-item-detail" item.public_id %}">{{ item }}</a>
+        </td>
+        <td align="center">
+            {% if item.file %}
+             <span class="glyphicon glyphicon-ok" style="font-size: 1.3em;color: green;"><p style="opacity:0;font-size:0">d</p></span>
+            {% endif %}
+        </td>
 
-<table class="listing">
-<thead>
-<tr>
-    <th></th>
-    <th>{% trans "Title" %}</th>
-    <th>{% trans "Digitized" %}</th>
-    <th>{% trans "Recordist" %}</th>
-    {% if location_name %}
-    <th>{% trans "Location" %}</th>
-    {% else %}
-    <th>{% trans "Country/Continent" %}</th>
-    {% endif %}
-    <th>{% trans "Year of recording" %}</th>
-    <th>{% trans "Code" %}</th>
-    {% if user.is_authenticated %}
-    <th class="highlight"><input id="selectAll" type="checkbox"/> select all </th>
-    {% endif %}
-</tr>
-</thead>
-<tbody>
-{% for item in items %}
-<tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
-    <!-- Add the button to listen the item -->
-    <td align="center" style="vertical-align:middle;">
-                    {% if item.file %}
-                    <a href="#" id="{% url 'telemeta-item-export' item.public_id 'mp3' %}" onclick="playlistUtils.changeGlyph(this.id)" class="glyphicon glyphicon-play" style="font-size: 1.3em;text-decoration: none"><p style="opacity:0;font-size:0">d</p></a>
-                    {% endif %}
-    </td>
-    <td>
-        <a href="{% url "telemeta-item-detail" item.public_id %}">{{ item }}</a>
-    </td>
-    <td align="center">
-        {% if item.file %}
-         <span class="glyphicon glyphicon-ok" style="font-size: 1.3em;color: green;"><p style="opacity:0;font-size:0">d</p></span>
+        <td>{{ item.collector }}</td>
+        {% if location_name %}
+            <td>{{ item.location.name }}</td>
+        {% else %}
+            <td>{{ item.country_or_continent|default:'&nbsp;' }}</td>
         {% endif %}
-    </td>
 
-    <td>{{ item.collector }}</td>
-    {% if location_name %}
-    <td>{{ item.location.name }}</td>
-    {% else %}
-    <td>{{ item.country_or_continent|default:'&nbsp;' }}</td>
-    {% endif %}
-    <td>
-    {% if item.recorded_from_date %}
-        {{ item.recorded_from_date.year }}
-        {% if item.recorded_to_date and not item.recorded_to_date.year|equals:item.recorded_from_date.year %}
-            - {{ item.recorded_to_date.year }}
+        <td>
+        {% if item.recorded_from_date %}
+            {{ item.recorded_from_date.year }}
+            {% if item.recorded_to_date and not item.recorded_to_date.year|equals:item.recorded_from_date.year %}
+                - {{ item.recorded_to_date.year }}
+            {% endif %}
         {% endif %}
-    {% endif %}
-    </td>
-    <td>
-        {{ item.code|default:item.old_code }}
-    </td>
-    {% if user.is_authenticated %}
-    <td class="highlight"><input type="checkbox" class="check1" name="selected_items_list" value="{{ item.id }}"/></td>
-    {% endif %}
-</tr>
-{% endfor %}
-</tbody>
-</table>
-
-    {% if user.is_authenticated %}
-
-    <button style="margin-top:10px" type="submit" id="btn" class="btn btn-default">{% trans "Add to playlist" %}</button>
+        </td>
 
-</form>
+        <td>
+            {{ item.code|default:item.old_code }}
+        </td>
 
+        {% if user.is_authenticated %}
+            <td class="highlight"><input type="checkbox" class="check1" name="selected_items_list" value="{{ item.id }}"/></td>
         {% endif %}
+    </tr>
+    {% endfor %}
+    </tbody>
+    </table>
+
+    {% if user.is_authenticated %}
+        <button style="margin-top:10px" type="submit" id="btn" class="btn btn-default">{% trans "Add to playlist" %}</button>
+        </form>
+    {% endif %}
 
 {% else %}
     <p>{% trans "No item" %}</p>