From: Terran McCanna Date: Wed, 2 Jun 2021 19:29:53 +0000 (-0400) Subject: LP1930614 Bootstrap OPAC Summary Block X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e2028ee29bab4f970a8fa6354b64723674b7286e;p=evergreen%2Fmasslnc.git LP1930614 Bootstrap OPAC Summary Block This breaks out the summary (from the 520 field) from the rest of the MARC data so that it displays above/outside of the More Details button on the record page. Signed-off-by: Terran McCanna Signed-off-by: Ruth Frasur Signed-off-by: Mike Rylander foo --- diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/record/contents-summaryonly.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/record/contents-summaryonly.tt2 new file mode 100644 index 0000000000..3778321066 --- /dev/null +++ b/Open-ILS/src/templates-bootstrap/opac/parts/record/contents-summaryonly.tt2 @@ -0,0 +1,61 @@ +[%- +summary_contents = [ + { + display_field => 'abstract', + label => l('Summary: '), + xpath => '//*[@tag="520"]' + } +]; + +BLOCK render_summary_contents; + xpath = xpath || '//*[starts-with(@tag,"520")]'; + FOR node IN ctx.marc_xml.findnodes(xpath); + all_content = []; + graphics = []; + FOR subfield IN node.childNodes; + NEXT UNLESS subfield.nodeName == "subfield"; + code = subfield.getAttribute('code'); + IF code == '6'; + linked_fields = [subfield.textContent()]; + target_field = node.getAttribute('tag'); + get_linked_880s; + END; + NEXT UNLESS code.match('[a-z]'); + all_content.push(subfield.textContent); + END; + total_contents = all_content.join(" ").replace('\s+$', ''); + %] [% "
"; total_contents | html ; "
"; + FOREACH link880 IN graphics; + '
'; + link880.value | html; + '
'; + END; + END; +END; + +BLOCK render_all_summary_contents; + FOREACH cont IN summary_contents; + content = ''; + df = cont.display_field; + IF df AND attrs.hl.$df.size; + content = '' _ attrs.hl.$df.join('
'); + ELSE; + content = PROCESS render_summary_contents(xpath=cont.xpath); + END; + IF content.match('\S'); +-%] + + [% cont.label %] + [% content %] + + [%- END; %] + [%- END; %] +[%- END %] + +[%- content_html = PROCESS render_all_summary_contents; + IF content_html.length > 0; +%] + +

[%- content_html %]

+ +[%- END %] diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/record/contents.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/record/contents.tt2 index efe3349714..ee13110170 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/record/contents.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/record/contents.tt2 @@ -51,10 +51,6 @@ contents = [ label => l('Date/Time and Place of an Event Note: '), xpath => '//*[@tag="518"]' }, { - display_field => 'abstract', - label => l('Summary, etc.: '), - xpath => '//*[@tag="520"]' - }, { label => l('Target Audience Note: '), xpath => '//*[@tag="521"]' }, { diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/record/summary.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/record/summary.tt2 index f55058a213..bf7b8d961a 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/record/summary.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/record/summary.tt2 @@ -69,6 +69,7 @@ ctx.metalinks.push(' END; -%] [%- INCLUDE "opac/parts/record/authors.tt2" %] + [%- INCLUDE "opac/parts/record/contents-summaryonly.tt2" %]