X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FLayout%2FActionBar%2FAction.pm;h=90eb8498ca002d589825735c1057cb0d1db8be81;hb=d74539c522ca0d5582f309653690755c0aeab475;hp=bed33fe1c2e823afc56638beb6843387c948158b;hpb=ff424b75f8f66c796eae294d0239f0440741e578;p=kivitendo-erp.git diff --git a/SL/Layout/ActionBar/Action.pm b/SL/Layout/ActionBar/Action.pm index bed33fe1c..90eb8498c 100644 --- a/SL/Layout/ActionBar/Action.pm +++ b/SL/Layout/ActionBar/Action.pm @@ -4,7 +4,6 @@ use strict; use parent qw(Rose::Object); use SL::Presenter; - require SL::Layout::ActionBar::Submit; use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(id params text) ], @@ -24,10 +23,16 @@ sub script { sub from_params { my ($class, $data) = @_; + require SL::Layout::ActionBar::Submit; + my ($text, %params) = @$data; + return if exists($params{only_if}) && !$params{only_if}; + return if exists($params{not_if}) && $params{not_if}; return SL::Layout::ActionBar::Submit->new(text => $text, params => \%params); } +sub callable { 0 } + # shortcut for presenter sub p { @@ -44,29 +49,174 @@ sub init_id { $_[0]->p->name_to_id('action[]') } - 1; __END__ -=head 1 +=encoding utf-8 + +=head1 NAME + +SL::Layout::ActionBar::Action - base class for action bar actions + +=head1 DESCRIPTION + +This base class for actions can be used to implement elements that can be +added to L. + +Elements can be interactive or simply used for layout. Most of the actual +semantics are handled in the corresponding javascript C, so +this is only used to generate the DOM elements and to provide information for +request time logic decisions. + + +=head1 SYNOPSIS + + # implement: + package SL::Layout::ActionBar::Custom; + use parent qw(SL::Layout::ActionBar::Action); + + # unsugared use + SL::Layout::ActionBar::Custom->new( + text => t8('Description'), + params => { + key => $attr, + key => $attr, + ... + }, + ); + + # parse sugared version: + SL::Layout::ActionBar::Custom->from_params( + t8('Description'), + key => $attr, + key => $attr, + ... + ); + +=head1 INTERFACE + +=over 4 + +=item * C + +Needs to be implemented. Should render only the bare minimum necessary to +identify the element at run time. + +=item * C