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