1 # -*- coding: utf-8 -*-
3 # This file is part of MIL/PEER, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6 from django import template
8 register = template.Library()
14 <!-- The template to display files available for upload -->
15 <script id="template-upload" type="text/x-tmpl">
16 {% for (var i=0, file; file=o.files[i]; i++) { %}
17 <tr class="template-upload fade">
18 <td class="preview"><span class="fade"></span></td>
19 <td class="name"><span>{%=file.name%}</span></td>
20 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
21 {% if (file.error) { %}
22 <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span>
23 {%=locale.fileupload.errors[file.error] || file.error%}</td>
24 {% } else if (o.files.valid && !i) { %}
26 <div class="progress progress-success progress-striped active">
27 <div class="bar" style="width:0%;"></div>
30 <td class="start">{% if (!o.options.autoUpload) { %}
31 <button class="btn btn-success">
32 <i class="icon-upload icon-white"></i>
33 <span>{%=locale.fileupload.start%}</span>
39 <td class="cancel">{% if (!i) { %}
40 <button class="btn btn-warning">
41 <i class="icon-ban-circle icon-white"></i>
42 <span>{%=locale.fileupload.cancel%}</span>
48 <!-- The template to display files available for download -->
49 <script id="template-download" type="text/x-tmpl">
50 {% for (var i=0, file; file=o.files[i]; i++) { %}
51 <tr class="template-download fade">
52 {% if (file.error) { %}
54 <td class="name"><span>{%=file.name%}</span></td>
55 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
56 <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span>
57 {%=locale.fileupload.errors[file.error] || file.error%}</td>
59 <td class="preview">{% if (file.thumbnail_url) { %}
60 <a href="{%=file.url%}" title="{%=file.name%}" rel="gallery"
61 download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
64 <a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}"
65 download="{%=file.name%}">{%=file.name%}</a>
67 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
71 <button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
72 <i class="icon-trash icon-white"></i>
73 <span>{%=locale.fileupload.destroy%}</span>
75 <input type="checkbox" name="delete" value="1">