MINOR Backlink for "Add files" UI

This commit is contained in:
Ingo Schommer 2012-02-21 21:17:56 +01:00
parent eb63384900
commit 5a6ed1a603

View File

@ -24,13 +24,15 @@ class CMSFileAddController extends AssetAdmin {
Requirements::javascript(SAPPHIRE_DIR . '/javascript/AssetUploadField.js');
Requirements::css(SAPPHIRE_DIR . '/css/AssetUploadField.css');
$folder = $this->currentPage();
$uploadField = Object::create('UploadField', 'AssetUploadField', '');
$uploadField->setConfig('previewMaxWidth', 40);
$uploadField->setConfig('previewMaxHeight', 30);
$uploadField->addExtraClass('ss-assetuploadfield');
$uploadField->removeExtraClass('ss-uploadfield');
$uploadField->setTemplate('AssetUploadField');
if ($this->currentPage()->exists() && $this->currentPage()->getFilename()) {
if ($folder->exists() && $folder->getFilename()) {
$uploadField->setFolderName($this->currentPage()->getFilename());
}
@ -38,6 +40,17 @@ class CMSFileAddController extends AssetAdmin {
$form->addExtraClass('center cms-edit-form ' . $this->BaseCSSClasses());
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$form->Fields()->push(
new LiteralField(
'BackLink',
sprintf(
'<a href="%s" class="backlink ss-ui-button cms-panel-link" data-icon="back">%s</a>',
Controller::join_links(singleton('AssetAdmin')->Link('show'), $folder ? $folder->ID : 0),
_t('AssetAdmin.BackToFolder', 'Back to folder')
)
)
);
return $form;
}