Save audiobook project funding info in the model.
[wolnelektury.git] / src / catalogue / templates / catalogue / snippets / jplayer.html
index e1339ad..c82c1e8 100644 (file)
@@ -1,8 +1,8 @@
-{% load i18n %}
-{% if audiobooks %}
-  <div class="jp-type-playlist">
+{% load i18n catalogue_tags %}
+{% if audiobooks %}{% if book|status:request.user != 'closed' %}
+  <div class="jp-type-playlist" data-book-id="{{ book.pk }}" data-book-slug="{{ book.slug }}">
     <div id="jplayer" class="jp-jplayer" data-player="jp_container_{{ book.pk }}"
-         data-supplied="{% if have_oggs %}oga,{% endif %}mp3"></div>
+         data-supplied="oga,mp3"></div>
     <div id="jp_container_{{ book.pk }}" class="jp-audio">
       <div class="jp-type-single">
         <span class="title"></span>
         <div class="jp-playlist">
           <ul>
             {% for i in audiobooks %}
-              <li data-mp3='{{ i.mp3.file.url }}' data-ogg='{{ i.ogg.file.url }}'>
+              <li data-mp3='{{ i.mp3.file.url }}' data-ogg='{{ i.ogg.file.url }}' data-media-id="{{ i.mp3.id }}">
                 <div class='play'>{{ i.mp3.name }}
                   <div class='extra-info'>
-                    {% trans "Artist:" %} <span class='artist'>{{ i.mp3.extra_info.artist_name }}</span>,
-                    {% trans "director:" %} <span class='director'>{{ i.mp3.extra_info.director_name }}</span>
+                  {% with extra_info=i.mp3.get_extra_info_json %}
+                    {% trans "Artist:" %}&nbsp;<span class='artist'>{{ extra_info.artist_name }}</span>,
+                    {% trans "director:" %}&nbsp;<span class='director'>{{ extra_info.director_name }}</span>
+                    {% if extra_info.license %}{% license_icon extra_info.license %}{% endif %}
+                    {% if i.mp3.project_icon %}<img src="{{ i.mp3.project_icon }}">{% endif %}
+                    <p>
+                     {% if i.mp3.project_description %}{{ i.mp3.project_description }}{% else %}
+                      {% with fb=extra_info.funded_by %}
+                        {% if fb %}Dofinansowano ze środków: {{ fb }}.{% endif %}
+                      {% endwith %}
+                    {% endif %}
+                    </p>
+                 {% endwith %}
                   </div>
                 </div>
               </li>
@@ -56,4 +67,4 @@
       {% endif %}
     </div>
   </div>
-{% endif %}
+{% endif %}{% endif %}