N°5957 - actions rows order and color

This commit is contained in:
Benjamin Dalsass
2023-04-11 09:59:26 +02:00
parent adb80b8f9a
commit a2d5e37714
3 changed files with 20 additions and 16 deletions

View File

@@ -232,6 +232,9 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
array_key_exists('tooltip', $aAction) ? Dict::S($aAction['tooltip']) : '',
array_key_exists('name', $aAction) ? $aAction['name'] : 'undefined'
);
if (array_key_exists('color', $aAction)) {
$oButton->SetColor($aAction['color']);
}
$oButton->SetDataAttributes(['label' => Dict::S($aAction['label']), 'action-id' => $iKey, 'table-id' => $oTable->GetId()]);
$oToolbar->AddSubBlock($oButton);
}

View File

@@ -78,10 +78,17 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
case LINKSET_EDITMODE_INPLACE: // The whole linkset can be edited 'in-place'
case LINKSET_EDITMODE_ACTIONS: // Show the usual 'Actions' popup menu
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw']);",
);
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Delete',
'tooltip' => 'UI:Links:ActionRow:Delete+',
'icon_classes' => 'fas fa-trash',
'color' => 'danger',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement);",
'confirmation' => [
'message' => 'UI:Links:ActionRow:Delete:Confirmation',
@@ -89,15 +96,15 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
break;
case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place'
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw']);",
);
break;
case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place'
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
@@ -109,12 +116,6 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw']);",
);
break;
default:

View File

@@ -75,6 +75,13 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
{
$aRowActions = array();
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['Link/_key_/raw']);",
);
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
@@ -87,13 +94,6 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
],
);
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['Link/_key_/raw']);",
);
return $aRowActions;
}