From 699e54f96d62b78233d19d46a71f994660e275e4 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 22 Feb 2017 16:37:35 -0500 Subject: [PATCH] LP#1274999: Adjust TT syntax to match project style Using a "$" sigil on a variable is confusing because that normally means something special in TT, that the value of the variable, rather than the variable name, should be used when accessing an array or hash by index or key. Instead, we can use the "last" vmethod provided for lists to directly access the last element of the array, and then consult the size of that list with "count". Also removed is the sigil on the total_copies variable. Signed-off-by: Mike Rylander --- Open-ILS/src/templates/opac/parts/record/copy_table.tt2 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 index 92c3db9e78..535814ef63 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 @@ -28,8 +28,7 @@ END; [%- IF has_copies; # The "deepest" depth that a summary is available for determines how many total copies can be displayed here. - $depth = ctx.copy_summary.size - 1; - $total_copies = ctx.copy_summary.$depth.count; + total_copies = ctx.copy_summary.last.count; %] @@ -262,7 +261,7 @@ END; # FOREACH bib l('Previous [_1]', ctx.copy_offset - new_offset) %] [%- END %] - [%- IF copies.size >= ctx.copy_limit AND NOT serial_holdings AND (ctx.copy_offset + ctx.copy_limit > $total_copies) %] + [%- IF copies.size >= ctx.copy_limit AND NOT serial_holdings AND (ctx.copy_offset + ctx.copy_limit > total_copies) %]
[% l('Next [_1]', ctx.copy_limit) %] » @@ -273,7 +272,7 @@ END; # FOREACH bib
[%- more_copies_limit = 50 %] [%# TODO: config %] - [%- IF ctx.copy_limit != more_copies_limit AND copies.size >= ctx.copy_limit AND $total_copies > ctx.copy_limit %] + [%- IF ctx.copy_limit != more_copies_limit AND copies.size >= ctx.copy_limit AND total_copies > ctx.copy_limit %]