]> git.parisson.com Git - telemeta.git/commitdiff
add accordeon for playlist to make easier for view
authorKaltar5679 <killian.mary@outlook.fr>
Tue, 2 Jun 2015 14:31:13 +0000 (16:31 +0200)
committerKaltar5679 <killian.mary@outlook.fr>
Tue, 2 Jun 2015 14:31:13 +0000 (16:31 +0200)
telemeta/templates/telemeta/lists.html
telemeta/views/core.py

index df2f3cb015c6057bc66f91b213e510e41b860e69..f5355825c71a6adf9b7996b36926fdf6006b55e5 100644 (file)
@@ -2,6 +2,12 @@
 {% load telemeta_utils %}
 {% load i18n %}
 
+{% comment "added by Killian Mary" %}{% endcomment %}
+{% block extra_stylesheets %}
+    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}telemeta/css/jquery-ui.css" />
+{% endblock %}
+{% comment "added by Killian Mary end" %}{% endcomment %}
+
 {% 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>
@@ -29,10 +35,29 @@ $(document).ready(function(){
     {% endfor %}
 });
 </script>
-{% comment "added by Killian Mary end" %}{% endcomment %}
+
+    <script src="{{ STATIC_URL }}telemeta/js/jquery.js" type="text/javascript"></script>
+    <script src="{{ STATIC_URL }}telemeta/js/jquery-ui.min.js" type="text/javascript"></script>
+    <script>
+        $(document).ready(function() {
+            var nouvellesIcones = {
+                header : 'ui-icon-carat-1-e',
+                activeHeader : 'ui-icon-carat-1-s',
+
+            };
+
+            $("#accordeon").accordion({
+                collapsible : true,
+                icons : nouvellesIcones,
+                heightStyle: "content",
+            });
+        });
+    </script>
 
 {% endblock %}
 
+{% comment "added by Killian Mary end" %}{% endcomment %}
+
 {% block content %}
 <div id="module-set" style="width: 33%">
 
@@ -65,80 +90,86 @@ $(document).ready(function(){
     </button>
     </a>
 
+    <div id="accordeon" style="margin-bottom:20px">
+
     {% for playlist in playlists %}
-    <table class="listing" style="width:100%;margin-top: 3em">
-        <tr>
-            <td style="border-bottom:1px solid #6A0307;color:#6A0307;font-size: 100%">{{ playlist.playlist.title }}</td>
-            <td style="width:86ex; padding-right: 0; border-bottom:1px solid #6A0307; text-align:right">
-            <a href="#" id="{{playlist.playlist.public_id}}" onclick="playlistUtils.showEdit(this, this.id); return false;" class="component_icon button icon_edit">{% trans "Edit" %}</a>
-                <a href="{% url "telemeta-playlist-csv-export" playlist.playlist.public_id 'collections' %}" class="component_icon button icon_csv">CSV Collections</a>
-                <a href="{% url "telemeta-playlist-csv-export" playlist.playlist.public_id 'items' %}" class="component_icon button icon_csv">CSV Items</a>
-                <a href="#" id="{{playlist.playlist.public_id}}" onclick="if(confirm(gettrans('delete the playlist permanently?'))){playlistUtils.remove(this.id);};return false;" class="component_icon button icon_cancel">{% trans "Delete" %}</a>
-            </td>
-        </tr>
-        {% if playlist.playlist.description %}
-         <tr>
-          <td colspan="2" style="border-bottom:1px solid #6A0307;color:#6A0307;font-size: 80%">{{ playlist.playlist.description }}</td>
-         </tr>
-        {% endif %}
-    </table>
-    {% comment "added by Killian Mary, for sort table" %}{% endcomment %}
-    <table id="{{playlist.playlist.public_id}}tb" class="listing" width="100%">
-        <thead>
-        <tr>
-            <th class="highlight">{% trans "Title" %}</th>
-            <th>{% trans "Type" %}</th>
-            <th>{% trans "Code" %}</th>
-            <th>{% trans "Recordist" %}</th>
-            <th>{% trans "Recording period" %}</th>
-            <th>{% trans "Digitized" %}</th>
-            <th>{% trans "Action" %}</th>
-        </tr>
-        </thead>
-        <tbody>
-        {% for resource in playlist.resources %}
-        <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
-            <td>
-                {% if resource.type == "item" and not resource.element == None %}
-                <a href="{% url "telemeta-item-detail" resource.element.public_id %}">{{ resource.element }}</a>
-                {% endif %}
-                {% if resource.type == "collection" and not resource.element == None %}
-                <a href="{% url "telemeta-collection-detail" resource.element.public_id %}">{% if resource.element.title %}{{ resource.element.title }}{% else %}{{ resource.element }}{% endif %}</a>
-                {% endif %}
-                {% if resource.type == "marker" and not resource.element == None  %}
-                <a href="{% url "telemeta-item-detail-marker" resource.element.public_id %}">{{ resource.element }}</a>
-                {% endif %}
-                {% if resource.type == "corpus" or resource.type == "fonds" %}
-                <a href="{% url "telemeta-resource-detail" resource.type resource.element.public_id %}">{{ resource.element.title }}</a>
-                {% endif %}
-                {% if resource.element == None %}{% trans "deleted" %}{% endif %}
-            </td>
-            <td>{{ resource.type }}</td>
-            <td>
-                {{ resource.element.public_id }}
-            </td>
-            <td>{{ resource.element.apparent_collector }}</td>
-
-            <td>
-                {% if resource.element.recorded_from_date %}
-                {{ resource.element.recorded_from_date.year }}
-                {% if resource.element.recorded_to_date and not resource.element.recorded_to_date.year|equals:resource.element.recorded_from_date.year %}
-                - {{ resource.element.recorded_to_date.year }}
-                {% endif %}
-                {% endif %}
-            </td>
-            <td align="center" style="vertical-align:middle;">
-                {% if resource.element.file or resource.element.has_mediafile %}
-                <span class="glyphicon glyphicon-volume-up" style="font-size: 1.3em;"><p style="opacity:0;font-size:0">d</p></span>
-                {% endif %}
-            </td>
-            <td style="vertical-align:middle">
-            <a href="#" onclick="if(confirm(gettrans('delete the resource from the playlist permanently?'))){playlistUtils.removeResource('{{resource.public_id}}');};return false;" class="component_icon button icon_cancel" style="padding: 4px 12px;"></a>
-            </td>
-        </tr>
-        {% endfor %}
-        </tbody>
-    </table>
+
+    <div><a href="#">{{ playlist.playlist.title }}</a></div>
+    <div>
+        <table class="listing" style="width:100%;margin-top: 3em">
+            <tr>
+                <td style="border-bottom:1px solid #6A0307;color:#6A0307;font-size: 100%">{{ playlist.playlist.title }}</td>
+                <td style="width:86ex; padding-right: 0; border-bottom:1px solid #6A0307; text-align:right">
+                <a href="#" id="{{playlist.playlist.public_id}}" onclick="playlistUtils.showEdit(this, this.id); return false;" class="component_icon button icon_edit">{% trans "Edit" %}</a>
+                    <a href="{% url "telemeta-playlist-csv-export" playlist.playlist.public_id 'collections' %}" class="component_icon button icon_csv">CSV Collections</a>
+                    <a href="{% url "telemeta-playlist-csv-export" playlist.playlist.public_id 'items' %}" class="component_icon button icon_csv">CSV Items</a>
+                    <a href="#" id="{{playlist.playlist.public_id}}" onclick="if(confirm(gettrans('delete the playlist permanently?'))){playlistUtils.remove(this.id);};return false;" class="component_icon button icon_cancel">{% trans "Delete" %}</a>
+                </td>
+            </tr>
+            {% if playlist.playlist.description %}
+             <tr>
+              <td colspan="2" style="border-bottom:1px solid #6A0307;color:#6A0307;font-size: 80%">{{ playlist.playlist.description }}</td>
+             </tr>
+            {% endif %}
+        </table>
+        {% comment "added by Killian Mary, for sort table" %}{% endcomment %}
+        <table id="{{playlist.playlist.public_id}}tb" class="listing" width="100%">
+            <thead>
+            <tr>
+                <th class="highlight">{% trans "Title" %}</th>
+                <th>{% trans "Type" %}</th>
+                <th>{% trans "Code" %}</th>
+                <th>{% trans "Recordist" %}</th>
+                <th>{% trans "Recording period" %}</th>
+                <th>{% trans "Digitized" %}</th>
+                <th>{% trans "Action" %}</th>
+            </tr>
+            </thead>
+            <tbody>
+            {% for resource in playlist.resources %}
+            <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
+                <td>
+                    {% if resource.type == "item" and not resource.element == None %}
+                    <a href="{% url "telemeta-item-detail" resource.element.public_id %}">{{ resource.element }}</a>
+                    {% endif %}
+                    {% if resource.type == "collection" and not resource.element == None %}
+                    <a href="{% url "telemeta-collection-detail" resource.element.public_id %}">{% if resource.element.title %}{{ resource.element.title }}{% else %}{{ resource.element }}{% endif %}</a>
+                    {% endif %}
+                    {% if resource.type == "marker" and not resource.element == None  %}
+                    <a href="{% url "telemeta-item-detail-marker" resource.element.public_id %}">{{ resource.element }}</a>
+                    {% endif %}
+                    {% if resource.type == "corpus" or resource.type == "fonds" %}
+                    <a href="{% url "telemeta-resource-detail" resource.type resource.element.public_id %}">{{ resource.element.title }}</a>
+                    {% endif %}
+                    {% if resource.element == None %}{% trans "deleted" %}{% endif %}
+                </td>
+                <td>{{ resource.type }}</td>
+                <td>
+                    {{ resource.element.public_id }}
+                </td>
+                <td>{{ resource.element.apparent_collector }}</td>
+
+                <td>
+                    {% if resource.element.recorded_from_date %}
+                    {{ resource.element.recorded_from_date.year }}
+                    {% if resource.element.recorded_to_date and not resource.element.recorded_to_date.year|equals:resource.element.recorded_from_date.year %}
+                    - {{ resource.element.recorded_to_date.year }}
+                    {% endif %}
+                    {% endif %}
+                </td>
+                <td align="center" style="vertical-align:middle;">
+                    {% if resource.element.file or resource.element.has_mediafile %}
+                    <span class="glyphicon glyphicon-volume-up" style="font-size: 1.3em;"><p style="opacity:0;font-size:0">d</p></span>
+                    {% endif %}
+                </td>
+                <td style="vertical-align:middle">
+                <a href="#" onclick="if(confirm(gettrans('delete the resource from the playlist permanently?'))){playlistUtils.removeResource('{{resource.public_id}}');};return false;" class="component_icon button icon_cancel" style="padding: 4px 12px;"></a>
+                </td>
+            </tr>
+            {% endfor %}
+            </tbody>
+        </table>
+    </div>
     {% endfor %}
 </div>
 {% endblock %}
index 61cad53794e8649c7d0fa9d70505ababed26a1e5..c7ed919ae1757324b2f4223a2db8afa50fd5eae1 100644 (file)
@@ -227,7 +227,7 @@ def get_playlists(request, user=None):
                     element = None
                 resources.append({'element': element, 'type': resource.resource_type, 'public_id': resource.public_id })
             playlists.append({'playlist': playlist, 'resources': resources})
-        #add by Killian Mary for sort list by title
+        #add by Killian Mary for sort playlist by title
         playlists.sort(key=lambda x: x['playlist'].title)
     return playlists