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() {
|
function add() {
|
||||||
if(!$this->can('add')) return;
|
if(!$this->can('add')) return;
|
||||||
|
|
||||||
return $this->customise(array(
|
return $this->customise(array(
|
||||||
'DetailForm' => $this->AddForm(),
|
'DetailForm' => $this->AddForm(),
|
||||||
))->renderWith($this->templatePopup);
|
))->renderWith($this->templatePopup);
|
||||||
|
@ -472,7 +472,7 @@ JS;
|
||||||
$childData->write();
|
$childData->write();
|
||||||
} catch(ValidationException $e) {
|
} catch(ValidationException $e) {
|
||||||
$form->sessionMessage($e->getResult()->message(), 'bad');
|
$form->sessionMessage($e->getResult()->message(), 'bad');
|
||||||
return Director::redirectBack();
|
return Controller::curr()->redirectBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save this item into the given relationship
|
// Save this item into the given relationship
|
||||||
|
@ -497,7 +497,7 @@ JS;
|
||||||
|
|
||||||
$form->sessionMessage($message, 'good');
|
$form->sessionMessage($message, 'good');
|
||||||
|
|
||||||
$this->controller->redirectBack();
|
return Controller::curr()->redirectBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,7 +644,7 @@ class ComplexTableField_ItemRequest extends TableListField_ItemRequest {
|
||||||
$dataObject->write();
|
$dataObject->write();
|
||||||
} catch(ValidationException $e) {
|
} catch(ValidationException $e) {
|
||||||
$form->sessionMessage($e->getResult()->message(), 'bad');
|
$form->sessionMessage($e->getResult()->message(), 'bad');
|
||||||
return Director::redirectBack();
|
return Controller::curr()->redirectBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save this item into the given relationship
|
// Save this item into the given relationship
|
||||||
|
@ -666,7 +666,7 @@ class ComplexTableField_ItemRequest extends TableListField_ItemRequest {
|
||||||
|
|
||||||
$form->sessionMessage($message, 'good');
|
$form->sessionMessage($message, 'good');
|
||||||
|
|
||||||
Director::redirectBack();
|
return Controller::curr()->redirectBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
function PopupCurrentItem() {
|
function PopupCurrentItem() {
|
||||||
|
@ -815,18 +815,18 @@ class ComplexTableField_Popup extends Form {
|
||||||
function __construct($controller, $name, $fields, $validator, $readonly, $dataObject) {
|
function __construct($controller, $name, $fields, $validator, $readonly, $dataObject) {
|
||||||
$this->dataObject = $dataObject;
|
$this->dataObject = $dataObject;
|
||||||
|
|
||||||
Requirements::clear();
|
|
||||||
Requirements::unblock_all();
|
|
||||||
|
|
||||||
$actions = new FieldList();
|
$actions = new FieldList();
|
||||||
if(!$readonly) {
|
if(!$readonly) {
|
||||||
$actions->push(
|
$actions->push(
|
||||||
$saveAction = new FormAction(
|
Object::create('FormAction',
|
||||||
"saveComplexTableField",
|
"saveComplexTableField",
|
||||||
_t('CMSMain.SAVE', 'Save')
|
_t('CMSMain.SAVE', 'Save')
|
||||||
)
|
)
|
||||||
);
|
->addExtraClass('save ss-ui-action-constructive')
|
||||||
$saveAction->addExtraClass('save');
|
->setUseButtonTag(true)
|
||||||
|
->setAttribute('data-icon', 'accept')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct($controller, $name, $fields, $actions, $validator);
|
parent::__construct($controller, $name, $fields, $actions, $validator);
|
||||||
|
@ -837,14 +837,7 @@ class ComplexTableField_Popup extends Form {
|
||||||
function forTemplate() {
|
function forTemplate() {
|
||||||
$ret = parent::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(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/prototype/prototype.js");
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
|
||||||
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/scriptaculous/scriptaculous.js");
|
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/scriptaculous/scriptaculous.js");
|
||||||
|
@ -860,15 +853,13 @@ class ComplexTableField_Popup extends Form {
|
||||||
$callback = $parent->getParentController()->requirementsForPopupCallback;
|
$callback = $parent->getParentController()->requirementsForPopupCallback;
|
||||||
}
|
}
|
||||||
if($callback) call_user_func($callback, $this);
|
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;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTemplate() {
|
||||||
|
return 'Form';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ComplexTableField_ItemRequest
|
* @return ComplexTableField_ItemRequest
|
||||||
|
|
|
@ -102,15 +102,12 @@ TableListField.prototype = {
|
||||||
'method': 'post',
|
'method': 'post',
|
||||||
'data': {forceajax: 1, SecurityID: jQuery('input[name=SecurityID]').val()},
|
'data': {forceajax: 1, SecurityID: jQuery('input[name=SecurityID]').val()},
|
||||||
'success': function(){
|
'success': function(){
|
||||||
jQuery(row).fadeOut('fast', function() {
|
jQuery(row).remove();
|
||||||
// remove row from DOM
|
// recalculate summary if needed (assumes that TableListField.js is present)
|
||||||
this.element.parentNode.removeChild(obj.element);
|
// TODO Proper inheritance
|
||||||
// recalculate summary if needed (assumes that TableListField.js is present)
|
if(self._summarise) self._summarise();
|
||||||
// TODO Proper inheritance
|
// custom callback
|
||||||
if(self._summarise) self._summarise();
|
if(self.callback_deleteRecord) self.callback_deleteRecord(e);
|
||||||
// custom callback
|
|
||||||
if(self.callback_deleteRecord) self.callback_deleteRecord(e);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
'error': this.ajaxErrorHandler
|
'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">
|
<div class="middleColumn">
|
||||||
<% if Markable %>
|
<% if Markable %>
|
||||||
<% include TableListField_SelectOptions %>
|
<% include TableListField_SelectOptions %>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<% base_tag %>
|
<% base_tag %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="cms" style="overflow: auto;">
|
||||||
<div class="right $PopupClasses">
|
<div class="right $PopupClasses">
|
||||||
$DetailForm
|
$DetailForm
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div id="$id" class="$CSSClasses $extraClass field">
|
<div id="$id" class="$CSSClasses $extraClass field nolabel">
|
||||||
<% if Print %><% else %>
|
<% if Print %><% else %>
|
||||||
<% if Markable %>
|
<% if Markable %>
|
||||||
<% include TableListField_SelectOptions %>
|
<% include TableListField_SelectOptions %>
|
||||||
|
|
Loading…
Reference in New Issue