]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/copy_counts.tt2
TPAC / unapi: Overhaul copy and located URI display
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / record / copy_counts.tt2
1 <span id="rdetail_copy_counts">
2     <h2>[% l('Available copies') %]</h2>
3     <ul>
4     [%- depths = ctx.copy_summary.size;
5         depth = 0;
6         displayed_ous = {};
7         WHILE depth < depths;
8             ou_avail = ctx.copy_summary.$depth.available;
9             ou_id = ctx.copy_summary.$depth.org_unit;
10             ou_name = ctx.get_aou(ou_id).name;
11             displayed_ous.$ou_name = 1;
12     %]
13     <li>
14     [% l('[quant,_1,copy,copies] at [_2].', ou_avail, ou_name) | html %]
15     [%- this_depth = ctx.get_aou(ou_id).ou_type.depth;
16         IF ou_avail > 0 && this_depth != ctx.copy_depth %]
17     <a href="[% mkurl('', {copy_depth => this_depth}, ['copy_offset']); %]"
18        title="[% l('Show copies at [_1]', ou_name); %]">
19        [%- l('(Show)'); %]</a>
20     [%- END; %]
21     </li>
22     [%- depth = depth + 1;
23         END;
24
25         depth = attrs.plib_copy_counts.size - 1;
26         ou_name = ctx.get_aou(attrs.plib_copy_counts.$depth.org_unit).name;
27         ou_id = attrs.plib_copy_counts.$depth.org_unit;
28         UNLESS depth < 0 || displayed_ous.exists(ou_name);
29     %]
30     <li class="preferred">[%
31         l('[_1] of [quant,_2,copy,copies] available at [_3].',
32             attrs.plib_copy_counts.$depth.available,
33             attrs.plib_copy_counts.$depth.count,
34             ou_name) | html
35     %] <a href="[% mkurl('', {locg => ou_id}, ['copy_offset']); %]"
36        title="[% l('Show copies at [_1]', ou_name); %]">[%
37        l('(Show preferred library)');
38     %]</a></li>
39     [%- END %]
40     </ul>
41 </span>