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