mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Various fixes to get TableListField and ComplexTableField baseline operational (although usage of GridField is encouraged)
This commit is contained in:
parent
95f1800d80
commit
b246522c24
@ -418,7 +418,7 @@ JS;
|
||||
|
||||
function add() {
|
||||
if(!$this->can('add')) return;
|
||||
|
||||
|
||||
return $this->customise(array(
|
||||
'DetailForm' => $this->AddForm(),
|
||||
))->renderWith($this->templatePopup);
|
||||
@ -472,7 +472,7 @@ JS;
|
||||
$childData->write();
|
||||
} catch(ValidationException $e) {
|
||||
$form->sessionMessage($e->getResult()->message(), 'bad');
|
||||
return Director::redirectBack();
|
||||
return Controller::curr()->redirectBack();
|
||||
}
|
||||
|
||||
// Save this item into the given relationship
|
||||
@ -497,7 +497,7 @@ JS;
|
||||
|
||||
$form->sessionMessage($message, 'good');
|
||||
|
||||
$this->controller->redirectBack();
|
||||
return Controller::curr()->redirectBack();
|
||||
}
|
||||
}
|
||||
|
||||
@ -644,7 +644,7 @@ class ComplexTableField_ItemRequest extends TableListField_ItemRequest {
|
||||
$dataObject->write();
|
||||
} catch(ValidationException $e) {
|
||||
$form->sessionMessage($e->getResult()->message(), 'bad');
|
||||
return Director::redirectBack();
|
||||
return Controller::curr()->redirectBack();
|
||||
}
|
||||
|
||||
// Save this item into the given relationship
|
||||
@ -666,7 +666,7 @@ class ComplexTableField_ItemRequest extends TableListField_ItemRequest {
|
||||
|
||||
$form->sessionMessage($message, 'good');
|
||||
|
||||
Director::redirectBack();
|
||||
return Controller::curr()->redirectBack();
|
||||
}
|
||||
|
||||
function PopupCurrentItem() {
|
||||
@ -815,18 +815,18 @@ class ComplexTableField_Popup extends Form {
|
||||
function __construct($controller, $name, $fields, $validator, $readonly, $dataObject) {
|
||||
$this->dataObject = $dataObject;
|
||||
|
||||
Requirements::clear();
|
||||
Requirements::unblock_all();
|
||||
|
||||
$actions = new FieldList();
|
||||
if(!$readonly) {
|
||||
$actions->push(
|
||||
$saveAction = new FormAction(
|
||||
Object::create('FormAction',
|
||||
"saveComplexTableField",
|
||||
_t('CMSMain.SAVE', 'Save')
|
||||
)
|
||||
);
|
||||
$saveAction->addExtraClass('save');
|
||||
->addExtraClass('save ss-ui-action-constructive')
|
||||
->setUseButtonTag(true)
|
||||
->setAttribute('data-icon', 'accept')
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($controller, $name, $fields, $actions, $validator);
|
||||
@ -837,14 +837,7 @@ class ComplexTableField_Popup extends Form {
|
||||
function forTemplate() {
|
||||
$ret = parent::forTemplate();
|
||||
|
||||
/**
|
||||
* WARNING: DO NOT CHANGE THE ORDER OF THESE JS FILES
|
||||
* Some have special requirements.
|
||||
*/
|
||||
Requirements::css(SAPPHIRE_DIR . '/css/Form.css');
|
||||
Requirements::css(SAPPHIRE_DIR . '/css/ComplexTableField_popup.css');
|
||||
Requirements::css(CMS_DIR . '/css/typography.css');
|
||||
Requirements::css(CMS_DIR . '/css/cms_right.css');
|
||||
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js");
|
||||
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
|
||||
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/scriptaculous/scriptaculous.js");
|
||||
@ -860,15 +853,13 @@ class ComplexTableField_Popup extends Form {
|
||||
$callback = $parent->getParentController()->requirementsForPopupCallback;
|
||||
}
|
||||
if($callback) call_user_func($callback, $this);
|
||||
|
||||
// Append requirements from DataObject
|
||||
// DEPRECATED 2.4 Use ComplexTableField->requirementsForPopupCallback
|
||||
if($this->dataObject->hasMethod('getRequirementsForPopup')) {
|
||||
$this->dataObject->getRequirementsForPopup();
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function getTemplate() {
|
||||
return 'Form';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ComplexTableField_ItemRequest
|
||||
|
@ -102,15 +102,12 @@ TableListField.prototype = {
|
||||
'method': 'post',
|
||||
'data': {forceajax: 1, SecurityID: jQuery('input[name=SecurityID]').val()},
|
||||
'success': function(){
|
||||
jQuery(row).fadeOut('fast', function() {
|
||||
// remove row from DOM
|
||||
this.element.parentNode.removeChild(obj.element);
|
||||
// recalculate summary if needed (assumes that TableListField.js is present)
|
||||
// TODO Proper inheritance
|
||||
if(self._summarise) self._summarise();
|
||||
// custom callback
|
||||
if(self.callback_deleteRecord) self.callback_deleteRecord(e);
|
||||
});
|
||||
jQuery(row).remove();
|
||||
// recalculate summary if needed (assumes that TableListField.js is present)
|
||||
// TODO Proper inheritance
|
||||
if(self._summarise) self._summarise();
|
||||
// custom callback
|
||||
if(self.callback_deleteRecord) self.callback_deleteRecord(e);
|
||||
},
|
||||
'error': this.ajaxErrorHandler
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div id="$id" class="$CSSClasses $extraClass field" href="$CurrentLink">
|
||||
<div id="$id" class="$CSSClasses $extraClass field nolabel" href="$CurrentLink">
|
||||
<div class="middleColumn">
|
||||
<% if Markable %>
|
||||
<% include TableListField_SelectOptions %>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<% base_tag %>
|
||||
</head>
|
||||
<body>
|
||||
<body class="cms" style="overflow: auto;">
|
||||
<div class="right $PopupClasses">
|
||||
$DetailForm
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div id="$id" class="$CSSClasses $extraClass field">
|
||||
<div id="$id" class="$CSSClasses $extraClass field nolabel">
|
||||
<% if Print %><% else %>
|
||||
<% if Markable %>
|
||||
<% include TableListField_SelectOptions %>
|
||||
|
Loading…
Reference in New Issue
Block a user