X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FPresenter%2FMaterialComponents.pm;h=30123b7194cf63cbfce0302f1cadc6f481b9fdbc;hb=f3324b5ad66924333bf2a313974f6d4d21932707;hp=a4eacc8d3b69b59bc9e40e734cf4d53442a47332;hpb=291ad5ec33ddeb657c2fc7035a0177d39d73be9b;p=kivitendo-erp.git diff --git a/SL/Presenter/MaterialComponents.pm b/SL/Presenter/MaterialComponents.pm index a4eacc8d3..30123b719 100644 --- a/SL/Presenter/MaterialComponents.pm +++ b/SL/Presenter/MaterialComponents.pm @@ -12,6 +12,12 @@ use List::UtilsBy qw(partition_by); use Exporter qw(import); our @EXPORT_OK = qw( button_tag + input_tag + date_tag + submit_tag + icon + select_tag + checkbox_tag ); our %EXPORT_TAGS = (ALL => \@EXPORT_OK); @@ -206,7 +212,7 @@ sub input_tag { _set_id_attribute(\%attributes, $attributes{name}); - my $class = delete %attributes{class}; + my $class = delete $attributes{class}; my $icon = $attributes{icon} ? icon(delete $attributes{icon}, class => 'prefix') : ''; @@ -285,6 +291,22 @@ sub select_tag { ); } +sub checkbox_tag { + my ($name, %attributes) = @_; + + _set_id_attribute(\%attributes, $name); + + my $label = $attributes{label} + ? html_tag('span', delete $attributes{label}) + : ''; + + my $checkbox_html = SL::Presenter::Tag::checkbox_tag($name, %attributes); + + html_tag('label', + $checkbox_html . $label, + ); +} + 1; __END__ @@ -302,6 +324,25 @@ SL::Presenter::MaterialComponents - MaterialCSS Component wrapper =head1 DESCRIPTION +This is a collection of components in the style of L +intended for materialzecss. They should be useable similarly to their original +versions but be well-behaved for materialize. + +They will also recognize some materialize conventions: + +=over 4 + +=item icon> + +Most elements can be decorated with an icon by supplying the C with the name. + +=item grid classes + +Grid classes like C or C can be given as keys with any truish value or +directly as classes. + +=back + =head1 BUGS Nothing here yet.