mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
FIX tmpl.js requirement
This commit is contained in:
parent
cc418a2947
commit
7972cef1f1
@ -273,25 +273,23 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
||||
public function index($request)
|
||||
{
|
||||
Requirements::javascript(FRAMEWORK_DIR . '/javascript/AssetUploadField.js');
|
||||
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
|
||||
|
||||
Requirements::javascript(BULK_EDIT_TOOLS_PATH . '/javascript/GridFieldBulkImageUpload.js');
|
||||
Requirements::css(BULK_EDIT_TOOLS_PATH . '/css/GridFieldBulkImageUpload.css');
|
||||
Requirements::javascript(BULK_EDIT_TOOLS_PATH . '/javascript/GridFieldBulkImageUpload_downloadtemplate.js');
|
||||
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
|
||||
|
||||
$form = $this->uploadForm();
|
||||
$form->setTemplate('LeftAndMain_EditForm');
|
||||
$form->addExtraClass('cms-content center LeftAndMain'); //not using cms-edit-form to avoid btn being hooked with default handlers
|
||||
$form->setAttribute('data-pjax-fragment', 'Content');
|
||||
|
||||
Requirements::javascript(THIRDPARTY_DIR . '/javascript-templates/tmpl.js');
|
||||
|
||||
Requirements::javascript(BULK_EDIT_TOOLS_PATH . '/javascript/GridFieldBulkImageUpload.js');
|
||||
Requirements::css(BULK_EDIT_TOOLS_PATH . '/css/GridFieldBulkImageUpload.css');
|
||||
Requirements::javascript(BULK_EDIT_TOOLS_PATH . '/javascript/GridFieldBulkImageUpload_downloadtemplate.js');
|
||||
|
||||
if($request->isAjax())
|
||||
{
|
||||
$response = new SS_HTTPResponse(
|
||||
Convert::raw2json(
|
||||
array(
|
||||
'Content' => $form->forTemplate()->getValue()//$form->forAjaxTemplate()->getValue()
|
||||
)
|
||||
)
|
||||
Convert::raw2json(array( 'Content' => $form->forAjaxTemplate()->getValue() ))
|
||||
);
|
||||
$response->addHeader('X-Pjax', 'Content');
|
||||
$response->addHeader('Content-Type', 'text/json');
|
||||
@ -300,9 +298,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
||||
}
|
||||
else {
|
||||
$controller = $this->getToplevelController();
|
||||
return $controller->customise(array(
|
||||
'Content' => $form
|
||||
));
|
||||
return $controller->customise(array( 'Content' => $form ));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,49 +1,47 @@
|
||||
jQuery(document).ready(function(){
|
||||
window.tmpl.cache['colymba-gfbiu-uploadfield-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">' +
|
||||
'{% if (!file.error) { %}' +
|
||||
'<input type="hidden" name="{%=file.fieldname%}[Files][]" value="{%=file.id%}" />' +
|
||||
'{% } %}' +
|
||||
'<label class="ss-uploadfield-item-name">' +
|
||||
'<span class="name" title="{%=file.name%}">{%=file.name%}</span> ' +
|
||||
'<span class="size">{%=o.formatFileSize(file.size)%}</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 delete"><button class="icon icon-16" data-icon="delete" title="' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '">' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '</button></div>' +
|
||||
'</div>' +
|
||||
'{% } else { %}' +
|
||||
//'<div class="ss-uploadfield-item-actions">{% print(file.buttons, true); %}</div>' +
|
||||
'{% } %}' +
|
||||
'</div>' +
|
||||
'{% if (!file.error) { %}' +
|
||||
|
||||
'<div class="ss-uploadfield-item-editform">'+
|
||||
'<form action="" method="post" class="bulkImageUploadUpdateForm" name="BIUUF_{%=file.record.ID%}">'+
|
||||
'<input type="hidden" name="record_{%=file.record.ID%}_ID" value="{%=file.record.ID%}"/>'+
|
||||
'<img class="imgPreview" src="{%=file.preview_url%}" />'+
|
||||
|
||||
'{% for (var key in file.record.fields) { %}' +
|
||||
'{%#file.record.fields[key]%}' +
|
||||
'{% } %}' +
|
||||
|
||||
'</form>'+
|
||||
'</div>' +
|
||||
|
||||
window.tmpl.cache['colymba-gfbiu-uploadfield-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">' +
|
||||
'{% if (!file.error) { %}' +
|
||||
'<input type="hidden" name="{%=file.fieldname%}[Files][]" value="{%=file.id%}" />' +
|
||||
'{% } %}' +
|
||||
'</li>' +
|
||||
'{% } %}'
|
||||
);
|
||||
});
|
||||
'<label class="ss-uploadfield-item-name">' +
|
||||
'<span class="name" title="{%=file.name%}">{%=file.name%}</span> ' +
|
||||
'<span class="size">{%=o.formatFileSize(file.size)%}</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 delete"><button class="icon icon-16" data-icon="delete" title="' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '">' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '</button></div>' +
|
||||
'</div>' +
|
||||
'{% } else { %}' +
|
||||
//'<div class="ss-uploadfield-item-actions">{% print(file.buttons, true); %}</div>' +
|
||||
'{% } %}' +
|
||||
'</div>' +
|
||||
'{% if (!file.error) { %}' +
|
||||
|
||||
'<div class="ss-uploadfield-item-editform">'+
|
||||
'<form action="" method="post" class="bulkImageUploadUpdateForm" name="BIUUF_{%=file.record.ID%}">'+
|
||||
'<input type="hidden" name="record_{%=file.record.ID%}_ID" value="{%=file.record.ID%}"/>'+
|
||||
'<img class="imgPreview" src="{%=file.preview_url%}" />'+
|
||||
|
||||
'{% for (var key in file.record.fields) { %}' +
|
||||
'{%#file.record.fields[key]%}' +
|
||||
'{% } %}' +
|
||||
|
||||
'</form>'+
|
||||
'</div>' +
|
||||
|
||||
'{% } %}' +
|
||||
'</li>' +
|
||||
'{% } %}'
|
||||
);
|
||||
//'<div class="ss-uploadfield-item-editform loading"><iframe frameborder="0" src="{%=file.edit_url%}"></iframe></div>' +
|
||||
|
Loading…
Reference in New Issue
Block a user