From 93bb9b69f358e48362c8123d758a9c6f659db85c Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 26 Jul 2022 12:42:16 +0200 Subject: [PATCH] RoleForm: Use the `
` tag (cherry picked from commit 5059a782a879ba27635581b2a50c0d55f594f5ee) --- application/forms/Security/RoleForm.php | 16 ++++--- public/css/icinga/widgets.less | 59 ++++++++++--------------- 2 files changed, 33 insertions(+), 42 deletions(-) diff --git a/application/forms/Security/RoleForm.php b/application/forms/Security/RoleForm.php index d0a1fd1d5..cc8b78c4a 100644 --- a/application/forms/Security/RoleForm.php +++ b/application/forms/Security/RoleForm.php @@ -272,7 +272,7 @@ class RoleForm extends RepositoryForm $moduleName . '_header', [ 'decorators' => ['ViewHelper'], - 'value' => '

' + 'value' => '' . '' . ($moduleName !== 'application' ? sprintf('%s %s', $moduleName, $this->translate('Module')) : 'Icinga Web 2' @@ -285,18 +285,20 @@ class RoleForm extends RepositoryForm : '' ) . '' - . '

' + . new Icon('angles-down', ['class' => 'collapse-icon']) + . new Icon('angles-left', ['class' => 'expand-icon']) + . '' ] ); $this->addDisplayGroup($elements, $moduleName . '_elements', [ 'decorators' => [ 'FormElements', - ['Fieldset', [ - 'class' => 'collapsible', - 'data-toggle-element' => 'h3', - 'data-visible-height' => 0 - ]] + ['HtmlTag', [ + 'tag' => 'details', + 'class' => 'collapsible' + ]], + ['Fieldset'] ] ]); } diff --git a/public/css/icinga/widgets.less b/public/css/icinga/widgets.less index 949a6bc03..654e7d5b1 100644 --- a/public/css/icinga/widgets.less +++ b/public/css/icinga/widgets.less @@ -255,10 +255,30 @@ form.role-form { display: inline-block; } - h3 { + summary { + border-bottom: 1px solid @gray-light; + .user-select(none); + cursor: pointer; + + font-weight: @font-weight-bold; + margin: 0.556em 0 0.333em; + font-size: 1.167em; + + display: flex; + align-items: baseline; + .privilege-preview { + flex: 1 1 auto; + } + > :first-child { display: inline-block; - width: 20em / 1.167em; // element label width / h3 font-size + width: 20em / 1.167em; // element label width / summary font-size + } + + > :nth-last-child(1), + > :nth-last-child(2) { + font-size: .75em; + opacity: .6; } .privilege-preview .icon { @@ -276,12 +296,8 @@ form.role-form { } } - fieldset.collapsible { - border: none; - padding: 0; - margin: 0; - - h3 em { + .collapsible { + summary em { font-size: .857em; font-weight: normal; color: @text-color-light; @@ -309,33 +325,6 @@ form.role-form { } } } - - .collapsible-control { - border-bottom: 1px solid @gray-light; - cursor: pointer; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } - - .collapsible-control:after { - content: "\f103"; - display: inline-block; - font-family: 'ifont'; - font-weight: normal; - padding: 0 .25em; - margin-right: .25em; - width: 1em; - opacity: .6; - float: right; - } - - &.collapsed .collapsible-control:after { - content: "\e87a"; - } } }