FIX tmpl.js requirement

This commit is contained in:
colymba 2013-06-23 16:22:25 +03:00
parent cc418a2947
commit 7972cef1f1
2 changed files with 54 additions and 60 deletions

View File

@ -275,23 +275,21 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
Requirements::javascript(FRAMEWORK_DIR . '/javascript/AssetUploadField.js'); Requirements::javascript(FRAMEWORK_DIR . '/javascript/AssetUploadField.js');
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css'); 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');
$form = $this->uploadForm(); $form = $this->uploadForm();
$form->setTemplate('LeftAndMain_EditForm'); $form->setTemplate('LeftAndMain_EditForm');
$form->addExtraClass('cms-content center LeftAndMain'); //not using cms-edit-form to avoid btn being hooked with default handlers $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'); $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()) if($request->isAjax())
{ {
$response = new SS_HTTPResponse( $response = new SS_HTTPResponse(
Convert::raw2json( Convert::raw2json(array( 'Content' => $form->forAjaxTemplate()->getValue() ))
array(
'Content' => $form->forTemplate()->getValue()//$form->forAjaxTemplate()->getValue()
)
)
); );
$response->addHeader('X-Pjax', 'Content'); $response->addHeader('X-Pjax', 'Content');
$response->addHeader('Content-Type', 'text/json'); $response->addHeader('Content-Type', 'text/json');
@ -300,9 +298,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
} }
else { else {
$controller = $this->getToplevelController(); $controller = $this->getToplevelController();
return $controller->customise(array( return $controller->customise(array( 'Content' => $form ));
'Content' => $form
));
} }
} }

View File

@ -1,5 +1,4 @@
jQuery(document).ready(function(){ window.tmpl.cache['colymba-gfbiu-uploadfield-downloadtemplate'] = tmpl(
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]) { %}' + '{% 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%}">' + '<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>' + '<div class="ss-uploadfield-item-preview preview"><span>' +
@ -44,6 +43,5 @@ jQuery(document).ready(function(){
'{% } %}' + '{% } %}' +
'</li>' + '</li>' +
'{% } %}' '{% } %}'
); );
});
//'<div class="ss-uploadfield-item-editform loading"><iframe frameborder="0" src="{%=file.edit_url%}"></iframe></div>' + //'<div class="ss-uploadfield-item-editform loading"><iframe frameborder="0" src="{%=file.edit_url%}"></iframe></div>' +