mirror of
https://github.com/Combodo/iTop.git
synced 2026-08-30 01:48:19 +02:00
Add data-* to property fields
This commit is contained in:
@@ -220,10 +220,16 @@ class DesignerForm
|
||||
$sValidationFields = '</td><td class="prop_icon prop_apply ibo-prop--apply" >'.$sValidation.'</td><td class="prop_icon prop_cancel ibo-prop--cancel"><span><div class="ibo-button ibo-is-alternative ibo-is-neutral" data-tooltip-content="'.Dict::Format('UI:DashboardEdit:Revert').'"><i class="fas fa-undo"></i></div></span></td>'
|
||||
.$this->EndRow();
|
||||
|
||||
$aPropertyFieldData = [
|
||||
'code' => $oField->GetCode(),
|
||||
'type' => $oField->GetInputType(),
|
||||
'label' => $aRow['label'],
|
||||
'raw-value' => $oField->GetRawValue(),
|
||||
];
|
||||
if (is_null($aRow['label'])) {
|
||||
$sReturn .= $this->StartRow($sFieldId).'<td class="prop_value" colspan="2">'.$aRow['value'];
|
||||
$sReturn .= $this->StartRow($sFieldId, $aPropertyFieldData).'<td class="prop_value" colspan="2">'.$aRow['value'];
|
||||
} else {
|
||||
$sReturn .= $this->StartRow($sFieldId).'<td class="prop_label">'.$aRow['label'].'</td><td class="prop_value">'.$aRow['value'];
|
||||
$sReturn .= $this->StartRow($sFieldId, $aPropertyFieldData).'<td class="prop_label">'.$aRow['label'].'</td><td class="prop_value">'.$aRow['value'];
|
||||
}
|
||||
if (!($oField instanceof DesignerFormSelectorField) && !($oField instanceof DesignerMultipleSubFormField)) {
|
||||
$sReturn .= $sValidationFields;
|
||||
@@ -294,12 +300,21 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
public function StartRow($sFieldId = null)
|
||||
public function StartRow($sFieldId = null, $aPropertyFieldData = [])
|
||||
{
|
||||
if ($sFieldId != null) {
|
||||
return '<tr id="row_'.$sFieldId.'" data-path="'.$this->GetHierarchyPath().'" data-selector="'.$this->GetHierarchyParent().'">';
|
||||
$sPropertyFieldAttributes = '';
|
||||
foreach ($aPropertyFieldData as $sAttribute => $value) {
|
||||
if (is_array($value)) {
|
||||
$value = json_encode($value);
|
||||
} elseif (is_null($value)) {
|
||||
$value = '';
|
||||
}
|
||||
$sPropertyFieldAttributes .= ' data-property-field-'.$sAttribute.'="'.utils::EscapeHtml((string)$value).'"';
|
||||
}
|
||||
return '<tr data-path="'.$this->GetHierarchyPath().'" data-selector="'.$this->GetHierarchyParent().'">';
|
||||
if ($sFieldId != null) {
|
||||
return '<tr id="row_'.$sFieldId.'" data-path="'.$this->GetHierarchyPath().'" data-selector="'.$this->GetHierarchyParent().'"'.$sPropertyFieldAttributes.'>';
|
||||
}
|
||||
return '<tr data-path="'.$this->GetHierarchyPath().'" data-selector="'.$this->GetHierarchyParent().'"'.$sPropertyFieldAttributes.'>';
|
||||
}
|
||||
|
||||
public function EndRow()
|
||||
@@ -679,6 +694,14 @@ class DesignerFormField
|
||||
return $this->sCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function GetRawValue()
|
||||
{
|
||||
return $this->defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DesignerForm $oForm
|
||||
*/
|
||||
@@ -1629,6 +1652,11 @@ class DesignerFormSelectorField extends DesignerFormField
|
||||
return 'selector_property_field';
|
||||
}
|
||||
|
||||
public function GetRawValue()
|
||||
{
|
||||
return $this->defaultRealValue;
|
||||
}
|
||||
|
||||
public function AddSubForm($oSubForm, $sLabel, $sValue)
|
||||
{
|
||||
$this->aSubForms[] = ['form' => $oSubForm, 'label' => $sLabel, 'value' => $sValue];
|
||||
|
||||
@@ -27,6 +27,7 @@ $(function()
|
||||
|
||||
this.element
|
||||
.addClass( "itop-property-field ibo-field" )
|
||||
.attr('data-role', 'ibo-property-field')
|
||||
.on('apply_changes.itop-property-field', function(){me._do_apply();} );
|
||||
|
||||
this.bModified = false;
|
||||
|
||||
Reference in New Issue
Block a user