From d91795d815d055b7c41c2efe28c5c26808e03843 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 29 Apr 2022 15:56:06 +0200 Subject: [PATCH] dashboards/settings: Don't disguise action links as button links --- application/controllers/DashboardsController.php | 12 ++++++------ .../Icinga/Web/Dashboard/Common/ItemListControl.php | 4 ++-- .../Web/Dashboard/ItemList/DashboardHomeList.php | 9 +++++++-- .../Icinga/Web/Dashboard/ItemList/DashboardList.php | 9 +++++++-- .../Web/Dashboard/ItemList/DashletListItem.php | 3 ++- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/application/controllers/DashboardsController.php b/application/controllers/DashboardsController.php index 004b07306..321d05034 100644 --- a/application/controllers/DashboardsController.php +++ b/application/controllers/DashboardsController.php @@ -20,7 +20,8 @@ use Icinga\Web\Notification; use Icinga\Web\Widget\Tabextension\DashboardSettings; use ipl\Web\Compat\CompatController; use ipl\Web\Url; -use ipl\Web\Widget\ActionLink; +use ipl\Web\Widget\Icon; +use ipl\Web\Widget\Link; class DashboardsController extends CompatController { @@ -419,19 +420,18 @@ class DashboardsController extends CompatController $this->dashboard->activate('dashboard_settings'); - $this->addControl(new ActionLink( - t('Add new Home'), + $this->addControl(new Link( + [new Icon('plus'), t('Add new Home')], Url::fromPath(Dashboard::BASE_ROUTE . '/new-home'), - 'plus', [ - 'class' => 'add-home', + 'class' => ['button-link', 'add-home'], 'data-icinga-modal' => true, 'data-no-icinga-ajax' => true ] )); $this->content->getAttributes()->add('class', 'dashboard-manager'); - $this->controls->getAttributes()->add('class', 'dashboard-manager-controls'); + $this->controls->getAttributes()->add('class', ['separated', 'dashboard-manager-controls']); $this->addContent(new Settings($this->dashboard)); } diff --git a/library/Icinga/Web/Dashboard/Common/ItemListControl.php b/library/Icinga/Web/Dashboard/Common/ItemListControl.php index 1b8571e5f..1735ea20f 100644 --- a/library/Icinga/Web/Dashboard/Common/ItemListControl.php +++ b/library/Icinga/Web/Dashboard/Common/ItemListControl.php @@ -8,8 +8,8 @@ use ipl\Html\BaseHtmlElement; use ipl\Html\HtmlElement; use ipl\Html\ValidHtml; use ipl\Web\Url; +use ipl\Web\Widget\ActionLink; use ipl\Web\Widget\Icon; -use ipl\Web\Widget\Link; abstract class ItemListControl extends BaseHtmlElement { @@ -64,7 +64,7 @@ abstract class ItemListControl extends BaseHtmlElement protected function assembleHeader(Url $url, string $title) { $header = HtmlElement::create('h1', ['class' => 'collapsible-header'], $title); - $header->addHtml(new Link(t('Edit'), $url, [ + $header->addHtml(new ActionLink(t('Edit'), $url, null, [ 'data-icinga-modal' => true, 'data-no-icinga-ajax' => true ])); diff --git a/library/Icinga/Web/Dashboard/ItemList/DashboardHomeList.php b/library/Icinga/Web/Dashboard/ItemList/DashboardHomeList.php index 35657fc15..f6ca2793b 100644 --- a/library/Icinga/Web/Dashboard/ItemList/DashboardHomeList.php +++ b/library/Icinga/Web/Dashboard/ItemList/DashboardHomeList.php @@ -10,7 +10,8 @@ use Icinga\Web\Dashboard\DashboardHome; use ipl\Html\BaseHtmlElement; use ipl\Html\HtmlElement; use ipl\Web\Url; -use ipl\Web\Widget\ActionLink; +use ipl\Web\Widget\Icon; +use ipl\Web\Widget\Link; class DashboardHomeList extends ItemListControl { @@ -63,6 +64,10 @@ class DashboardHomeList extends ItemListControl $url = Url::fromPath(Dashboard::BASE_ROUTE . '/new-pane'); $url->setParams(['home' => $this->home->getName()]); - return new ActionLink(t('Add Dashboard'), $url, 'plus', ['class' => 'add-dashboard']); + return new Link( + [new Icon('plus'), t('Add Dashboard')], + $url, + ['class' => ['button-link', 'add-dashboard']] + ); } } diff --git a/library/Icinga/Web/Dashboard/ItemList/DashboardList.php b/library/Icinga/Web/Dashboard/ItemList/DashboardList.php index f264fbe3c..74b7ebf8c 100644 --- a/library/Icinga/Web/Dashboard/ItemList/DashboardList.php +++ b/library/Icinga/Web/Dashboard/ItemList/DashboardList.php @@ -10,7 +10,8 @@ use Icinga\Web\Dashboard\Pane; use ipl\Html\BaseHtmlElement; use ipl\Html\HtmlElement; use ipl\Web\Url; -use ipl\Web\Widget\ActionLink; +use ipl\Web\Widget\Icon; +use ipl\Web\Widget\Link; class DashboardList extends ItemListControl { @@ -70,6 +71,10 @@ class DashboardList extends ItemListControl 'pane' => $this->pane->getName() ]); - return new ActionLink(t('Add Dashlet'), $url, 'plus', ['class' => 'add-dashlet']); + return new Link( + [new Icon('plus'), t('Add Dashlet')], + $url, + ['class' => ['button-link', 'add-dashlet']] + ); } } diff --git a/library/Icinga/Web/Dashboard/ItemList/DashletListItem.php b/library/Icinga/Web/Dashboard/ItemList/DashletListItem.php index c4fc2c054..dc6d69bd9 100644 --- a/library/Icinga/Web/Dashboard/ItemList/DashletListItem.php +++ b/library/Icinga/Web/Dashboard/ItemList/DashletListItem.php @@ -11,6 +11,7 @@ use ipl\Html\BaseHtmlElement; use ipl\Html\HtmlElement; use ipl\Html\ValidHtml; use ipl\Web\Url; +use ipl\Web\Widget\ActionLink; use ipl\Web\Widget\Link; class DashletListItem extends BaseHtmlElement @@ -84,7 +85,7 @@ class DashletListItem extends BaseHtmlElement 'dashlet' => $this->dashlet->getName() ]); - $header->addHtml(new Link(t('Edit'), $url, [ + $header->addHtml(new ActionLink(t('Edit'), $url, null, [ 'data-icinga-modal' => true, 'data-no-icinga-ajax' => true ]));