FIX: delay JS remplate loading

template was still loaded before UploadField.js, now loaded on document
ready()
This commit is contained in:
colymba 2012-07-18 12:37:15 +03:00
parent a4a6a53503
commit 56a4bb4681
3 changed files with 40 additions and 36 deletions

View File

@ -213,6 +213,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
}
// add these custom requirement after the UploadField is called -> depends on tmpl.js loaded with UploadField (avoid crashing)
// seems to fix some styling issue as well?
Requirements::javascript('GridFieldBulkImageUpload/javascript/GridFieldBulkImageUpload.js');
Requirements::css('GridFieldBulkImageUpload/css/GridFieldBulkImageUpload.css');
Requirements::javascript('GridFieldBulkImageUpload/javascript/GridFieldBulkImageUpload_downloadtemplate.js');

View File

@ -105,6 +105,7 @@
});
})
//@todo Fix IE, seems to go right through the prevent default and
e.preventDefault();
}
});

View File

@ -1,4 +1,5 @@
window.tmpl.cache['GridFieldBulkImageUpload_downloadtemplate'] = tmpl(
jQuery(document).ready(function(){
window.tmpl.cache['GridFieldBulkImageUpload_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>' +
@ -35,4 +36,5 @@ window.tmpl.cache['GridFieldBulkImageUpload_downloadtemplate'] = tmpl(
'{% } %}' +
'</li>' +
'{% } %}'
);
);
});