silverstripe-dms/javascript/DMSUploadField_downloadtemplate.js
Ingo Schommer 597e393630 BUG DMSUploadField JS template usage
Instead of relying on JavaScript requirements blocking,
configure a more specific template name to use
in certain situations. We can't control JS files
loaded by the browser already by previous requests,
so Requirements blocking does not override the
template in all cases, creating execution-path specific
edge cases (like showing "save to refresh" messages
in the background of a "add document" upload success)
2013-01-07 10:11:55 +13:00

27 lines
1.5 KiB
JavaScript

window.tmpl.cache['ss-dmsuploadfield-downloadtemplate'] = tmpl(
'{% for (var i=0, files=o.files, l=files.length, file=files[0]; i<l; file=files[++i]) { %}' +
'<li class="ss-uploadfield-item template-download{% if (file.error) { %} ui-state-error{% } %}" data-fileid="{%=file.id%}">' +
'<div class="ss-uploadfield-item-preview preview"><span>' +
'<img src="{%=file.thumbnail_url%}" alt="" />' +
'</span></div>' +
'<div class="ss-uploadfield-item-info">' +
'<label class="ss-uploadfield-item-name">' +
'<span class="name" title="{%=file.name%}">{%=file.name%}</span> ' +
'{% if (!file.error) { %}' +
'<div class="ss-uploadfield-item-status ui-state-success-text" title="'+ss.i18n._t('UploadField.Uploaded', 'Uploaded')+'">'+ss.i18n._t('UploadField.Uploaded', 'Uploaded')+'</div>' +
'{% } else { %}' +
'<div class="ss-uploadfield-item-status ui-state-error-text" title="{%=o.options.errorMessages[file.error] || file.error%}">{%=o.options.errorMessages[file.error] || file.error%}</div>' +
'{% } %}' +
'<div class="clear"><!-- --></div>' +
'</label>' +
'{% if (file.error) { %}' +
'<div class="ss-uploadfield-item-actions">' +
'<div class="ss-uploadfield-item-cancel ss-uploadfield-item-cancelfailed"><button class="icon icon-16">' + ss.i18n._t('UploadField.CANCEL', 'Cancel') + '</button></div>' +
'</div>' +
'{% } else { %}' +
'<div class="ss-uploadfield-item-actions">(please click save and the page will update)</div>' +
'{% } %}' +
'</div>' +
'</li>' +
'{% } %}'
);