From c37fb9ef8fda87c074eb7585c458f1400d326af0 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 10 Nov 2016 13:19:31 +0100 Subject: [PATCH] =?utf8?q?ActionBar:=20neuer=20Typ=20f=C3=BCr=20einfachen?= =?utf8?q?=20Link=20in=20Hauptzeile=20(nicht=20in=20Combo)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Layout/ActionBar.pm | 2 ++ SL/Layout/ActionBar/Link.pm | 24 ++++++++++++++++++++++++ css/common.css | 6 ++++++ 3 files changed, 32 insertions(+) create mode 100644 SL/Layout/ActionBar/Link.pm diff --git a/SL/Layout/ActionBar.pm b/SL/Layout/ActionBar.pm index a28e1a9fb..b0835c339 100644 --- a/SL/Layout/ActionBar.pm +++ b/SL/Layout/ActionBar.pm @@ -7,6 +7,7 @@ use Carp; use Scalar::Util qw(blessed); use SL::Layout::ActionBar::Action; use SL::Layout::ActionBar::ComboBox; +use SL::Layout::ActionBar::Link; use SL::Layout::ActionBar::Separator; use constant HTML_CLASS => 'layout-actionbar'; @@ -18,6 +19,7 @@ use Rose::Object::MakeMethods::Generic ( my %class_descriptors = ( action => { class => 'SL::Layout::ActionBar::Action', num_params => 1, }, combobox => { class => 'SL::Layout::ActionBar::ComboBox', num_params => 1, }, + link => { class => 'SL::Layout::ActionBar::Link', num_params => 1, }, separator => { class => 'SL::Layout::ActionBar::Separator', num_params => 0, }, ); diff --git a/SL/Layout/ActionBar/Link.pm b/SL/Layout/ActionBar/Link.pm new file mode 100644 index 000000000..49243dec9 --- /dev/null +++ b/SL/Layout/ActionBar/Link.pm @@ -0,0 +1,24 @@ +package SL::Layout::ActionBar::Link; + +use strict; +use parent qw(SL::Layout::ActionBar::Action); + +sub from_params { + my ($class, $data) = @_; + + my ($text, %params) = @$data; + return SL::Layout::ActionBar::Link->new(text => $text, params => \%params); +} + +sub render { + my ($self) = @_; + + return $self->p->html_tag( + 'a', $self->text, + %{ $self->params // {} }, + id => $self->id, + class => 'layout-actionbar-link', + ); +} + +1; diff --git a/css/common.css b/css/common.css index 29d7f6c22..1f1dfcbe0 100644 --- a/css/common.css +++ b/css/common.css @@ -129,6 +129,12 @@ div.layout-actionbar div.layout-actionbar-scriptbutton:hover { border-style: solid; } +div.layout-actionbar .layout-actionbar-link { + margin-left: 6px; + margin-right: 6px; + cursor: default; +} + div.layout-actionbar-combobox { position: relative; display: inline-block; -- 2.20.1