TPac: toggle expandy arrow image to down-arrow on expanded record extras tabs
authorBill Erickson <berick@esilibrary.com>
Fri, 9 Sep 2011 19:13:05 +0000 (15:13 -0400)
committerBill Erickson <berick@esilibrary.com>
Sun, 11 Sep 2011 22:26:59 +0000 (18:26 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/opac/parts/record/extras.tt2
Open-ILS/web/images/rdetail_arrow_down.png [new file with mode: 0644]

index 22751d2..1d46a7a 100644 (file)
             {name => 'marchtml', label => l('MARC Record')}
         ];
 
+        MACRO tab_is_active(tab) BLOCK;
+            exp_name = 'expand_' _ tab;
+            IF ctx.$exp_name OR ctx.expand_all; 1; END;
+        END;
+
         FOREACH extra IN extras;
             IF extra.hide; NEXT; END; 
             name = extra.name;
         <div class="rdetail_extras">
             <div class="rdetail_extras_hr"></div>
             <div class="rdetail_extras_link">
-                [%  href = mkurl('', {expand => name}) _ '#' _ name; %]
-                <a name='[% name %]' href='[% href %]'><img
-                    alt='[% extra.label %]' src="[% ctx.media_prefix %]/images/rdetail_arrow.png" /></a>
+                [%  href = mkurl('', {expand => name}) _ '#' _ name; 
+                    img_url = ctx.media_prefix _ '/images/rdetail_arrow' _ (tab_is_active(name) ? '_down' : '') _ '.png' 
+                %]
+                <a name='[% name %]' href='[% href %]'><img alt='[% extra.label %]' src='[% img_url %]'/></a>
                 <a href='[% href %]' class="rdetail_extras_lbl">[% extra.label %]</a>
             </div>
         </div>
         <div class='rdetail_extras_div'>
-            [%  exp_name = 'expand_' _ name;
-                IF ctx.$exp_name OR ctx.expand_all;
+            [%  IF tab_is_active(name);
                     IF name == 'marchtml';
                         ctx.marchtml;
                     ELSE;
diff --git a/Open-ILS/web/images/rdetail_arrow_down.png b/Open-ILS/web/images/rdetail_arrow_down.png
new file mode 100644 (file)
index 0000000..3dd6bfd
Binary files /dev/null and b/Open-ILS/web/images/rdetail_arrow_down.png differ