X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/f2b76d67f773954dcfa59ff7c3ebb6f6607e2e43..3f26a3a5f90df8b834de122d6fb1dfab59a6e804:/SL/Template/Plugin/L.pm
diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm
index 6d6b59f2d..c590082cf 100644
--- a/SL/Template/Plugin/L.pm
+++ b/SL/Template/Plugin/L.pm
@@ -83,6 +83,15 @@ sub html_tag {
return "<${tag}${attributes}>${content}${tag}>";
}
+sub img_tag {
+ my ($self, @slurp) = @_;
+ my %options = _hashify(@slurp);
+
+ $options{alt} ||= '';
+
+ return $self->html_tag('img', undef, %options);
+}
+
sub select_tag {
my $self = shift;
my $name = shift;
@@ -102,6 +111,8 @@ sub select_tag {
my $title_sub = delete($attributes{title_sub});
my $default_sub = delete($attributes{default_sub});
+ my $with_empty = delete($attributes{with_empty});
+ my $empty_title = delete($attributes{empty_title});
my %selected;
@@ -119,8 +130,8 @@ sub select_tag {
my @options;
- if ( delete($attributes{with_empty}) ) {
- push(@options, [undef, $attributes{empty_title} || '']);
+ if ( $with_empty ) {
+ push(@options, [undef, $empty_title || '']);
}
my $normalize_entry = sub {
@@ -171,7 +182,7 @@ sub select_tag {
my $title;
if ( $value_title_sub ) {
- ($value, $title) = $value_title_sub->($entry);
+ ($value, $title) = @{ $value_title_sub->($entry) };
} else {
$value = $normalize_entry->('value', $entry, $value_sub, $value_key);
@@ -656,7 +667,7 @@ sub sortable_table_header {
my $by_spec = $sort_spec->{$by};
my %current_sort_params = $controller->get_current_sort_params;
my ($image, $new_dir) = ('', $current_sort_params{dir});
- my $title = delete($params{title}) || $by_spec->{title};
+ my $title = delete($params{title}) || $::locale->text($by_spec->{title});
if ($current_sort_params{by} eq $by) {
my $current_dir = $current_sort_params{dir} ? 'up' : 'down';
@@ -670,6 +681,29 @@ sub sortable_table_header {
return '' . _H($title) . $image . '';
}
+sub paginate_controls {
+ my ($self) = @_;
+
+ my $controller = $self->{CONTEXT}->stash->get('SELF');
+ my $paginate_spec = $controller->get_paginate_spec;
+ my %paginate_params = $controller->get_current_paginate_params;
+
+ my %template_params = (
+ pages => \%paginate_params,
+ url_maker => sub {
+ my %url_params = _hashify(@_);
+ $url_params{ $paginate_spec->{FORM_PARAMS}->[0] } = delete $url_params{page};
+ $url_params{ $paginate_spec->{FORM_PARAMS}->[1] } = delete $url_params{per_page} if exists $url_params{per_page};
+
+ return $controller->get_callback(%url_params);
+ },
+ );
+
+ my $output;
+ $controller->_template_obj->process('templates/webpages/common/paginate.html', \%template_params, \$output);
+ return $output;
+}
+
1;
__END__
@@ -1011,6 +1045,13 @@ underlying call to L.
See the documentation of L for an
overview and further usage instructions.
+=item C
+
+Create a set of links used to paginate a list view.
+
+See the documentation of L for an
+overview and further usage instructions.
+
=back
=head2 CONVERSION FUNCTIONS