]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/parts/myopac/column_sort_support.tt2
LP1895679: Simplify and genericize the refund policy
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / parts / myopac / column_sort_support.tt2
1 [%# Produce a URL for a given field that cycles for sorting from
2     "nothing" to "ascending" to "descending" then back to "nothing".
3 %]
4 [% MACRO sort_url(field)
5         IF (CGI.param('sort') == field);
6                 SWITCH CGI.param('sort_type');
7                 CASE "asc";
8                    mkurl('',{sort=>field, sort_type=>'desc'},1);
9                 CASE "desc";
10                    mkurl('',{sort=>field, sort_type=>'asc'}, 1);
11                 END;
12         ELSE;
13            mkurl('',{sort=>field, sort_type=>'asc'}, 1);
14         END;
15 %]
16 [%# SET click_sort = l("click to sort") %]
17 [%# SET click_sort = "title=\"$click_sort\"" %]
18
19 [%# Produce arrows to indicate the sorting status of the column %]
20 [% MACRO sort_indicator(field)
21         IF (CGI.param('sort') == field);
22                 SWITCH CGI.param('sort_type');
23                 CASE "asc";
24 "&nbsp;<span class=\"column_sort_arrow\">&#9650;</span>";
25                 CASE "desc";
26 "&nbsp;<span class=\"column_sort_arrow\">&#9660;</span>";
27                 END;
28         END;
29 %]
30
31 [%# Column headers for sortable columns %]
32 [% MACRO sort_head(field, field_label)
33    BLOCK %]
34 <a href="[% sort_url(field) %]" [% click_sort %]>[% l(field_label) %]</a>[%- sort_indicator(field) %]
35 [% END
36 %]