From: Jeff Godin Date: Thu, 26 Jul 2012 08:11:03 +0000 (-0400) Subject: Backport of extras.tt2 with added content X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7aab15e4289c10c8e4731e04dc8c7c13b10b8292;p=evergreen%2Ftadl.git Backport of extras.tt2 with added content Backport of extras.tt2 from master for added content in TPAC Signed-off-by: Jeff Godin --- diff --git a/templates_tadlskin/opac/parts/record/extras.tt2 b/templates_tadlskin/opac/parts/record/extras.tt2 index b636c3b8e4..422be4fde4 100644 --- a/templates_tadlskin/opac/parts/record/extras.tt2 +++ b/templates_tadlskin/opac/parts/record/extras.tt2 @@ -3,6 +3,11 @@ [% # Hidden extras are not yet implemented. Some may require JS + MACRO tab_is_active(tab) BLOCK; + exp_name = 'expand_' _ tab; + IF ctx.$exp_name OR ctx.expand_all; 1; END; + END; + # Let's see if we should hide the content cafe / simple summary content hide_summary = 1; IF attrs.summary.0; hide_summary = 0; ELSE; @@ -14,6 +19,21 @@ END; END; + # if no added content is available, hide the main tab. + # if any content is available, use the first tab as the default display tab. + default_ac = ''; + IF !tab_is_active('addedcontent'); + hide_ac = 1; + FOR type IN ctx.added_content.keys; + IF ctx.added_content.$type.status != '2'; # not available + hide_ac = 0; + END; + IF ctx.added_content.$type.status == '1'; + SET default_ac = type UNLESS default_ac; + END; + END; + END; + extras = [ {name => 'summaryplus', label => l('Summaries & More'), hide => hide_summary}, {name => 'contents', label => l('Contents'), hide => !attrs.contents}, @@ -22,15 +42,11 @@ {name => 'excerpt', label => l('Excerpt'), hide => 1}, {name => 'issues', label => l('Issues Held'), hide => !(ctx.have_holdings_to_show || ctx.have_mfhd_to_show)}, {name => 'preview', label => l('Preview'), hide => 1}, + {name => 'addedcontent', label => l('Additional Content'), hide => hide_ac}, # hide if all content is known to not exist {name => 'cnbrowse', label => l('Shelf Browser')}, {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; @@ -40,15 +56,19 @@