';
@@ -454,39 +325,43 @@ sub sortable_table_header {
my ($self, $by, %params) = _hashify(2, @_);
my $controller = $self->{CONTEXT}->stash->get('SELF');
- my $sort_spec = $controller->get_sort_spec;
+ my $models = $params{models} || $self->{CONTEXT}->stash->get('MODELS');
+ my $sort_spec = $models->get_sort_spec;
my $by_spec = $sort_spec->{$by};
- my %current_sort_params = $controller->get_current_sort_params;
+ my %current_sort_params = $models->get_current_sort_params;
my ($image, $new_dir) = ('', $current_sort_params{dir});
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';
+ if ($current_sort_params{sort_by} eq $by) {
+ my $current_dir = $current_sort_params{sort_dir} ? 'up' : 'down';
$image = '';
- $new_dir = 1 - ($current_sort_params{dir} || 0);
+ $new_dir = 1 - ($current_sort_params{sort_dir} || 0);
}
- $params{ $sort_spec->{FORM_PARAMS}->[0] } = $by;
- $params{ $sort_spec->{FORM_PARAMS}->[1] } = ($new_dir ? '1' : '0');
+ $params{ $models->sorted->form_params->[0] } = $by;
+ $params{ $models->sorted->form_params->[1] } = ($new_dir ? '1' : '0');
- return '' . _H($title) . $image . '';
+ return '' . _H($title) . $image . '';
}
sub paginate_controls {
my ($self, %params) = _hashify(1, @_);
my $controller = $self->{CONTEXT}->stash->get('SELF');
- my $paginate_spec = $controller->get_paginate_spec;
- my %paginate_params = $controller->get_current_paginate_params;
+ my $models = $params{models} || $self->{CONTEXT}->stash->get('MODELS');
+ my $pager = $models->paginated;
+# my $paginate_spec = $controller->get_paginate_spec;
+
+ my %paginate_params = $models->get_paginate_args;
my %template_params = (
pages => \%paginate_params,
url_maker => sub {
my %url_params = _hashify(0, @_);
- $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};
+ $url_params{ $pager->form_params->[0] } = delete $url_params{page};
+ $url_params{ $pager->form_params->[1] } = delete $url_params{per_page} if exists $url_params{per_page};
- return $controller->get_callback(%url_params);
+ return $models->get_callback(%url_params);
},
%params,
);
@@ -551,8 +426,14 @@ The following functions are just forwarded to L:
=item * C
+=item * C
+
+=item * C
+
=item * C
+=item * C
+
=back
Available high-level functions implemented in this module:
@@ -566,77 +447,17 @@ calling L. C<$value> determines
which entry is selected. The C<%attributes> are passed through to
L.
-=item C
-
-Creates a HTML 'input type=hidden' tag named C<$name> with the value
-C<$value> and with arbitrary HTML attributes from C<%attributes>. The
-tag's C defaults to C.
-
-=item C
-
-Creates a HTML 'input type=submit class=submit' tag named C<$name> with the
-value C<$value> and with arbitrary HTML attributes from C<%attributes>. The
-tag's C defaults to C.
-
-If C<$attributes{confirm}> is set then a JavaScript popup dialog will
-be added via the C handler asking the question given with
-C<$attributes{confirm}>. The request is only submitted if the user
-clicks the dialog's ok/yes button.
-
-=item C
-
-Creates a HTML 'input type="button"' tag with a very specific onclick
-handler that submits the form given by the jQuery selector
-C<$form_selector> to the URL C<$url> (the actual JavaScript function
-called for that is C in
-C). The button's label will be C<$text>.
-
-=item C
-
-Creates a HTML 'input type="button"' tag with an onclick handler
-C<$onclick> and a value of C<$text>. The button does not have a name
-nor an ID by default.
-
-If C<$attributes{confirm}> is set then a JavaScript popup dialog will
-be prepended to the C<$onclick> handler asking the question given with
-C<$attributes{confirm}>. The request is only submitted if the user
-clicks the dialog's "ok/yes" button.
-
=item C
Creates a HTML 'textarea' tag named C<$name> with the content
C<$value> and with arbitrary HTML attributes from C<%attributes>. The
tag's C defaults to C.
-=item C
-
-Creates a HTML 'input type=checkbox' tag named C<$name> with arbitrary
-HTML attributes from C<%attributes>. The tag's C defaults to
-C. The tag's C defaults to C<1>.
-
-If C<%attributes> contains a key C