diff --git a/library/Businessprocess/Web/Component/RenderedProcessActionBar.php b/library/Businessprocess/Web/Component/RenderedProcessActionBar.php index 939ce98..8de8ac0 100644 --- a/library/Businessprocess/Web/Component/RenderedProcessActionBar.php +++ b/library/Businessprocess/Web/Component/RenderedProcessActionBar.php @@ -15,27 +15,34 @@ class RenderedProcessActionBar extends ActionBar { $meta = $config->getMetadata(); - $toggle = Html::tag('div', ['class' => 'view-toggle']); - $toggle->add(Html::tag('span', null, mt('businessprocess', 'View'))); - $toggle->add(Html::tag( - 'a', - [ - 'href' => $url->with('mode', 'tile'), - 'title' => mt('businessprocess', 'Switch to Tile view'), - 'class' => $renderer instanceof TreeRenderer ? '' : 'active' - ], - Html::tag('i', ['class' => 'icon icon-dashboard']) - )); - $toggle->add(Html::tag( - 'a', - [ - 'href' => $url->with('mode', 'tree'), - 'title' => mt('businessprocess', 'Switch to Tree view'), - 'class' => $renderer instanceof TreeRenderer ? 'active' : '' - ], - Html::tag('i', ['class' => 'icon icon-sitemap']) - )); - $this->add($toggle); + if ($renderer instanceof TreeRenderer) { + $link = Html::tag( + 'a', + [ + 'href' => $url->with('mode', 'tile'), + 'title' => mt('businessprocess', 'Switch to Tile view') + ] + ); + } else { + $link = Html::tag( + 'a', + [ + 'href' => $url->with('mode', 'tree'), + 'title' => mt('businessprocess', 'Switch to Tree view') + ] + ); + } + + $link->add([ + Html::tag('i', ['class' => 'icon icon-dashboard' . ($renderer instanceof TreeRenderer ? '' : ' active')]), + Html::tag('i', ['class' => 'icon icon-sitemap' . ($renderer instanceof TreeRenderer ? ' active' : '')]) + ]); + + $this->add( + Html::tag('div', ['class' => 'view-toggle']) + ->add(Html::tag('span', null, mt('businessprocess', 'View'))) + ->add($link) + ); $this->add(Html::tag( 'a', diff --git a/public/css/module.less b/public/css/module.less index 0a4ffaa..ff2bf09 100644 --- a/public/css/module.less +++ b/public/css/module.less @@ -44,27 +44,29 @@ a:focus { } a { - padding: .25em .5em; - border: 1px solid @icinga-blue; + display: inline-block; - i::before { - margin-right: 0; - } + i { + padding: .25em .5em; + border: 1px solid @icinga-blue; - &.active { - color: white; - background-color: @icinga-blue; - } + &:before { + margin-right: 0; + } - &:first-of-type { - border-right-width: 0; - border-top-left-radius: .25em; - border-bottom-left-radius: .25em; - } - &:last-of-type { - border-left-width: 0; - border-top-right-radius: .25em; - border-bottom-right-radius: .25em; + &.active { + color: white; + background-color: @icinga-blue; + } + + &:first-of-type { + border-top-left-radius: .25em; + border-bottom-left-radius: .25em; + } + &:last-of-type { + border-top-right-radius: .25em; + border-bottom-right-radius: .25em; + } } } }