From: Bill Erickson Date: Tue, 15 May 2012 13:56:27 +0000 (-0400) Subject: TPAC added content shows default tab X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=918166be5e75e2ab3dd1d0764c2be2f3075edfb1;p=contrib%2FConifer.git TPAC added content shows default tab Use the first available content as the default tab to show when the main added content tab is expanded. Note, if no content is known to exist until after JS has run, it's still possible to expand the main tab and have no content selected by default. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/templates/opac/parts/record/extras.tt2 b/Open-ILS/src/templates/opac/parts/record/extras.tt2 index d02efb08a4..7b5c378e0e 100644 --- a/Open-ILS/src/templates/opac/parts/record/extras.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/extras.tt2 @@ -19,12 +19,16 @@ END; END; - # if no added content is available, hide the main tab + # 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; - SET hide_ac = 0 IF - ctx.added_content.$type.status != '2'; # not available + IF ctx.added_content.$type.status != '2'; # not available + hide_ac = 0; + SET default_ac = type UNLESS default_ac; + END; END; END; @@ -53,7 +57,11 @@ href = mkurl('', {}, ['expand', 'ac']); img_url = ctx.media_prefix _ '/images/rdetail_arrow_down.png'; ELSE; - href = mkurl('', {expand => name}) _ '#' _ name; + IF name == 'addedcontent' AND default_ac; + href = mkurl('', {expand => name, ac => default_ac}) _ '#' _ name; + ELSE; + href = mkurl('', {expand => name}) _ '#' _ name; + END; img_url = ctx.media_prefix _ '/images/rdetail_arrow.png'; END; %]