From baad6d08cfdf0c6b4dad7985d37e74bfbfbd387b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 15 May 2012 09:46:11 -0400 Subject: [PATCH] TPAC added content improvements * Style the sub-tabs to indicate which is selected * If the template knows there is no content, hide the main tab * cleanup Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/src/templates/opac/parts/js.tt2 | 38 ++++++++++------------ .../templates/opac/parts/record/addedcontent.tt2 | 11 +++++-- .../src/templates/opac/parts/record/extras.tt2 | 21 ++++++++---- Open-ILS/web/css/skin/default/opac/style.css | 4 ++- 4 files changed, 45 insertions(+), 29 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2 index b29a0bcdc0..ff2cb290bb 100644 --- a/Open-ILS/src/templates/opac/parts/js.tt2 +++ b/Open-ILS/src/templates/opac/parts/js.tt2 @@ -77,8 +77,9 @@ [% END; # use_autosuggest %] + +[% IF ctx.page == 'record' %] +[% END; # page=record -%] [%- END; # want_dojo -%] diff --git a/Open-ILS/src/templates/opac/parts/record/addedcontent.tt2 b/Open-ILS/src/templates/opac/parts/record/addedcontent.tt2 index 21e81ef29f..477d2787bc 100644 --- a/Open-ILS/src/templates/opac/parts/record/addedcontent.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/addedcontent.tt2 @@ -18,9 +18,13 @@ %]
- [% FOR type IN ac_types.keys; + [% + all_hidden = 1; + FOR type IN ac_types.keys; tab_class = 'ac_tab'; + SET tab_class = tab_class _ ' ac_tab_selected' IF type == selected_type; IF ctx.added_content.$type.status != '2'; # no content + all_hidden = 0; IF ctx.added_content.$type.status == '3' AND want_dojo; # status unknown tab_class = tab_class _ ' hidden'; END %] @@ -28,7 +32,8 @@ [% ac_types.$type %]
[% END; - END %] + END; + %]
@@ -41,6 +46,8 @@ ELSE; l('No Content Available'); END; + ELSIF all_hidden; + l('No Content Available'); END; %]
diff --git a/Open-ILS/src/templates/opac/parts/record/extras.tt2 b/Open-ILS/src/templates/opac/parts/record/extras.tt2 index 63f82eeb6a..d02efb08a4 100644 --- a/Open-ILS/src/templates/opac/parts/record/extras.tt2 +++ b/Open-ILS/src/templates/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,15 @@ END; END; + # if no added content is available, hide the main tab + 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 + END; + END; + extras = [ {name => 'summaryplus', label => l('Summaries & More'), hide => hide_summary}, {name => 'contents', label => l('Contents'), hide => !attrs.contents}, @@ -22,16 +36,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 if all content is known to not exist + {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; diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css index de2086529c..6e697724a6 100644 --- a/Open-ILS/web/css/skin/default/opac/style.css +++ b/Open-ILS/web/css/skin/default/opac/style.css @@ -1433,5 +1433,7 @@ a.preflib_change { } #ac_tab_wrapper { width : 100%; } -.ac_tab { float: left; padding-right: 10px; font-size: 110%; } +.ac_tab { float: left; padding-right: 10px; font-size: 110%; padding: 5px; border: 1px solid #417860; } +.ac_tab_selected { background-color: #417860; } +.ac_tab_selected a { color: #FFF; } #ac_content { clear: both; width: 100%; margin-top: 10px; } -- 2.11.0