MT#7119 API document sortable columns

for collections, as query parameters
ipeshinskaya/InvoiceTemplate5
Gerhard Jungwirth 12 years ago
parent c93c8eeb6d
commit 09ac08508b

@ -70,8 +70,17 @@ sub GET : Allow {
my $actions = [ keys %{ $full_mod->config->{action} } ];
my $item_actions = $full_item_mod->can('config') ? [ keys %{ $full_item_mod->config->{action} } ] : [];
my $form = $full_mod->get_form($c);
my $sorting_cols = [];
my $item_rs;
try {
$item_rs = $full_mod->item_rs($c, "");
}
if ($item_rs) {
$sorting_cols = [$item_rs->result_source->columns];
}
$c->stash->{collections}->{$rel} = {
name => $mod,
description => $full_mod->api_description,
@ -79,6 +88,7 @@ sub GET : Allow {
query_params => $query_params,
actions => $actions,
item_actions => $item_actions,
sorting_cols => $sorting_cols,
};
}

@ -51,15 +51,13 @@ See description how to obtain properties, if any.
<h[% level + 1 %]>Query Parameters</h[% level + 1%]>
[% UNLESS col.query_params.size -%]
None.
[% ELSE -%]
<ul id="[% id %]-qparams">
[% FOREACH f IN col.query_params -%]
<li><b>[% f.param %]</b>: [% f.description %]</li>
[% END -%]
<li><b>order_by</b>: Order collection by a specific attribute. Possible values are: <i>[% col.sorting_cols.join(', ') %]</i></li>
<li><b>order_by_direction</b>: Direction which the collection should be ordered by. Possible values are: <i>asc (default), desc</i></li>
</ul>
[% END -%]
<h[% level + 1 %]>Examples</h[% level + 1 %]>
<div class="examples">

Loading…
Cancel
Save