From a2d5e37714dc2abea5272ab4c2d4b86cce219ad5 Mon Sep 17 00:00:00 2001 From: Benjamin Dalsass Date: Tue, 11 Apr 2023 09:59:26 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B05957=20-=20actions=20rows=20order=20and?= =?UTF-8?q?=20color?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataTable/DataTableUIBlockFactory.php | 3 +++ .../Direct/BlockDirectLinkSetViewTable.php | 19 ++++++++++--------- .../BlockIndirectLinkSetViewTable.php | 14 +++++++------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/sources/Application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php b/sources/Application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php index acd203966..453469e25 100644 --- a/sources/Application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php +++ b/sources/Application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php @@ -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); } diff --git a/sources/Application/UI/Links/Direct/BlockDirectLinkSetViewTable.php b/sources/Application/UI/Links/Direct/BlockDirectLinkSetViewTable.php index 138a2b08e..2844e4659 100644 --- a/sources/Application/UI/Links/Direct/BlockDirectLinkSetViewTable.php +++ b/sources/Application/UI/Links/Direct/BlockDirectLinkSetViewTable.php @@ -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: diff --git a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetViewTable.php b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetViewTable.php index 19e315ce3..595c1e1e0 100644 --- a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetViewTable.php +++ b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetViewTable.php @@ -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; }