From a352eb833c9c7e1e11b68560525b2797e2d56085 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 18 May 2012 13:23:53 -0400 Subject: [PATCH] tpac added content default type improvements * In the pre-JS state, only choose a default display type when the type is known to have data. * If no default type is chosen for the main tab link, because no data was available to the template, set the default from the first added content type determined to be available via JS. * Move added content JS to separate template file for easier override. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/src/templates/opac/parts/acjs.tt2 | 55 ++++++++++++++++++++++ Open-ILS/src/templates/opac/parts/js.tt2 | 36 +------------- .../src/templates/opac/parts/record/extras.tt2 | 4 +- 3 files changed, 59 insertions(+), 36 deletions(-) create mode 100644 Open-ILS/src/templates/opac/parts/acjs.tt2 diff --git a/Open-ILS/src/templates/opac/parts/acjs.tt2 b/Open-ILS/src/templates/opac/parts/acjs.tt2 new file mode 100644 index 0000000000..fe15569e22 --- /dev/null +++ b/Open-ILS/src/templates/opac/parts/acjs.tt2 @@ -0,0 +1,55 @@ + + + diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2 index ff2cb290bb..7029554d02 100644 --- a/Open-ILS/src/templates/opac/parts/js.tt2 +++ b/Open-ILS/src/templates/opac/parts/js.tt2 @@ -77,40 +77,6 @@ [% END; # use_autosuggest %] - -[% IF ctx.page == 'record' %] - -[% END; # page=record -%] +[% INCLUDE "opac/parts/acjs.tt2" IF ctx.page == 'record' %] [%- END; # want_dojo -%] diff --git a/Open-ILS/src/templates/opac/parts/record/extras.tt2 b/Open-ILS/src/templates/opac/parts/record/extras.tt2 index 7b5c378e0e..276c96968d 100644 --- a/Open-ILS/src/templates/opac/parts/record/extras.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/extras.tt2 @@ -27,6 +27,8 @@ 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; @@ -66,7 +68,7 @@ END; %] [% extra.label %] - [% extra.label %] + [% extra.label %]
-- 2.11.0