sub get {
my ($self) = @_;
my %params = $self->finalize;
- %params = $self->_run_handlers('get_models', %params);
return $self->manager->get_all(%params);
}
sub init_handlers {
{
callback => [],
- get_models => [],
}
}
$final_args->{$field} = [ map { @{ $_->{$field} || [] } } @args ];
}
- for my $field (qw(page per_page sort_by sort_dir )) {
+ for my $field (qw(page per_page sort_by)) {
for my $arg (@args) {
- next unless defined $_->{$field};
- $final_args->{$field} //= $_->{$field};
+ next unless defined $arg->{$field};
+ $final_args->{$field} //= $arg->{$field};
}
}
sub finalize {
my ($self, %params) = @_;
- %params;
+
+ my %filter_params;
+ %filter_params = $self->read_params(%params) if $self->is_enabled;
+
+ # $::lxdebug->dump(0, "GM handler for filtered; params nach modif (is_enabled? " . $self->is_enabled . ")", \%params);
+
+ return $self->merge_args(\%params, \%filter_params);
}
#
return %params;
}
-sub _get_models_handler_for_filtered {
- my ($self, %params) = @_;
-
- # $::lxdebug->dump(0, "params in get_models_for_filtered", \%params);
-
- my %filter_params;
- %filter_params = $self->read_params(%params) if $self->is_enabled;
-
- # $::lxdebug->dump(0, "GM handler for filtered; params nach modif (is_enabled? " . $self->is_enabled . ")", \%params);
-
- return $self->merge_args(\%params, \%filter_params);
-}
-
sub init_form_params {
'filter'
}
return %params;
}
-sub _get_models_handler_for_paginated {
- my ($self, %params) = @_;
-
- $self->get_models->manager->paginate(%{ $self->calculated_params }, args => \%params) if $self->is_enabled;
-
- # $::lxdebug->dump(0, "GM handler for paginated; params nach modif (is_enabled? " . _is_enabled($self) . ")", \%params);
- return %params;
-}
-
sub init_form_params {
[ qw(page per_page) ]
}
sub finalize {
my ($self, %params) = @_;
+
+ my %sort_params = $self->read_params;
+ my $sort_spec = $self->specs->{ $sort_params{sort_by} };
+
+ $params{sort_by} = "SL::DB::Manager::$sort_spec->{model}"->make_sort_string(sort_by => $sort_spec->{model_column}, sort_dir => $sort_params{sort_dir});
+
%params;
}
return %params;
}
-sub _get_models_handler_for_sorted {
- my ($self, %params) = @_;
-
- my %sort_params = $self->read_params;
- my $sort_spec = $self->specs->{ $sort_params{sort_by} };
-
- $params{sort_by} = "SL::DB::Manager::$sort_spec->{model}"->make_sort_string(sort_by => $sort_spec->{model_column}, sort_dir => $sort_params{sort_dir});
-
- # $::lxdebug->dump(0, "GM handler for sorted; params nach modif:", \%params);
-
- return %params;
-}
+#sub _get_models_handler_for_sorted {
+# my ($self, %params) = @_;
+#
+#
+#
+# # $::lxdebug->dump(0, "GM handler for sorted; params nach modif:", \%params);
+#
+# return %params;
+#}
sub init_form_params {