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
7 from django.utils.safestring import mark_safe
9 register = template.Library()
15 <!-- The template to display files available for upload -->
16 <script id="template-upload" type="text/x-tmpl">
17 {% for (var i=0, file; file=o.files[i]; i++) { %}
18 <tr class="template-upload fade">
19 <td class="preview"><span class="fade"></span></td>
20 <td class="name"><span>{%=file.name%}</span></td>
21 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
22 {% if (file.error) { %}
23 <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span>
24 {%=locale.fileupload.errors[file.error] || file.error%}</td>
25 {% } else if (o.files.valid && !i) { %}
27 <div class="progress progress-success progress-striped active">
28 <div class="bar" style="width:0%;"></div>
31 <td class="start">{% if (!o.options.autoUpload) { %}
32 <button class="btn btn-success">
33 <i class="icon-upload icon-white"></i>
34 <span>{%=locale.fileupload.start%}</span>
40 <td class="cancel">{% if (!i) { %}
41 <button class="btn btn-warning">
42 <i class="icon-ban-circle icon-white"></i>
43 <span>{%=locale.fileupload.cancel%}</span>
49 <!-- The template to display files available for download -->
50 <script id="template-download" type="text/x-tmpl">
51 {% for (var i=0, file; file=o.files[i]; i++) { %}
52 <tr class="template-download fade">
53 {% if (file.error) { %}
55 <td class="name"><span>{%=file.name%}</span></td>
56 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
57 <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span>
58 {%=locale.fileupload.errors[file.error] || file.error%}</td>
60 <td class="preview">{% if (file.thumbnail_url) { %}
61 <a href="{%=file.url%}" title="{%=file.name%}" rel="gallery"
62 download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
65 <a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}"
66 download="{%=file.name%}">{%=file.name%}</a>
68 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
72 <button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
73 <i class="icon-trash icon-white"></i>
74 <span>{%=locale.fileupload.destroy%}</span>
76 <input type="checkbox" name="delete" value="1">