1 # -*- coding: utf-8 -*-
2 from django import template
4 register = template.Library()
10 <!-- The template to display files available for upload -->
11 <script id="template-upload" type="text/x-tmpl">
12 {% for (var i=0, file; file=o.files[i]; i++) { %}
13 <tr class="template-upload fade">
14 <td class="preview"><span class="fade"></span></td>
15 <td class="name"><span>{%=file.name%}</span></td>
16 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
17 {% if (file.error) { %}
18 <td class="error" colspan="2">
19 <span class="label label-important">{%=locale.fileupload.error%}</span>
20 {%=locale.fileupload.errors[file.error] || file.error%}
22 {% } else if (o.files.valid && !i) { %}
24 <div class="progress progress-success progress-striped active">
25 <div class="bar" style="width:0%;"></div>
28 <td class="start">{% if (!o.options.autoUpload) { %}
29 <button class="btn btn-success">
30 <i class="icon-upload icon-white"></i>
31 <span>{%=locale.fileupload.start%}</span>
37 <td class="cancel">{% if (!i) { %}
38 <button class="btn btn-warning">
39 <i class="icon-ban-circle icon-white"></i>
40 <span>{%=locale.fileupload.cancel%}</span>
46 <!-- The template to display files available for download -->
47 <script id="template-download" type="text/x-tmpl">
48 {% for (var i=0, file; file=o.files[i]; i++) { %}
49 <tr class="template-download fade">
50 {% if (file.error) { %}
52 <td class="name"><span>{%=file.name%}</span></td>
53 <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
54 <td class="error" colspan="2">
55 <span class="label label-important">{%=locale.fileupload.error%}</span>
56 {%=locale.fileupload.errors[file.error] || file.error%}
59 <td class="preview">{% if (file.thumbnail_url) { %}
60 <a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}">
61 <img src="{%=file.thumbnail_url%}">
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">