1 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django import template
5 from django.utils.safestring import mark_safe
7 register = template.Library()
12 <!-- The template to display files available for upload -->
13 <script id="template-upload" type="text/x-tmpl">
14 {% for (var i=0, file; file=o.files[i]; i++) { %}
15 <tr class="template-upload fade">
16 <td class="preview"><span class="fade"></span></td>
17 <td class="name"><span>{%=file.name%}</span></td>
18 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
19 {% if (file.error) { %}
20 <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
21 {% } else if (o.files.valid && !i) { %}
23 <div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
25 <td class="start">{% if (!o.options.autoUpload) { %}
26 <button class="btn btn-success">
27 <i class="icon-upload icon-white"></i>
28 <span>{%=locale.fileupload.start%}</span>
34 <td class="cancel">{% if (!i) { %}
35 <button class="btn btn-warning">
36 <i class="icon-ban-circle icon-white"></i>
37 <span>{%=locale.fileupload.cancel%}</span>
43 <!-- The template to display files available for download -->
44 <script id="template-download" type="text/x-tmpl">
45 {% for (var i=0, file; file=o.files[i]; i++) { %}
46 <tr class="template-download fade">
47 {% if (file.error) { %}
49 <td class="name"><span>{%=file.name%}</span></td>
50 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
51 <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
53 <td class="preview">{% if (file.thumbnail_url) { %}
54 <a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
57 <a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
59 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
63 <button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
64 <i class="icon-trash icon-white"></i>
65 <span>{%=locale.fileupload.destroy%}</span>
67 <input type="checkbox" name="delete" value="1">