diff --git a/themes/fid_bbi/format-icon-mappings.json b/themes/fid_bbi/format-icon-mappings.json new file mode 100644 index 0000000000000000000000000000000000000000..2b01d0730a3df20695dc98221fb17048a35b354f --- /dev/null +++ b/themes/fid_bbi/format-icon-mappings.json @@ -0,0 +1,52 @@ +{ + "_TODO": "Add missing icon mappings", + "Atlas": "", + "Book": "book", + "BookComponentPart": "book", + "Braille": "", + "BRDisc": "disc", + "CDROM": "software", + "Chart": "", + "ChipCartridge": "software", + "Collage": "", + "DiscCartridge": "software", + "Drawing": "", + "eBook": "book-online", + "Electronic": "", + "Filmstrip": "video", + "FlashCard": "", + "FloppyDisk": "software", + "Globe": "", + "Journal": "periodical", + "Kit": "", + "Manuscript": "", + "Map": "", + "Microfilm": "video", + "MotionPicture": "video", + "MusicalScore": "audio", + "MusicRecording": "audio", + "Newspaper": "periodical", + "Painting": "", + "Photonegative": "", + "Photo": "", + "PhysicalObject": "", + "Print": "", + "SensorImage": "", + "SerialComponentPart": "article", + "Serial": "periodical", + "Slide": "", + "Software": "software", + "SoundCassette": "audio", + "SoundDisc": "audio", + "SoundRecording": "audio", + "TapeCartridge": "software", + "TapeCassette": "software", + "TapeReel": "software", + "Transparency": "", + "Unknown": "", + "VideoCartridge": "video", + "VideoCassette": "video", + "VideoDisc": "video", + "VideoReel": "video", + "Video": "video" +} diff --git a/themes/fid_bbi/js/theme.js b/themes/fid_bbi/js/theme.js new file mode 100644 index 0000000000000000000000000000000000000000..0b4939a71d5b4d4b6f19eb8fe0ce77a6de33d44a --- /dev/null +++ b/themes/fid_bbi/js/theme.js @@ -0,0 +1,195 @@ +'use strict' + +// NOTE: Required packages/scripts: +// css-element-queries/src/ResizeSensor +// slim-select +// sticky-sidebar + +const theme = { + rowTemplate: null, + scrollPos: 0, + init() { + theme.initSelects() + + // Sticky sidebar + // NOTE: Requires ResizeSensor for automatic resizing + const sidebar = document.querySelector('#sidebar') + if (sidebar) { + // eslint-disable-next-line no-new + new StickySidebar('#sidebar', { + topSpacing: 28, + bottomSpacing: 28, + containerSelector: '#sidebar-container', + innerWrapperSelector: '#sidebar-inner', + minWidth: 1024, // NOTE: Must match the `$bp4` breakpoint + 1px as set in `scss/util/settings.scss`. + }) + } + + theme.updateScrolled() + window.addEventListener('scroll', theme.updateScrolled) + + // Handle aria-based toggles + window.addEventListener('click', (event) => { + const button = event.target.closest('a, button') + if (!button) { + return + } + + const targetId = button.getAttribute('aria-controls') + if (!targetId) { + return + } + + const role = button.getAttribute('role') + const ariaExpanded = button.getAttribute('aria-expanded') + + if (role === 'tab') { + selectTab(targetId) + } else if (ariaExpanded !== null) { + button.setAttribute('aria-expanded', ariaExpanded === 'false') + const targetElement = document.getElementById(targetId) + if (ariaExpanded === 'false') { + targetElement.removeAttribute('hidden') + } else { + targetElement.setAttribute('hidden', '') + } + } else { + theme.toggleSidebar(targetId) + } + }) + }, + initSelects(parentNode = document) { + const selects = parentNode.querySelectorAll('select') + + for (let i = 0; i < selects.length; i++) { + const select = selects[i] + const isMultiSelect = select.hasAttribute('multiple') + + if (!isMultiSelect && select.childElementCount < 6) { + continue + } + + // eslint-disable-next-line no-new + new SlimSelect({ + select, + closeOnSelect: !isMultiSelect, + placeholder: 'Auswahl', + searchText: 'Nichts gefunden', + searchPlaceholder: 'Filter', + searchFocus: true, + searchHighlight: true, + deselectLabel: '×', + hideSelectedOption: isMultiSelect, + }) + } + }, + scrollToTop() { + const duration = .25 + const element = document.documentElement.scrollTop ? document.documentElement : document.body + const scrollTop = element.scrollTop + + if (scrollTop < 0) { + return false + } + + let currentTime = 0 + + const animationFrame = (() => { + return window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + function (callback) { window.setTimeout(callback, 1000 / 60) } + })() + + function easeInOutSine(pos) { + return (-0.5 * (Math.cos(Math.PI * pos) - 1)) + } + + // Animation loop + function tick() { + currentTime += 1 / 60 + const p = currentTime / duration + const t = easeInOutSine(p) + + // NOTE: scrollTo() does not work in IE + if (p < 1) { + animationFrame(tick) + element.scrollTop = scrollTop + ((0 - scrollTop) * t) + } else { + element.scrollTop = 0 + } + } + + tick() + + return false + }, + selectTab(id) { + const tabsContainer = event.target.closest('.tabs') + const buttons = tabsContainer.querySelectorAll('.tabs_button') + const tabs = tabsContainer.querySelectorAll('.tabs_item') + + for (let i = 0; i < buttons.length; ++i) { + buttons[i].classList.remove('-current') + buttons[i].setAttribute('aria-selected', false) + } + + for (let i = 0; i < tabs.length; ++i) { + tabs[i].setAttribute('hidden', '') + } + + event.target.closest('button').setAttribute('aria-selected', true) + document.getElementById(id).removeAttribute('hidden') + }, + toggleFacets() { + event.target.parentElement.classList.toggle('-collapsed') + }, + toggleSidebar(id) { + const sidebar = document.getElementById(id) + if (!sidebar.classList.contains('-open')) { + // Focus input when sidebar is halfway visible + const input = sidebar.querySelector('[data-focus-off-canvas]') + if (input) { + setTimeout(() => { input.select() }, 125) + } + + theme.scroll.lock() + } else { + theme.scroll.unlock() + } + + sidebar.classList.toggle('-open') + + // TODO: aria-expanded should be set, but multiple buttons may be affected + }, + // Toggling "scrolled" for to-top button + updateScrolled() { + if (document.documentElement.scrollTop > 84 || document.body.scrollTop > 84) { + document.body.classList.add('-scrolled') + } else { + document.body.classList.remove('-scrolled') + } + }, + scroll: { + lock() { + theme.scrollPos = document.documentElement.scrollTop || document.body.scrollTop + document.body.style.top = `-${theme.scrollPos}px` + document.body.style.marginBottom = `-${theme.scrollPos}px` + document.body.style.height = `calc(100vh + ${theme.scrollPos}px)` + document.body.style.overflow = 'hidden' + document.body.style.position = 'relative' + }, + unlock() { + document.body.style = '' + + setTimeout(() => { + document.documentElement.scrollTop = document.body.scrollTop = theme.scrollPos + }) + }, + }, +} + +window.addEventListener('load', theme.init) + +// Make `theme` globally available +window.theme = theme diff --git a/themes/fid_bbi/languages/de.ini b/themes/fid_bbi/languages/de.ini index f7fb453419ca1b983f86968309d93aca6d36d157..0c9a8c222b28deeaacf9cc97c0486fa280edc174 100644 --- a/themes/fid_bbi/languages/de.ini +++ b/themes/fid_bbi/languages/de.ini @@ -1,15 +1,36 @@ +%%count%% results = %%count%% Ergebnisse +Active Filters = Aktive Filter +Add filter: = Filter hinzufügen: +Add filter: NOT %%text%% = Filter hinzufügen: NICHT %%text%% +Add to Book Bag = Zur Merkliste hinzufügen +Add to favorites = Zu Favoriten hinzufügen +Back = Zurück BBI Blog = BBI-Blog +Book Bag = Merkliste +Close = Schließen Close functions & filters = Funktionen & Filter schließen FAQs = Häufige Fragen Find = Suchen For Subject Specialists = Für Fachreferate +From the year = Vom Jahr +Functions & Filters = Funktionen & Filter +History = Verlauf New Publications = Neuerscheinungen Open navigation = Navigation öffnen Open search = Suche öffnen +Page %%current%% of %%total%% = Seite %%current%% von %%total%% Recent Blog Posts = Neueste Blog-Einträge +Remove all filters = Alle Filter entfernen Scroll to top = Nach oben scrollen +Search: %%lookfor%% = Suche: %%lookfor%% +Show all = Alle anzeigen +Show functions & filters = Funktionen & Filter anzeigen +Show less = Weniger anzeigen +Sorted by = Sortiert nach Team = Team +the year = zum Jahr This field is required = Pflichtfeld +to = bis home_about_1 = <p class="-columns">Der Fachinformationsdienst Buch-, Bibliotheks- und InformationsÂwissenÂschaft (FID BBI) stellt SpezialÂliteratur und forschungsÂrelevante InformaÂtionen für Forschende der drei DisziÂplinen zur Verfügung. Das HerzÂstück bildet das umfangreiche RechercheÂwerkzeug in dem Forschende, Lehrende und StudieÂrende in über 3 Millionen DatenÂsätzen gezielt recherÂchieren können. Der DatenÂpool speist sich aus über 30 DatenÂquellen, die regelÂmäßig aktualiÂsiert und ergänzt werden.</p> home_about_2 = <h2>Anregungen und Feedback</h2><p>Der FID BBI richtet sich an den Bedarfen der Forschenden aus. Vermissen Sie eine Datenquelle, können Sie einen bestimmten Titel nicht finden oder suchen Sie ausführlichere Informationen zum FID BBI, <a href="%%feedback_url%%">kontaktieren Sie uns</a> oder <a href="%%blog_url%%">besuchen Sie unser Blog</a>.</p> diff --git a/themes/fid_bbi/scss/base/common.scss b/themes/fid_bbi/scss/base/common.scss index d9f1fc91121f96c3962ffd005a349adbdf6f036e..84606f0364283538af1c7ab4e40ebf2fe7bcbaed 100644 --- a/themes/fid_bbi/scss/base/common.scss +++ b/themes/fid_bbi/scss/base/common.scss @@ -203,6 +203,7 @@ p { @media #{$bp3} { column-gap: g(2); columns: 2; + max-width: none; } } @@ -254,7 +255,7 @@ ul { li { &::before { - background: $color-a; + background: currentColor; content: ''; height: g(.25); margin: round($line-height / 2 - g(.25) / 2) 0 0 g(-.75); @@ -268,3 +269,7 @@ video { height: auto; max-width: 100%; } + +.hidden { + display: none !important; +} diff --git a/themes/fid_bbi/scss/base/form.scss b/themes/fid_bbi/scss/base/form.scss index f9815a752561f943bb3eb70f787b36f7cdf904f1..0c45066260f1f3b94f3647b88facd4aee742b00f 100644 --- a/themes/fid_bbi/scss/base/form.scss +++ b/themes/fid_bbi/scss/base/form.scss @@ -37,6 +37,7 @@ fieldset { form { @include paragraph; + max-width: none; &:last-child { margin-bottom: 0; diff --git a/themes/fid_bbi/scss/blocks/alert.scss b/themes/fid_bbi/scss/blocks/alert.scss index e6cad94d2877835ca98aea2fc751dd641ca1c6d0..729146006d014a6a6f0bb5fe790bd439fc2cf82c 100644 --- a/themes/fid_bbi/scss/blocks/alert.scss +++ b/themes/fid_bbi/scss/blocks/alert.scss @@ -2,15 +2,11 @@ @include button-icon-bg; background: $shade-weak; font-weight: 500; - margin: 0 0 g(); + margin: 0 auto g(); padding: g(.5) g(); padding-left: g(2.75); position: relative; - &::before { - width: g(2.25); - } - &.-success { color: $text-muted-color; } @@ -27,6 +23,10 @@ color: $text-color; } + &::before { + width: g(2.25); + } + > .icon { margin-left: g(-2.25); } diff --git a/themes/fid_bbi/scss/blocks/form.scss b/themes/fid_bbi/scss/blocks/form.scss index 7d4dbd076975b03cb754d74fba9521d7eec1f258..6a157ebdbb2f0dca908f256a33476ed394524327 100644 --- a/themes/fid_bbi/scss/blocks/form.scss +++ b/themes/fid_bbi/scss/blocks/form.scss @@ -37,10 +37,9 @@ .form_row { @include paragraph; align-items: flex-start; - - @media #{$bp3} { - display: flex; - } + display: flex; + flex-wrap: wrap; + justify-content: space-between; // TODO: Test this on all forms &:last-child { margin-bottom: 0; @@ -73,7 +72,8 @@ > [type=text], > [type=url], > select, - > textarea { + > textarea, + > .form-control { margin: 0; width: 100%; @@ -97,6 +97,11 @@ } } } + + // "Back" link on some forms + > .btn-link { + margin: g(.5) g(.5) g(.5) 0; + } } .form_label { @@ -134,3 +139,8 @@ width: 100%; } } + +// TODO: Move? +.help-block { + margin-top: g(.5); +} diff --git a/themes/fid_bbi/scss/blocks/main.scss b/themes/fid_bbi/scss/blocks/main.scss index bc6c92b194a74482f00944d69fca406c976e1e6b..3b5d79c2c9b2002199c6e2eaf926b6f09c886d5b 100644 --- a/themes/fid_bbi/scss/blocks/main.scss +++ b/themes/fid_bbi/scss/blocks/main.scss @@ -5,14 +5,14 @@ padding: 0 g(); } -.main_text { - margin: 0 auto; - max-width: $line-width; -} - .main_wrap { margin: 0 auto; max-width: 100%; position: relative; width: $max-width; + + // For elements like `<div>* required</div>` + > div:not([class]) { + @include paragraph; + } } diff --git a/themes/fid_bbi/scss/blocks/modal.scss b/themes/fid_bbi/scss/blocks/modal.scss index 8ac1975dd1b77480a9cb4da4224b5cb364161496..68d5c720552a982d1767609caa4963d8ed2bab9f 100644 --- a/themes/fid_bbi/scss/blocks/modal.scss +++ b/themes/fid_bbi/scss/blocks/modal.scss @@ -42,7 +42,7 @@ overflow: auto; transform: translateY(g(-1)); transition: transform $td; - width: $line-width + g(2); + width: $line-width; // TODO: Merge classes .modal.in &, diff --git a/themes/fid_bbi/scss/blocks/pagination.scss b/themes/fid_bbi/scss/blocks/pagination.scss new file mode 100644 index 0000000000000000000000000000000000000000..728a014ed098f47acc4bff7c3f5fcae1f8c5221c --- /dev/null +++ b/themes/fid_bbi/scss/blocks/pagination.scss @@ -0,0 +1,42 @@ +.pagination { + @include paragraph; + align-items: center; + display: flex; + font-weight: 500; + justify-content: space-between; + flex-wrap: wrap; + + .results_header + & { + margin-top: g(-.25); // align with sidebar buttons + } + + @media #{$bp5} { + margin-left: g(4); + } +} + +.pagination_control { + &:last-child { + text-align: right; + } +} + +.pagination_link { + @include button-small; + display: inline-block; + padding: (g(.25) - 2px); + + @include hover { + box-shadow: none; + } +} + +.pagination_link-label { + @include sr-only; +} + +.pagination_page { + flex: 1; + margin: 0 g(.5); + text-align: center; +} diff --git a/themes/fid_bbi/scss/blocks/result.scss b/themes/fid_bbi/scss/blocks/result.scss index abda9240bf07db8ca172380ff2822196e3c7fe6c..85eb8d804d4f8bab04728344695d09c62e66f881 100644 --- a/themes/fid_bbi/scss/blocks/result.scss +++ b/themes/fid_bbi/scss/blocks/result.scss @@ -1,39 +1,29 @@ .result { display: flex; + margin-bottom: g(); position: relative; a { position: relative; } - - & + & { - margin-top: g(); - } } .result_actions { - margin-left: g(); + margin: g(-.25) g(.25) g(-.25) g(.25 + 1); a { display: block; - margin: g(-.25); + margin: g(.25) g(-.25) g(-.25); padding: g(.25); - + a { - margin-top: g(.25); - } - @include hover { background: $button-hover-bg; box-shadow: none; } - - // Some tooltips contain 2 messages, show only the 1st one by default - .tooltip span + span { - display: none; - } } + // TODO + a.cart-remove, a.-selected { .icon { animation: beat $td 1; @@ -56,14 +46,6 @@ fill: currentColor; } } - - .tooltip span { - display: none; - - + span { - display: block; - } - } } } diff --git a/themes/fid_bbi/scss/blocks/results.scss b/themes/fid_bbi/scss/blocks/results.scss index ba577990074cd1be4b9f0db49b91c9938efa03df..52a9d021c9d51f448510edf913dcc4c8027e9c5e 100644 --- a/themes/fid_bbi/scss/blocks/results.scss +++ b/themes/fid_bbi/scss/blocks/results.scss @@ -28,6 +28,10 @@ } } +.results_count { + margin: g(.25); +} + .results_footer { margin-top: g(1.5); overflow: hidden; @@ -59,24 +63,14 @@ } .results_header { + align-items: baseline; display: flex; - flex-direction: column-reverse; flex-wrap: wrap; font-weight: 500; - justify-content: center; - margin: 0 0 g(1); - max-width: calc(100vw - #{g(2)}); - text-align: center; - - @media #{$bp3} { - flex-direction: column; - justify-content: space-between; - margin: g(-.25) g(-.25) g(-.25 + 1); - text-align: left; - } + justify-content: space-between; + margin: g(-.25) g(-.25) g(-.25 + 1); @media #{$bp5} { - justify-content: flex-start; margin-left: g(-.25 + 4); } } @@ -90,11 +84,55 @@ } } +.results_pagination { + margin: g(.25); + width: 100%; +} + +.results_sidebar-toggle { + background: $link-color; + border: 0; + bottom: 0; + color: #fff; + font-family: text-font, sans-serif; + font-size: $font-size-small; + font-weight: bold; + padding: g(.25) g(.5); + position: fixed; + right: 0; + transform: skew(-$skew); + transform-origin: bottom right; + z-index: 1; + + @media #{$bp4} { + display: none; + } + + @include hover { + background: $link-hover-color; + color: #fff; + } + + > * { + display: inline-block; + transform: skew($skew); + } + + .layout.-no-scroll & { + display: none; + } +} + .results_sort { - max-width: 100%; + margin: g(.25); + width: 100%; + + @media #{$bp1} { + width: auto; + } @media #{$bp3} { - margin: g(.25); + text-align: right; } label { @@ -102,12 +140,18 @@ } select { - display: block; margin: 0 auto; + vertical-align: middle; + width: 100%; + + @media #{$bp1} { + width: auto; + } @media #{$bp3} { display: inline-block; margin: 0 0 0 .3em; + width: auto; } } } diff --git a/themes/fid_bbi/scss/blocks/search.scss b/themes/fid_bbi/scss/blocks/search.scss index b93e4e71a76fa28692bbebd3a84a5e1122fa3c77..1bd48cb039702f3a5fee5ef1a453ade66ec543a5 100644 --- a/themes/fid_bbi/scss/blocks/search.scss +++ b/themes/fid_bbi/scss/blocks/search.scss @@ -1,7 +1,7 @@ .search { color: #fff; margin: 0 auto; - max-width: $line-width; + max-width: $line-width - g(2); @media #{$bp5} { max-width: none; @@ -36,6 +36,10 @@ @media #{$bp3} { display: none; } + + h2 { + color: $heading-color; + } } .search_input { diff --git a/themes/fid_bbi/scss/blocks/sidebar.scss b/themes/fid_bbi/scss/blocks/sidebar.scss index 410d65cdcca07b7fede72b6b3a6e00c775d19b67..ad50231904da1785b56c3dd0770dd4f1f4b9736a 100644 --- a/themes/fid_bbi/scss/blocks/sidebar.scss +++ b/themes/fid_bbi/scss/blocks/sidebar.scss @@ -1,14 +1,14 @@ .sidebar { @include off-canvas; - flex: 0 0 g(12); - margin: 0 g(); - max-width: g(12); padding-left: g(); padding-right: g(); will-change: min-height; // For sticky sidebar @media #{$bp4} { @include on-canvas; + flex: 0 0 g(12); + margin: 0 g(); + max-width: g(12); padding-left: 0; padding-right: 0; } @@ -28,37 +28,3 @@ transform: translate3d(0, 0, 0); // For sticky sidebar will-change: position, transform; // For sticky sidebar } - -.sidebar_toggle { - background: $link-color; - border: 0; - bottom: 0; - color: #fff; - font-family: text-font, sans-serif; - font-size: $font-size-small; - font-weight: bold; - padding: g(.25) g(.5); - position: fixed; - right: 0; - transform: skew(-$skew); - transform-origin: bottom right; - z-index: 1; - - @media #{$bp4} { - display: none; - } - - @include hover { - background: $link-hover-color; - color: #fff; - } - - > * { - display: inline-block; - transform: skew($skew); - } - - .layout.-no-scroll & { - display: none; - } -} diff --git a/themes/fid_bbi/scss/blocks/tagline.scss b/themes/fid_bbi/scss/blocks/tagline.scss index 656071aa17cf0aa4047410a1660327a8b3a1fab3..29e0d68c2a78d619bd05e2b3aa7b930478ad0218 100644 --- a/themes/fid_bbi/scss/blocks/tagline.scss +++ b/themes/fid_bbi/scss/blocks/tagline.scss @@ -3,6 +3,7 @@ color: $color-a; font: #{round($font-size-special * $ratio)}/#{$line-height * 1.5} display-font, sans-serif; margin: g(1.75) auto g(2); + max-width: none; position: relative; text-align: center; diff --git a/themes/fid_bbi/scss/compiled.scss b/themes/fid_bbi/scss/compiled.scss index 5e9c45e9ffb559bff44be479de5f1f51d2b10655..6cf627e09ab76976948d0f9d757f14c253e8466a 100644 --- a/themes/fid_bbi/scss/compiled.scss +++ b/themes/fid_bbi/scss/compiled.scss @@ -38,6 +38,7 @@ @import 'blocks/main'; @import 'blocks/modal'; @import 'blocks/nav'; +@import 'blocks/pagination'; @import 'blocks/posts'; @import 'blocks/post'; @import 'blocks/record'; diff --git a/themes/fid_bbi/scss/mixins/button.scss b/themes/fid_bbi/scss/mixins/button.scss index ce4789e9ac21e306c3fbc75ee10d1d0a2028ec2b..cfce0591b0bbf95209d9fca0959ab21905de9f80 100644 --- a/themes/fid_bbi/scss/mixins/button.scss +++ b/themes/fid_bbi/scss/mixins/button.scss @@ -66,6 +66,7 @@ } @if ($position == right) { + float: right; margin: 0 g(-.5) 0 g(.75); @if ($size == big) { diff --git a/themes/fid_bbi/scss/mixins/paragraph.scss b/themes/fid_bbi/scss/mixins/paragraph.scss index 8b60db80a544de53a891b9d26357c80bfb38a330..83e95700f9eb545af1d5d7685af4d50842a70692 100644 --- a/themes/fid_bbi/scss/mixins/paragraph.scss +++ b/themes/fid_bbi/scss/mixins/paragraph.scss @@ -1,5 +1,6 @@ @mixin paragraph { - margin: 0 0 g(); + margin: 0 auto g(); + max-width: g(30); &:last-child { margin-bottom: 0; diff --git a/themes/fid_bbi/scss/plugins/slim-select.scss b/themes/fid_bbi/scss/plugins/slim-select.scss index 119a3907598308e87828ebb7b230095bafdc889d..a1ca3745425b7af3e355f5d76cf68f58be7b8bcd 100644 --- a/themes/fid_bbi/scss/plugins/slim-select.scss +++ b/themes/fid_bbi/scss/plugins/slim-select.scss @@ -3,6 +3,24 @@ .ss-main { color: $text-color; + .ss-single-selected { + height: g(2); + + .ss-arrow { + margin: 0 11px 0 1px; // same position as SVG arrow in normal selects + order: -1; + + span { + border-color: $text-color; + } + } + + .placeholder { + font-weight: 500; + } + } + + .ss-single-selected, .ss-multi-selected { background: mix(#000, #fff, 5); border: 2px solid; diff --git a/themes/fid_bbi/scss/util/settings.scss b/themes/fid_bbi/scss/util/settings.scss index 67944e2d9cdc1a6dd589555b5781bc84acdc7cd2..63854a4bd5a5bf7b8e115b1317597c0ceb32dc21 100644 --- a/themes/fid_bbi/scss/util/settings.scss +++ b/themes/fid_bbi/scss/util/settings.scss @@ -25,7 +25,7 @@ $font-size: 18.666666px; // $grid / 1.5 $font-size-small: 16px; $font-size-special: 23px; // Match small text in logo $line-height: g(); -$line-width: g(28); +$line-width: g(30); $max-width: g(48); // Breakpoints (mobile first) diff --git a/themes/fid_bbi/templates/Recommend/SideFacets.phtml b/themes/fid_bbi/templates/Recommend/SideFacets.phtml new file mode 100644 index 0000000000000000000000000000000000000000..3629187e0d8793b23906a51eb64450e69e392dd2 --- /dev/null +++ b/themes/fid_bbi/templates/Recommend/SideFacets.phtml @@ -0,0 +1,93 @@ +<!-- fid_bbi: Recommend - SideFacets --> +<?php +// Save results/options to $this so they are available to sub-templates: +$this->results = $results = $this->recommend->getResults(); +$this->options = $options = $results->getOptions(); +?> + +<?php if ($results->getResultTotal() > 0): ?> + <h2 class="sr-only"> + <?=$this->transEsc(isset($this->overrideSideFacetCaption) ? $this->overrideSideFacetCaption : 'Narrow Search')?> + </h2> +<?php endif; ?> + +<?php +$checkboxFilters = $results->getParams()->getCheckboxFacets(); +$checkboxesShown = false; +?> +<?php if (count($checkboxFilters) > 0): ?> + <?php + foreach ($checkboxFilters as $current) { + if ($results->getResultTotal() > 0 || $current['selected'] || $current['alwaysVisible']) { + $checkboxesShown = true; + break; + } + } + ?> + + <?php if ($checkboxesShown): ?> + <div class="checkboxFilter"> + <?=$this->context($this)->renderInContext('Recommend/SideFacets/checkbox-filters.phtml', [ + 'checkboxFilters' => $checkboxFilters, + 'results' => $results] + );?> + </div> + <?php endif; ?> +<?php endif; ?> + +<?php +$extraFilters = isset($this->extraSideFacetFilters) ? $this->extraSideFacetFilters : []; +$collapsedFacets = $this->recommend->getCollapsedFacets(); +$filterList = array_merge($results->getParams()->getFilterList(true), $extraFilters); +?> +<?php if (!empty($filterList)): ?> + <?=$this->context($this)->renderInContext('Recommend/SideFacets/filter-list.phtml', [ + 'collapsedFacets' => $collapsedFacets, + 'extraFilters' => $extraFilters, + 'filterList' => $filterList, + ]);?> +<?php endif; ?> +<?=isset($this->sideFacetExtraControls) ? $this->sideFacetExtraControls : ''?> + +<?php $sideFacetSet = $this->sideFacet()->displayAllowedFacetValues($this->recommend->getFacetSet()); ?> +<?php $hierarchicalFacets = $this->recommend->getHierarchicalFacets() ?> +<?php $hierarchicalFacetSortOptions = $this->recommend->getHierarchicalFacetSortOptions() ?> +<?php if (!empty($sideFacetSet) && $results->getResultTotal() > 0): ?> + <?php foreach ($sideFacetSet as $title => $cluster): ?> + <?php + $escapedTitle = $this->escapeHtmlAttr($title); + $isOpen = !in_array($title, $collapsedFacets); + ?> + <div id="side-panel-<?=$escapedTitle?>" class="filters_filter <?=$isOpen ? '-open' : ''?>"> + <button + class="filters_title" + type="button" + aria-controls="side-collapse-<?=$escapedTitle?>" + aria-expanded="<?=$isOpen ? 'true' : 'false'?>" + > + <?=$this->transEsc($cluster['label'])?> + <?=$this->icon('small/chevron-down')?> + </button> + <div id="side-collapse-<?=$escapedTitle?>" class="facet_links -collapsed" <?=$isOpen ? '' : 'hidden'?>> + <ol> + <?=$this->context($this)->renderInContext('Recommend/SideFacets/facet.phtml', [ + 'facet' => $title, + 'cluster' => $cluster, + 'collapsedFacets' => $collapsedFacets + ])?> + </ol> + + <?php // TODO: Is there a generic way to check for non-list facets? ?> + <?php if ($cluster['label'] !== 'adv_search_year' && count($cluster['list']) > 5): ?> + <button class="facet_links-toggle -expand" type="button" onclick="theme.toggleFacets()"> + <?=$this->transEsc('Show all')?> + </button> + <button class="facet_links-toggle -collapse" type="button" onclick="theme.toggleFacets()"> + <?=$this->transEsc('Show less')?> + </button> + <?php endif; ?> + </div> + </div> + <?php endforeach; ?> +<?php endif; ?> +<!-- fid_bbi: Recommend - SideFacets - END --> diff --git a/themes/fid_bbi/templates/Recommend/SideFacets/cluster-list.phtml b/themes/fid_bbi/templates/Recommend/SideFacets/cluster-list.phtml new file mode 100644 index 0000000000000000000000000000000000000000..0c544a52dd049f7b36d05e68bacbf199f6cbc539 --- /dev/null +++ b/themes/fid_bbi/templates/Recommend/SideFacets/cluster-list.phtml @@ -0,0 +1,16 @@ +<!-- fid_bbi: Recommmend - SideFacets - cluster-list --> +<?php if (empty($this->cluster['list'])): ?> + <li class="facet"><?=$this->transEsc('facet_list_empty')?></li> +<?php else: ?> + <?php foreach ($this->cluster['list'] as $thisFacet): ?> + <?php // <li> ?> + <?=$this->render('Recommend/SideFacets/single-facet.phtml', [ + 'exclude' => $this->allowExclude, + 'facet' => $thisFacet, + 'group' => $this->title, + 'url' => $this->results->getUrlQuery(), + 'urlBase' => '', + ]) ?> + <?php endforeach; ?> +<?php endif; ?> +<!-- fid_bbi: Recommmend - SideFacets - cluster-list - END --> diff --git a/themes/fid_bbi/templates/Recommend/SideFacets/filter-list.phtml b/themes/fid_bbi/templates/Recommend/SideFacets/filter-list.phtml index b289079231b1e092e58964359ff27b7381873a98..11ab584ec70c5255b8a7a50533925831e740bbf2 100644 --- a/themes/fid_bbi/templates/Recommend/SideFacets/filter-list.phtml +++ b/themes/fid_bbi/templates/Recommend/SideFacets/filter-list.phtml @@ -1,32 +1,52 @@ <!-- fid_bbi: Recommmend - SideFacets - filter-list --> -<? /* copied from bootstrap3 template */ ?> -<div class="facet-group active-filters"> - <div class="title"><?=$this->transEsc('Remove Filters')?></div> - <? $filterLessURL = $this->currentPath() . $results->getUrlQuery()->removeAllFilters() ?> - <a class="facet" href="<?=$filterLessURL?>"><?=$this->transEsc('Remove all Filters')?></a> - <? foreach ($filterList as $field => $filters): ?> - <? foreach ($filters as $i => $filter): ?> - <? +<div class="filters_active"> + <h3><?=$this->transEsc('Active Filters')?></h3> + + <p class="facet -border-bottom"> + <a class="facet_link" href="<?=$this->currentPath() . $results->getUrlQuery()->removeAllFilters()?>"> + <?=$this->icon('small/x')?> + <?=$this->transEsc('Remove all filters')?> + </a> + </p> + + <ul> + <?php foreach ($filterList as $field => $filters): ?> + <?php foreach ($filters as $i => $filter): ?> + <?php $index = isset($filter['field']) ? array_search($filter['field'], $collapsedFacets) : false; if ($index !== false) { - unset($collapsedFacets[$index]); // Open if we have a match + unset($collapsedFacets[$index]); } - if (isset($filter['specialType']) && $filter['specialType'] == 'keyword') { - $removeLink = $this->currentPath() . $results->getUrlQuery()->replaceTerm($filter['value'], ''); + + if (isset($filter['specialType']) && $filter['specialType'] === 'keyword') { + $removeLink = $this->currentPath() + . $results->getUrlQuery()->replaceTerm($filter['value'], ''); } else { - $removeLink = $this->currentPath() . $results->getUrlQuery()->removeFacet($filter['field'], $filter['value'], $filter['operator']); + $removeLink = $this->currentPath() + . $results->getUrlQuery()->removeFacet($filter['field'], $filter['value'], $filter['operator']); } - if ($filter['displayText'] == '[* TO *]') { + + if ($filter['displayText'] === '[* TO *]') { $filter['displayText'] = $this->translate('filter_wildcard'); } - ?> - <a class="facet" href="<?=$removeLink ?>" title="<?=$this->transEsc('clear_tag_filter') ?>"> - <span class="status"><i class="fa fa-times" aria-hidden="true"></i></span> - <? if ($filter['operator'] == 'NOT'): ?><?=$this->transEsc('NOT') ?><? endif; ?> - <? if ($filter['operator'] == 'OR' && $i > 0): ?><?=$this->transEsc('OR') ?><? endif; ?> - <?=$this->transEsc($field) ?>: <?=$this->escapeHtml($filter['displayText']) ?> - </a> - <? endforeach; ?> - <? endforeach; ?> + ?> + + <li class="facet"> + <a class="facet_link" href="<?=$removeLink?>"> + <?=$this->icon('small/x')?> + <span class="sr-only"><?=$this->transEsc('clear_tag_filter')?></span> + <span> + <?php if ($filter['operator'] == 'NOT'): ?> + <?=$this->transEsc('NOT') ?> + <?php elseif ($filter['operator'] == 'OR' && $i > 0): ?> + <?=$this->transEsc('OR') ?> + <? endif; ?> + <?=$this->transEsc($field) ?>: <?=$this->escapeHtml($filter['displayText']) ?> + </span> + </a> + </li> + <?php endforeach; ?> + <?php endforeach; ?> + </ul> </div> -<!-- fid_bbi: Recommmend - SideFacets - filter-list - END --> \ No newline at end of file +<!-- fid_bbi: Recommmend - SideFacets - filter-list - END --> diff --git a/themes/fid_bbi/templates/Recommend/SideFacets/range-slider.phtml b/themes/fid_bbi/templates/Recommend/SideFacets/range-slider.phtml new file mode 100644 index 0000000000000000000000000000000000000000..a21e829ded07142a98028883a4e8e3be254d4823 --- /dev/null +++ b/themes/fid_bbi/templates/Recommend/SideFacets/range-slider.phtml @@ -0,0 +1,63 @@ +<!-- fid_bbi: Recommend - SideFacets - range-slider --> +<li class="facet"> + <form id="<?=$this->escapeHtmlAttr($this->title)?>Filter" name="<?=$this->escapeHtmlAttr($this->title)?>Filter"> + <?=$results->getUrlQuery()->asHiddenFields(['page' => "/./", 'filter' => "/^{$this->title}:.*/"])?> + <input + type="hidden" + name="<?=$this->escapeHtmlAttr($this->facet['type'])?>range[]" + value="<?=$this->escapeHtmlAttr($this->title)?>" + > + + <?php if ($this->facet['type'] === 'date'): ?> + <?php // TODO: Histogram range slider ?> + <?php endif; ?> + + <div class="filters_years"> + <?php $extraInputAttr = ($this->facet['type'] === 'date') ? 'maxlength="4"' : ''; ?> + <label> + <span class="sr-only"><?=$this->transEsc('From the year')?></span> + <input + type="number" + placeholder="1450" + min="0" + name="<?=$this->escapeHtmlAttr($this->title)?>from" + value="<?=isset($this->facet['values'][0])?$this->escapeHtmlAttr($this->facet['values'][0]):''?>" + <?=$extraInputAttr?> + > + </label> + <label> + <span style="margin-right: 14px"><?=$this->transEsc('to')?></span> + <span class="sr-only"><?=$this->transEsc('the year')?></span> + <input + type="number" + placeholder="<?=date('Y') + 1?>" + min="0" + name="<?=$this->escapeHtmlAttr($this->title)?>to" + value="<?=isset($this->facet['values'][1])?$this->escapeHtmlAttr($this->facet['values'][1]):''?>" + <?=$extraInputAttr?> + > + </label> + <button class="-icon-only" type="submit"> + <?=$this->icon('small/checkmark')?> + <span class="sr-only"><?=$this->transEsc('Set')?></span> + </button> + </div> + </form> +</li> + +<?php if ($this->facet['type'] == 'date'): ?> + <?php $this->headScript()->appendFile('vendor/bootstrap-slider.min.js'); ?> + <?php $this->headLink()->appendStylesheet('vendor/bootstrap-slider.min.css'); ?> + <?php + $min = !empty($this->facet['values'][0]) ? min($this->facet['values'][0], 1400) : 1400; + $future = date('Y', time() + 31536000); // next year + $max = !empty($this->facet['values'][1]) ? max($future, $this->facet['values'][1]) : $future; + $low = !empty($this->facet['values'][0]) ? $this->facet['values'][0] : $min; + $high = !empty($this->facet['values'][1]) ? $this->facet['values'][1] : $max; + $script = <<<JS +// TODO +JS; + ?> + <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $script, 'SET'); ?> +<?php endif; ?> +<!-- fid_bbi: Recommend - SideFacets - range-slider - END --> diff --git a/themes/fid_bbi/templates/Recommend/SideFacets/single-facet.phtml b/themes/fid_bbi/templates/Recommend/SideFacets/single-facet.phtml new file mode 100644 index 0000000000000000000000000000000000000000..1f065d626de5139d79823010240d61d389fb1fc3 --- /dev/null +++ b/themes/fid_bbi/templates/Recommend/SideFacets/single-facet.phtml @@ -0,0 +1,38 @@ +<!-- fid_bbi: Recommmend - SideFacets - single-facet --> +<?php +$group = $this->group; +$value = $this->facet['value']; +$operator = $this->facet['operator']; + +// NOTE: When "NOT" is active, the facet is hidden, so "NOT" can only be added +// here and must be removed via the "active filters" box. + +$facetUrl = $this->facet['isApplied'] + ? $this->urlBase . $this->url->removeFacet($group, $value, $operator) + : $this->urlBase . $this->url->addFacet($group, $value, $operator); + +$facetExcludeUrl = $this->facet['isApplied'] + ? $this->urlBase . $this->url->removeFacet($group, $value, $operator)->addFacet($group, $value, 'NOT') + : $this->urlBase . $this->url->addFacet($group, $value, 'NOT'); + +$text = '—'; +if (!empty($this->facet['displayText'])) { + $text = $this->escapeHtml($this->facet['displayText']); +} elseif (!empty($this->facet['value'])) { + $text = $this->escapeHtml($this->facet['value']); +} +?> + +<li class="facet"> + <a class="facet_link" href="<?=$facetUrl?>"> + <span class="sr-only"><?=$this->transEsc('Add filter:')?></span> + <span class="facet_plus <?=$this->facet['isApplied'] ? '-selected' : ''?>">+</span> + <span class="facet_text"><?=$text?></span> + <span class="facet_badge"><?=$this->localizedNumber($this->facet['count'])?></span> + </a> + <a class="facet_link" href="<?=$facetExcludeUrl?>"> + <span class="facet_minus">-</span> + <div class="tooltip"><?=$this->translate('Add filter: NOT %%text%%', ['%%text%%' => $text])?></div> + </a> +</li> +<!-- fid_bbi: Recommmend - SideFacets - single-facet - END --> diff --git a/themes/fid_bbi/templates/Recommend/TopFacets.phtml b/themes/fid_bbi/templates/Recommend/TopFacets.phtml new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/themes/fid_bbi/templates/RecordDriver/DefaultRecord/result-list.phtml b/themes/fid_bbi/templates/RecordDriver/DefaultRecord/result-list.phtml index c0ffd458e2df7e02aaa3882331943aebd751f458..6d0d5cf21e90c8f1bb760a916509443fc0a14fe4 100644 --- a/themes/fid_bbi/templates/RecordDriver/DefaultRecord/result-list.phtml +++ b/themes/fid_bbi/templates/RecordDriver/DefaultRecord/result-list.phtml @@ -1,211 +1,216 @@ -<!-- fid_bbi: recordDriver - DefaultRecord - result-list --> +<!-- fid_bbi: RecordDriver - DefaultRecord - result-list --> <?php -/* finc: compare SolrAI/result-list with this one during upgrades! - CK */ -$coverDetails = $this->record($this->driver)->getCoverDetails('result-list', 'medium', $this->recordLink()->getUrl($this->driver)); -$cover = $coverDetails['html']; -$thumbnail = false; -$thumbnailAlignment = $this->record($this->driver)->getThumbnailAlignment('result'); $account = $this->auth()->getManager(); -if ($cover): - ob_start(); ?> - <div class="media-<?=$thumbnailAlignment?> <?=$this->escapeHtmlAttr($coverDetails['size'])?>"> - <?=$cover?> - </div> - <?php $thumbnail = ob_get_contents(); ?> - <?php ob_end_clean(); ?> - <?php /* Show finc style-based icons; */ ?> -<?php elseif ($this->record($this->driver)->showStyleBasedIcons()): ?> - <?php ob_start(); ?> - <div class="media-<?=$thumbnailAlignment?> record-icon"> - <?=$this->record($this->driver)->getRecordIcon()?> - </div> - <?php $thumbnail = ob_get_contents(); ?> - <?php ob_end_clean(); ?> - <?php /* Show finc style-based icons - END */ ?> -<?php endif; ?> - -<input type="hidden" value="<?=$this->escapeHtmlAttr($this->driver->getUniqueID())?>" class="hiddenId"/> -<input type="hidden" value="<?=$this->escapeHtmlAttr($this->driver->getSourceIdentifier())?>" class="hiddenSource"/> -<div class="media"> - <?php if ($thumbnail && $thumbnailAlignment == 'left'): ?> - <?=$thumbnail?> - <?php endif ?> - <div class="media-body"> - <div class="result-body"> - <div> - <a href="<?=$this->recordLink()->getUrl($this->driver)?>" class="title getFull" data-view="<?=$this->params->getOptions()->getListViewOption()?>"> - <?=$this->record($this->driver)->getTitleHtml()?> - </a> +$format = ($this->driver->tryMethod('getFormats') ?? ['Unknown format'])[0]; +$formatIconMappingsFile = APPLICATION_PATH . '/themes/fid_bbi/format-icon-mappings.json'; +$formatIconMappings = json_decode(file_get_contents($formatIconMappingsFile), true); +?> + +<input type="hidden" value="<?=$this->escapeHtmlAttr($this->driver->getUniqueID())?>" class="hiddenId"> +<input type="hidden" value="<?=$this->escapeHtmlAttr($this->driver->getSourceIdentifier())?>" class="hiddenSource"> + +<div class="result_type"> + <?php if (!empty($formatIconMappings[$format])): ?> + <?=$this->icon("big/{$formatIconMappings[$format]}")?> + <?php endif; ?> +</div> + +<div class="result_details"> + <a + href="<?=$this->recordLink()->getUrl($this->driver)?>" + class="result_link title getFull" + data-view="<?=$this->params->getOptions()->getListViewOption()?>" + > + <h3><?=$this->record($this->driver)->getTitleHtml()?></h3> + </a> + + <!-- TODO --> + <?php $subtitle = $this->record($this->driver)->getSubTitleHtml(6); ?> + <?php if (!empty($subtitle)): ?> + <?=$subtitle?> + <?php endif; ?> + + <div class="result_author"> + <?php if ($this->driver->isCollection()): ?> + <?=implode('<br>', array_map([$this, 'escapeHtml'], $this->driver->getSummary())); ?> + <?php else: ?> + <?php $summAuthors = $this->driver->getPrimaryAuthorsWithHighlighting(); + /* #17132: display first 3 authors - GG */ + $summAuthors = array_slice($summAuthors, 0, 3); + if (!empty($summAuthors)): ?> + <?php $authorCount = count($summAuthors); + foreach ($summAuthors as $i => $summAuthor): ?> <?php - $subtitle = $this->record($this->driver)->getSubTitleHtml(6); + $authorLink = $this->record($this->driver)->getLink( + 'author', + $this->highlight($summAuthor, null, true, false) + ); ?> - <?php if (!empty($subtitle)): ?><?=$subtitle?><?php endif; ?> - </div> + <a href="<?=$authorLink?>"> + <?=$this->highlight($summAuthor)?> + </a><?=$i + 1 < $authorCount ? ',' : ''?> + <?php endforeach; ?> + <?php endif; ?> + <?php + /* finc-specific from here, #8639, #7345 - CK */ + /* finc-specific: nxt line #8639 - CK */ + ?> + <?php + $summDate = $this->driver->getPublishDateSort(); + if (!empty($summDate)): ?> + <?=!empty($summAuthor) ? '<br />' : ''?> + <?php endif; ?> + <?php $summInCollection = $this->driver->getContainingCollections(); + if (!empty($summInCollection)): ?> + <?php foreach ($summInCollection as $collId => $collText): ?> + <div> + <strong><?=$this->transEsc("in_collection_label")?></strong> + <a class="collectionLinkText" href="<?=$this->url('collection', ['id' => $collId])?>?recordID=<?=urlencode($this->driver->getUniqueID())?>"> + <?=$this->escapeHtml($collText)?> + </a> + </div> + <?php endforeach; ?> + <?php endif; ?> + <?php endif; ?> + </div> - <div> - <?php if ($this->driver->isCollection()): ?> - <?=implode('<br>', array_map([$this, 'escapeHtml'], $this->driver->getSummary())); ?> + <div class="result_media"> + <?=$this->translate($format)?> + </div> + + <div class="result_place"> + <!-- TODO --> + <?php $imprintLines = (array)$this->driver->tryMethod('getImprint'); ?> + <?php if (!empty($imprintLines)): ?> + <?=current($imprintLines)?> + <?php endif; ?> + </div> + + <div class="result_source"> + <?php $collection = $this->driver->tryMethod('getMegaCollection'); ?> + <?=empty($collection) ? '' : $collection[0]?> + </div> + + <!-- TODO: Below --> + <?php + // Display information on duplicate records if available + if ($dedupData = $this->driver->getDedupData()): ?> + <div class="dedupInformation"> + <?php $i = 0; ?> + <?php foreach ($dedupData as $source => $current): ?> + <?php $i++; ?> + <?php if ($i === 1): ?> + <span class="currentSource"> + <a href="<?=$this->recordLink()->getUrl($this->driver)?>"> + <?=$this->transEsc("source_$source", [], $source)?> + </a> + </span> <?php else: ?> - <?php $summAuthors = $this->driver->getPrimaryAuthorsWithHighlighting(); - /* #17132: display first 3 authors - GG */ - $summAuthors = array_slice($summAuthors, 0, 3); - if (!empty($summAuthors)): ?> - <?=$this->transEsc('by')?> - <?php $authorCount = count($summAuthors); - foreach ($summAuthors as $i => $summAuthor): ?> - <a href="<?=$this->record($this->driver)->getLink('author', $this->highlight($summAuthor, null, true, false))?>" class="author"><?=$this->highlight($summAuthor)?></a><?=$i + 1 < $authorCount ? ',' : ''?> - <?php endforeach; ?> + <?php if ($i === 2): ?> + <span class="otherSources">(<?=$this->transEsc('Other Sources')?>: + <?php else: ?> + , <?php endif; ?> - <?php - /* finc-specific from here, #8639, #7345 - CK */ - /* finc-specific: nxt line #8639 - CK */ ?> - <?php - $summDate = $this->driver->getPublishDateSort(); - if (!empty($summDate)): ?> - <?=!empty($summAuthor) ? '<br />' : ''?> - <?php endif; ?> - <?php $summInCollection = $this->driver->getContainingCollections(); - if (!empty($summInCollection)): ?> - <?php foreach ($summInCollection as $collId => $collText): ?> - <div> - <strong><?=$this->transEsc("in_collection_label")?></strong> - <a class="collectionLinkText" href="<?=$this->url('collection', ['id' => $collId])?>?recordID=<?=urlencode($this->driver->getUniqueID())?>"> - <?=$this->escapeHtml($collText)?> - </a> - </div> - <?php endforeach; ?> - <?php endif; ?> - <?php endif; ?> - </div> - <?php -/* Display information on duplicate records if available */ - if ($dedupData = $this->driver->getDedupData()): ?> - <div class="dedupInformation"> - <?php -$i = 0; - foreach ($dedupData as $source => $current) { - if (++$i == 1) { - ?><span class="currentSource"><a href="<?=$this->recordLink()->getUrl($this->driver)?>"><?=$this->transEsc("source_$source", [], $source)?></a></span><?php - } else { - if ($i == 2) { - ?> <span class="otherSources">(<?=$this->transEsc('Other Sources')?>: <?php - } else { - ?>, <?php - } - ?><a href="<?=$this->recordLink()->getUrl($current['id'])?>"><?=$this->transEsc("source_$source", [], $source)?></a><?php - } - } - if ($i > 1) { - ?>)</span><?php - } ?> - </div> - <?php endif; ?> - <?php if ($account->isLoggedIn()): ?> - <div class="callnumAndLocation ajax-availability hidden"> - <?php if ($this->driver->supportsAjaxStatus()): ?> - <strong class="hideIfDetailed"><?=$this->transEsc('Call Number')?>:</strong> - <span class="callnumber ajax-availability hidden"> - <?=$this->transEsc('Loading')?> ...<br/> - </span> - <strong><?=$this->transEsc('Located')?>:</strong> - <span class="location ajax-availability hidden"> - <?=$this->transEsc('Loading')?> ... - </span> - <div class="locationDetails"></div> - <?php else: ?> - <?php $summCallNo = $this->driver->getCallNumber(); - if (!empty($summCallNo)): ?> - <strong><?=$this->transEsc('Call Number')?>:</strong> <?=$this->escapeHtml($summCallNo)?> + <a href="<?=$this->recordLink()->getUrl($current['id'])?>"> + <?=$this->transEsc("source_$source", [], $source)?> + </a> + + <?php if ($i > 1): ?> + )</span> <?php endif; ?> <?php endif; ?> - </div> - <?php endif; ?> - <?php /* imprint data, #15206, DM - this reverts parts of #16555, cf. #17291 - */ - $imprintLines = (array) $this->driver->tryMethod('getImprint'); - if (!empty($imprintLines)): - ?> - <!-- imprint --> - <div class="result-imprint"> - <?=current($imprintLines)?> - </div> - <!-- imprint - END --> - <?php endif; ?> - <div class="result-formats"> - <?/*=$this->record($this->driver)->getFormatList()*/?> + <?php endforeach; ?> + </div> + <?php endif; ?> - <?php /* nxt line finc-specific: #5737 removed '(!$openUrlActive && empty($urls) &&' - CK */ ?> - <?php if ($this->driver->supportsAjaxStatus() && $account->isLoggedIn()): ?> - <span class="status ajax-availability hidden"> - <span class="label label-default"><?=$this->transEsc('Loading')?> ...</span> + <?php // TODO: Should we keep this? ?> + <?php if ($account->isLoggedIn()): ?> + <div class="callnumAndLocation ajax-availability hidden"> + <?php if ($this->driver->supportsAjaxStatus()): ?> + <strong class="hideIfDetailed"><?=$this->transEsc('Call Number')?>:</strong> + <span class="callnumber ajax-availability hidden"> + <?=$this->transEsc('Loading')?> ...<br/> + </span> + <strong><?=$this->transEsc('Located')?>:</strong> + <span class="location ajax-availability hidden"> + <?=$this->transEsc('Loading')?> ... </span> + <div class="locationDetails"></div> + <?php else: ?> + <?php $summCallNo = $this->driver->getCallNumber(); + if (!empty($summCallNo)): ?> + <strong><?=$this->transEsc('Call Number')?>:</strong> <?=$this->escapeHtml($summCallNo)?> <?php endif; ?> - </div> - <div class="result-formats"> - <?php - $formats = $this->driver->tryMethod('getFormats'); - if (!empty($formats)): ?> - <div class="left"><?=$this->translate($formats[0])?></div> - <?php endif; ?> - - <?php /* fid_bbi: Collection info moved from here to record-links section below - CK */ ?> - <?php /* - $collection = $this->driver->tryMethod('getMegaCollection'); - if (!empty($collection)): ?> - <div class="right"><?=$collection[0]?></div> - <?php endif; */?> - </div> + <?php endif; ?> </div> - <div class="result-links hidden-print"> - <?php if ($this->cart()->isActiveInSearch() && $this->params->getOptions()->supportsCart() && $this->cart()->isActive()): ?> - <?=$this->render('record/cart-buttons.phtml', ['id' => $this->driver->getUniqueId(), 'source' => $this->driver->getSourceIdentifier()]);?><br/> + <div class="result-formats"> + <?php if ($this->driver->supportsAjaxStatus()): ?> + <span class="status ajax-availability hidden"> + <span class="label label-default"><?=$this->transEsc('Loading')?> ...</span> + </span> <?php endif; ?> + </div> + <?php endif; ?> +</div> - <?php if ($this->userlist()->getMode() !== 'disabled'): ?> - <?php if ($this->permission()->allowDisplay('feature.Favorites')): ?> - <?php /* Add to favorites; finc: keep Icon inside link - CK */ ?> - <a href="<?=$this->recordLink()->getActionUrl($this->driver, 'Save')?>" data-lightbox class="save-record result-link-label" data-id="<?=$this->escapeHtmlAttr($this->driver->getUniqueId())?>" title="<?=$this->transEsc('Add to favorites')?>"> - <i id="fav-icon<?=$this->driver->getUniqueId()?>" class="fa fa-fw fa-star fa-2x" aria-hidden="true"></i> <span class="sr-only"><?=$this->transEsc('Add to favorites')?></span> - </a><br/> - <?php elseif ($block = $this->permission()->getAlternateContent('feature.Favorites')): ?> - <?=$block?> - <?php endif; ?> - <?php /*Saved lists ?> - <div class="savedLists alert alert-info hidden"> - <strong><?=$this->transEsc("Saved in")?>:</strong> - </div>*/?> - <?php endif; ?> +<div class="result_actions"> + <?php + $isCartActive = $this->cart()->isActiveInSearch() + && $this->params->getOptions()->supportsCart() + && $this->cart()->isActive(); + ?> + <?php if ($isCartActive): ?> + <?=$this->render( + 'record/cart-buttons.phtml', + ['id' => $this->driver->getUniqueId(), 'source' => $this->driver->getSourceIdentifier()] + );?> + <?php endif; ?> - <?php /* Hierarchy tree link; finc: keep Icon inside link - CK */ ?> - <?php $trees = $this->driver->tryMethod('getHierarchyTrees'); - if (!empty($trees)): ?> - <?php foreach ($trees as $hierarchyID => $hierarchyTitle): ?> - <div class="hierarchyTreeLink hidden"> - <input type="hidden" value="<?=$this->escapeHtmlAttr($hierarchyID)?>" class="hiddenHierarchyId"/> - <a class="hierarchyTreeLinkText result-link-label" data-lightbox href="<?=$this->recordLink()->getTabUrl($this->driver, 'HierarchyTree')?>?hierarchy=<?=urlencode($hierarchyID)?>#tabnav" title="<?=$this->transEsc('hierarchy_tree')?>" data-lightbox-href="<?=$this->recordLink()->getTabUrl($this->driver, 'AjaxTab')?>?hierarchy=<?=urlencode($hierarchyID)?>" data-lightbox-post="tab=hierarchytree"> - <i class="result-link-icon fa fa-fw fa-sitemap fa-2x" aria-hidden="true"></i> - <span class="sr-only"><?=$this->transEsc('hierarchy_view_context')?></span><?php if (count($trees) > 1): ?>: <?=$this->escapeHtml($hierarchyTitle)?><?php endif; ?> - </a> - </div> - <?php endforeach; ?> - <?php endif; ?> + <?php if ($this->userlist()->getMode() !== 'disabled'): ?> + <?php if ($this->permission()->allowDisplay('feature.Favorites')): ?> + <a + href="<?=$this->recordLink()->getActionUrl($this->driver, 'Save')?>" + data-lightbox + class="save-record result-link-label" + data-id="<?=$this->escapeHtmlAttr($this->driver->getUniqueId())?>" + title="<?=$this->transEsc('Add to favorites')?>" + > + <?=$this->icon('small/star')?> + <div class="tooltip"> + <?=$this->transEsc('Add to favorites')?> + </div> + </a> + <?php elseif ($block = $this->permission()->getAlternateContent('feature.Favorites')): ?> + <?=$block?> + <?php endif; ?> + <?php endif; ?> - <?=$this->driver->supportsCoinsOpenUrl() ? '<span class="Z3988" title="' . $this->escapeHtmlAttr($this->driver->getCoinsOpenUrl()) . '"></span>' : ''?> - </div> - <?php /* fid_bbi: Collection info moved here - CK */ ?> - <div class="collection-details"> - <?php - $collection = $this->driver->tryMethod('getMegaCollection'); - if (!empty($collection)): ?> - <?=$collection[0]?> - <?php endif; ?> - </div> - <?php /* fid_bbi: Collection info moved here - END */ ?> - </div> - <?php if ($thumbnail && $thumbnailAlignment == 'right'): ?> - <?=$thumbnail?> - <?php endif ?> + <?php /* Hierarchy tree link; finc: keep Icon inside link - CK */ ?> + <?php $trees = $this->driver->tryMethod('getHierarchyTrees'); + if (!empty($trees)): ?> + <?php foreach ($trees as $hierarchyID => $hierarchyTitle): ?> + <div class="hierarchyTreeLink hidden"> + <input type="hidden" value="<?=$this->escapeHtmlAttr($hierarchyID)?>" class="hiddenHierarchyId"/> + <a + class="hierarchyTreeLinkText result-link-label" + data-lightbox href="<?=$this->recordLink()->getTabUrl($this->driver, 'HierarchyTree')?>?hierarchy=<?=urlencode($hierarchyID)?>#tabnav" + title="<?=$this->transEsc('hierarchy_tree')?>" + data-lightbox-href="<?=$this->recordLink()->getTabUrl($this->driver, 'AjaxTab')?>?hierarchy=<?=urlencode($hierarchyID)?>" + data-lightbox-post="tab=hierarchytree" + > + <i class="result-link-icon fa fa-fw fa-sitemap fa-2x" aria-hidden="true"></i> + <span class="sr-only"> + <?=$this->transEsc('hierarchy_view_context')?> + </span><?php if (count($trees) > 1): ?>: <?=$this->escapeHtml($hierarchyTitle)?><?php endif; ?> + </a> + </div> + <?php endforeach; ?> + <?php endif; ?> + + <?php // TODO: Should we keep this? ?> + <?php if ($this->driver->supportsCoinsOpenUrl()): ?> + <span class="Z3988" title="<?=$this->escapeHtmlAttr($this->driver->getCoinsOpenUrl())?>"></span> + <?php endif; ?> </div> -<!-- fid_bbi: recordDriver - DefaultRecord - result-list - END --> +<!-- fid_bbi: RecordDriver - DefaultRecord - result-list - END --> diff --git a/themes/fid_bbi/templates/header.phtml b/themes/fid_bbi/templates/header.phtml index e6d78e4a4e42ce69e79cc8735f3f6e9c08b998b5..01b86ceb413af76ebd874f20de19afa3c7e766cd 100644 --- a/themes/fid_bbi/templates/header.phtml +++ b/themes/fid_bbi/templates/header.phtml @@ -1,55 +1,86 @@ <!-- fid_bbi: header --> <header class="header"> <div class="header_main"> - <h1> + <?php + // NOTE: These strings are hardcoded because they mirror the logo, + // which is language-independent + ?> + <?php if ($this->templateName === 'home'): ?> + <h1> + <a class="header_logo" href="<?=$this->url('home')?>"> + <?=$this->icon('../images/fid-bbi-logo', '')?> + <span class="sr-only">FID BBI -</span> + <span class="header_logo-overlay"> + Fachinformationsdienst <br> + Buch-, Bibliotheks- und <br> + <span style="margin-left: 1px">Informationswissenschaft</span> + </span> + </a> + </h1> + <?php else: ?> <a class="header_logo" href="<?=$this->url('home')?>"> <?=$this->icon('../images/fid-bbi-logo', '')?> - <?php - // NOTE: These strings are hardcoded because they mirror the logo, - // which is language-independent - ?> - <span class="sr-only">FID BBI -</span> - <span class="header_logo-overlay"> - Fachinformationsdienst <br> - Buch-, Bibliotheks- und <br> - <span style="margin-left: 1px">Informationswissenschaft</span> - </span> + <span class="sr-only">FID BBI</span> </a> - </h1> + <?php endif; ?> <div class="header_nav"> <?=$this->render('nav.phtml')?> <div class="box -header"> - <div class="search"> - <?=$this->layout()->searchbox?> + <div id="search" class="search"> + <?php if ($this->templateName === 'home'): ?> + <?=$this->layout()->searchbox?> - <div class="search_links"> - <ul> - <li> - <a class="link-with-icon" href="<?=$this->url('search-sources')?>"> - <?=$this->icon('small/arrow-right')?> - <?=$this->transEsc('Data Collection')?> - </a> - </li> - <li> - <?php - $newReleasesUrl = $this->url('search-results') - . $this->config()->get('config')->RawQueries['new_releases']; - ?> - <a class="link-with-icon" href="<?=$newReleasesUrl?>"> - <?=$this->icon('small/arrow-right')?> - <?=$this->transEsc('New Publications')?> - </a> - </li> - <li> - <a class="link-with-icon" href="<?=$this->url('search-advanced')?>"> - <?=$this->icon('small/arrow-right')?> - <?=$this->transEsc("Advanced Search")?> - </a> - </li> - </ul> - </div> + <div class="search_links"> + <ul> + <li> + <a class="link-with-icon" href="<?=$this->url('search-sources')?>"> + <?=$this->icon('small/arrow-right')?> + <?=$this->transEsc('Data Collection')?> + </a> + </li> + <li> + <?php + $newReleasesUrl = $this->url('search-results') + . $this->config()->get('config')->RawQueries['new_releases']; + ?> + <a class="link-with-icon" href="<?=$newReleasesUrl?>"> + <?=$this->icon('small/arrow-right')?> + <?=$this->transEsc('New Publications')?> + </a> + </li> + <li> + <a class="link-with-icon" href="<?=$this->url('search-advanced')?>"> + <?=$this->icon('small/arrow-right')?> + <?=$this->transEsc('Advanced Search')?> + </a> + </li> + </ul> + </div> + <?php else: ?> + <div class="search_header"> + <h2><?=$this->transEsc("Search")?></h2> + <!-- TODO: Add JS for button --> + <button + class="-icon-only -small" + type="button" + aria-controls="search" + aria-label="<?=$this->transEsc('Close search')?>" + > + <?=$this->icon('small/x')?> + <span class="sr-only"><?=$this->transEsc('Close')?>"</span> + </button> + </div> + + <?=$this->layout()->searchbox?> + + <div class="search_menu"> + <a href="<?=$this->url('search-advanced')?>"> + <?=$this->transEsc('Advanced Search')?> + </a> + </div> + <?php endif; ?> </div> </div> </div> diff --git a/themes/fid_bbi/templates/html-head.phtml b/themes/fid_bbi/templates/html-head.phtml index e9a76f1c7f0b9007c9718ae24bb07b53d9481424..46ccbaeec5c9e4cea0fdb976c2945d1d57821962 100644 --- a/themes/fid_bbi/templates/html-head.phtml +++ b/themes/fid_bbi/templates/html-head.phtml @@ -1,6 +1,6 @@ <?=$this->doctype('HTML5')?> +<?php // NOTE: There must not be a comment before the DOCTYPE declaration ?> -<?php // NOTE: There cannot be a comment before the doctype declaration ?> <!-- fid_bbi: html-head --> <html lang="<?=$this->layout()->userLang?>"> <head> @@ -33,10 +33,6 @@ <?=$this->headLink()?> - <?php // TODO: Reenable styles? ?> - <?php /* <?=$this->headStyle()?> */ ?> - <link rel="stylesheet" href="/themes/fid_bbi/css/compiled.css"> - <?php if (!isset($this->renderingError)) { // Add translation strings diff --git a/themes/fid_bbi/templates/layout/layout.phtml b/themes/fid_bbi/templates/layout/layout.phtml index ad0c37a3d03beb6be18687b087c35e2d634ece1d..67bef23384f760b393b1678f32cfaab5f2de6175 100644 --- a/themes/fid_bbi/templates/layout/layout.phtml +++ b/themes/fid_bbi/templates/layout/layout.phtml @@ -1,7 +1,8 @@ <?=$this->render('html-head.phtml')?> +<?php // NOTE: There must not be anything above html-head.phtml, not even comments or whitespace ?> <!-- fid_bbi: layout - layout --> -<body class="layout -<?=$this->templateName?> <?=$this->layout()->rtl ? '-rtl' : ''?>"> +<body class="layout <?=$this->templateName === 'home' ? '-home' : '-default'?>"> <?php // Set up the search box -- there are three possible cases: // 1. No search box was set; we should default to the normal box diff --git a/themes/fid_bbi/templates/nav.phtml b/themes/fid_bbi/templates/nav.phtml index 15448db69df3b72437a123ff1f49266367c1f90f..dfcd27b8760b27605f50b29f1260b0e24ca4f79f 100644 --- a/themes/fid_bbi/templates/nav.phtml +++ b/themes/fid_bbi/templates/nav.phtml @@ -3,7 +3,7 @@ <button class="nav_toggle -search" type="button" - aria-controls="searchForm" + aria-controls="search" aria-label="<?=$this->transEsc('Open search')?>" > <?=$this->icon('small/magnifier')?> diff --git a/themes/fid_bbi/templates/record/cart-buttons.phtml b/themes/fid_bbi/templates/record/cart-buttons.phtml index 6fb77eef70197f1f446bb9defabe86dbbcdff540..53a18cebf59fb708476802cc26876f33dde7e289 100644 --- a/themes/fid_bbi/templates/record/cart-buttons.phtml +++ b/themes/fid_bbi/templates/record/cart-buttons.phtml @@ -1,25 +1,24 @@ <!-- fid_bbi: record - cart-buttons --> <?php $cart = $this->cart(); ?> <?php if ($cart->isActive()): ?> - - <?php $cartId = $this->source . '|' . $this->id; ?> - <span class="btn-bookbag-toggle" data-cart-id="<?=$this->escapeHtmlAttr($this->id)?>" data-cart-source="<?=$this->escapeHtmlAttr($this->source)?>"> - <a class="cart-add hidden<?php if (!$cart->contains($cartId)): ?> correct<?php endif ?>"> - <i class="cart-link-icon fa fa-thumb-tack" aria-hidden="true" title="<?=$this->transEsc('Add to Book Bag')?>"></i><span class="cart-link-label"><?=$this->transEsc('Add to Book Bag')?></span> + <?php $cartId = $this->source . '|' . $this->id; ?> + <span + class="btn-bookbag-toggle" + data-cart-id="<?=$this->escapeHtmlAttr($this->id)?>" + data-cart-source="<?=$this->escapeHtmlAttr($this->source)?>" + > + <a class="cart-add hidden<?php if (!$cart->contains($cartId)): ?> correct<?php endif ?>" href="javascript:;"> + <?=$this->icon('small/pin')?> + <div class="tooltip"> + <?=$this->transEsc('Add to Book Bag')?> + </div> </a> - <a class="cart-remove hidden<?php if ($cart->contains($cartId)): ?> correct<?php endif ?>"> - <i class="cart-link-icon fa fa-thumb-tack in-bookbag" aria-hidden="true" title="<?=$this->transEsc('Remove from Book Bag')?>"></i> <span class="cart-link-label"><?=$this->transEsc('Remove from Book Bag')?></span> + <a class="cart-remove hidden<?php if ($cart->contains($cartId)): ?> correct<?php endif ?>" href="javascript:;"> + <?=$this->icon('small/pin')?> + <div class="tooltip"> + <?=$this->transEsc('Remove from Book Bag')?> + </div> </a> - <noscript> - <form method="post" name="addForm" action="<?=$this->url('cart-processor')?>"> - <input type="hidden" name="ids[]" value="<?=$this->escapeHtmlAttr($cartId)?>"/> - <?php if ($cart->contains($cartId)): ?> - <input class="btn btn-default" type="submit" name="delete" value="<?=$this->transEsc('Remove from Book Bag')?>"/> - <?php else: ?> - <input class="btn btn-default" type="submit" name="add" value="<?=$this->transEsc('Add to Book Bag')?>"/> - <?php endif; ?> - </form> - </noscript> </span> <?php endif; ?> <!-- fid_bbi: record - cart-buttons END --> diff --git a/themes/fid_bbi/templates/search/controls/showing.phtml b/themes/fid_bbi/templates/search/controls/showing.phtml deleted file mode 100644 index f4e67f06598b84a047fe3e7059da30afa3f0a456..0000000000000000000000000000000000000000 --- a/themes/fid_bbi/templates/search/controls/showing.phtml +++ /dev/null @@ -1,30 +0,0 @@ -<!-- fid_bbi: search - controls - showing --> -<?php - $transParams = [ - '%%start%%' => $this->localizedNumber($this->results->getStartRecord()), - '%%end%%' => $this->localizedNumber($this->results->getEndRecord()), - '%%total%%' => $this->localizedNumber($this->recordTotal), - '%%lookfor%%' => $this->escapeHtml($this->lookfor) - ]; -?> -<?php if (!isset($this->skipTotalCount)): ?> - <?php $showingResults = $this->translate('showing_results_of_html', $transParams); ?> -<?php else: ?> - <?php $showingResults = $this->translate('showing_results_html', $transParams); ?> -<?php endif; ?> -<?php if (isset($this->overrideSearchHeading)): ?> - <?php $showingResults .= ' ' . $this->overrideSearchHeading; ?> -<?php elseif ($this->params->getSearchType() == 'basic'): ?> - <?php if (!isset($this->skipTotalCount)): ?> - <?php $showingResults = $this->translate('showing_results_of_for_html', $transParams); ?> - <?php else: ?> - <?php $showingResults = $this->translate('showing_results_for_html', $transParams); ?> - <?php endif; ?> -<?php endif; ?> -<?php $this->layout()->srmessage = $showingResults; ?> -<?php if ($qtime = $this->results->getQuerySpeed()): ?> - <?=$showingResults; ?> -<?php else: ?> - <?=$showingResults; ?> -<?php endif; ?> -<!-- fid_bbi: search - controls - showing - END --> diff --git a/themes/fid_bbi/templates/search/controls/sort.phtml b/themes/fid_bbi/templates/search/controls/sort.phtml new file mode 100644 index 0000000000000000000000000000000000000000..4ac1be9b25eb07ebafe3421feeabe35b23911361 --- /dev/null +++ b/themes/fid_bbi/templates/search/controls/sort.phtml @@ -0,0 +1,20 @@ +<!-- fid_bbi: search - controls - sort --> +<?php $list = $this->params->getSortList(); ?> +<?php if (!empty($list)): ?> + <?php // NOTE: JS requires the classes "search-sort" and "jumpMenu", and <select> to be a child of <form> ?> + <form action="<?=$this->currentPath()?>" class="results_sort search-sort" method="get" name="sort"> + <?=$this->results->getUrlQuery()->asHiddenFields(['sort' => '/.*/']);?> + <label for="sort_options_1"> + <?=$this->transEsc('Sorted by')?> + </label> + <select id="sort_options_1" name="sort" class="jumpMenu -inline"> + <?php foreach ($list as $sortType => $sortData): ?> + <option value="<?=$this->escapeHtmlAttr($sortType)?>" <?=$sortData['selected'] ? ' selected' : '' ?>> + <?=$this->transEsc($sortData['desc'])?> + </option> + <?php endforeach; ?> + </select> + <noscript><input type="submit" class="btn btn-primary" value="<?=$this->transEsc("Set")?>" /></noscript> + </form> +<?php endif; ?> +<!-- fid_bbi: search - controls - sort - END --> diff --git a/themes/fid_bbi/templates/search/home.phtml b/themes/fid_bbi/templates/search/home.phtml index 6fe6f3dc275525a10ba0debe826796bef7d99ced..e9938c8016196ec628b6f07dbe06df1d2815edf9 100644 --- a/themes/fid_bbi/templates/search/home.phtml +++ b/themes/fid_bbi/templates/search/home.phtml @@ -1,5 +1,4 @@ <!-- fid_bbi: search - home --> - <?php $this->headTitle($this->transEsc('LibraryName')); $this->layout()->breadcrumbs = false; @@ -22,7 +21,7 @@ $this->layout()->breadcrumbs = false; <?php foreach ($posts as $post): ?> <article class="post"> <header class="post_header"> - <a class="post_link" href="#CHANGE"> + <a class="post_link" href="#TODO"> <h3 class="post_title"><?=$post->title?></h3> <time class="post_date"><?=$post->date?></time> </a> @@ -79,6 +78,7 @@ $this->layout()->breadcrumbs = false; </div> <?php +// TODO: Is this still used? // finc-specific: #7187@89bb6e70; VF moved the original BS code to a separate template: helpers - ils-offline.phtml - CK $ilsStatusScript = <<<JS $(document).ready(function() { @@ -95,5 +95,4 @@ $ilsStatusScript = <<<JS JS; ?> <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $ilsStatusScript, 'SET')?> - <!-- fid_bbi: search - home - END --> diff --git a/themes/fid_bbi/templates/search/list-list.phtml b/themes/fid_bbi/templates/search/list-list.phtml index b5b87b28afd1ce0fd64d3e672bb9453a58126270..6a90306f783718fd2ac35a5c3c13c179cfa0b056 100644 --- a/themes/fid_bbi/templates/search/list-list.phtml +++ b/themes/fid_bbi/templates/search/list-list.phtml @@ -1,20 +1,27 @@ <!-- fid_bbi: search - list-list --> -<?php if (!isset($this->indexStart)) $this->indexStart = 0; ?> -<?php $i = $this->indexStart; ?> +<?php +if (!isset($this->indexStart)) { + $this->indexStart = 0; +} + +$i = $this->indexStart; +?> + <?php foreach ($this->results->getResults() as $current): ?> - <?php $recordNumber = $this->results->getStartRecord() + $i - $this->indexStart; ?> + <?php $i++; ?> + + <div id="result<?=$i?>" class="result <?=$current->supportsAjaxStatus() ? 'ajaxItem': ''?>"> + <?php // TODO: Remove? ?> + <?php $recordNumber = $this->results->getStartRecord() + $i - $this->indexStart; ?> <span id="jump<?=$recordNumber?>"></span> - <div id="result<?=$i++ ?>" class="result<?=$current->supportsAjaxStatus()?' ajaxItem':''?>"> + <?php if (isset($this->showCheckboxes) && $this->showCheckboxes): ?> <?=$this->record($current)->getCheckbox('', 'search-cart-form', $recordNumber)?> <?php endif; ?> - <?php /* fid_bbi: remove record number refs #14813- GG */ ?> - <?php /* ?> - <div class="record-number"> - <?=$recordNumber ?> - </div> - <?php */ ?> + <?=$this->record($current)->getSearchResult('list')?> </div> + + <?php $i++; ?> <?php endforeach; ?> <!-- fid_bbi: search - list-list - END --> diff --git a/themes/fid_bbi/templates/search/pagination.phtml b/themes/fid_bbi/templates/search/pagination.phtml new file mode 100644 index 0000000000000000000000000000000000000000..0765ecc8bfb66abd857a67e94b19e5301521803f --- /dev/null +++ b/themes/fid_bbi/templates/search/pagination.phtml @@ -0,0 +1,40 @@ +<!-- fid_bbi: search - pagination --> +<?php if ($this->pageCount): ?> + <div class="pagination"> + <div class="pagination_control"> + <?php if (isset($this->previous)): ?> + <a + class="pagination_link -previous" + href="<?=$this->currentPath() . $this->results->getUrlQuery()->setPage($this->previous)?>" + > + <?=$this->icon('small/arrow-left')?> + <span class="pagination_link-label"> + <?=$this->translate('Previous')?> + </span> + </a> + <?php endif; ?> + </div> + + <div class="pagination_page"> + <?=$this->translate('Page %%current%% of %%total%%', [ + '%%current%%' => $this->current, + '%%total%%' => $this->pageCount, + ])?> + </div> + + <div class="pagination_control"> + <?php if (isset($this->next)): ?> + <a + class="pagination_link -next" + href="<?=$this->currentPath() . $this->results->getUrlQuery()->setPage($this->next)?>" + > + <span class="pagination_link-label"> + <?=$this->translate('Next')?> + </span> + <?=$this->icon('small/arrow-right')?> + </a> + <?php endif; ?> + </div> + </div> +<?php endif; ?> +<!-- fid_bbi: search - pagination - END --> diff --git a/themes/fid_bbi/templates/search/results.phtml b/themes/fid_bbi/templates/search/results.phtml index dc01313e1815ba4056a7d8dd5763ec9e75fab967..a3cf70763408bb9989a169f2a01bbb825fbe9bd0 100644 --- a/themes/fid_bbi/templates/search/results.phtml +++ b/themes/fid_bbi/templates/search/results.phtml @@ -1,169 +1,206 @@ <!-- fid_bbi: search - results --> <?php -// overrides template in finc theme -// Set up page title: $lookfor = $this->results->getUrlQuery()->isQuerySuppressed() ? '' : $this->params->getDisplayQuery(); +$recordTotal = $this->results->getResultTotal(); + if (isset($this->overrideTitle)) { - $this->headTitle($this->overrideTitle); + $title = $this->overrideTitle; +} elseif (empty($lookfor)) { + $title = $this->transEsc('Search'); } else { - $this->headTitle($this->translate('Search Results') . (empty($lookfor) ? '' : " - {$lookfor}")); + $title = $this->transEsc('Search: %%lookfor%%', ['%%lookfor%%' => $lookfor]); } -// Set up search box: +$this->headTitle($title); + $this->layout()->searchbox = $this->context($this)->renderInContext( 'search/searchbox.phtml', - [ - 'lookfor' => $lookfor, - 'searchIndex' => $this->params->getSearchHandler(), - 'searchType' => $this->params->getSearchType(), - 'searchId' => $this->results->getSearchId(), - 'searchClassId' => $this->params->getSearchClassId(), - 'checkboxFilters' => $this->params->getCheckboxFacets(), - 'filterList' => $this->params->getFilters(), - 'hasDefaultsApplied' => $this->params->hasDefaultsApplied(), - 'selectedShards' => $this->params->getSelectedShards(), - 'ignoreHiddenFiltersInRequest' => isset($this->ignoreHiddenFiltersInRequest) ? $this->ignoreHiddenFiltersInRequest : false, - 'ignoreHiddenFilterMemory' => isset($this->ignoreHiddenFilterMemory) ? $this->ignoreHiddenFilterMemory : false, - ] + ['lookfor' => $lookfor] ); -// Set up breadcrumbs: -if (isset($this->overrideTitle)) { - $this->layout()->breadcrumbs .= '<li class="active">' . $this->escapeHtml($this->overrideTitle) . '</li>'; -} else { - $this->layout()->breadcrumbs .= '<li class="active">' . $this->transEsc('Search') . ': ' . $this->escapeHtml($lookfor) . '</li>'; -} - -// Enable cart if appropriate: +// Enable cart if appropriate $this->showBulkOptions = $this->params->getOptions()->supportsCart() && $this->showBulkOptions; -// Checkboxes if appropriate: + +// Checkboxes if appropriate $this->showCartControls = $this->params->getOptions()->supportsCart() && $this->cart()->isActive() && ($this->showBulkOptions || !$this->cart()->isActiveInSearch()); -// Enable bulk options if appropriate: + +// Enable bulk options if appropriate $this->showCheckboxes = $this->showCartControls || $this->showBulkOptions; -// Load Javascript only if list view parameter is NOT full: -if ($this->params->getOptions()->getListViewOption() != "full") { +// Load scripts required for sticky actions/filter sidebar +$this->headScript()->appendFile('../images/vendor/css-element-queries/src/ResizeSensor.js'); +$this->headScript()->appendFile('../images/vendor/sticky-sidebar/dist/sticky-sidebar.min.js'); + +// TODO: Are we still using those? +if ($this->params->getOptions()->getListViewOption() !== 'full') { $this->headScript()->appendFile("record.js"); $this->headScript()->appendFile("embedded_record.js"); } -// Load Javascript dependencies into header: +// TODO: Are we still using those? +// Load Javascript dependencies into header $this->headScript()->appendFile("vendor/hunt.min.js"); $this->headScript()->appendFile("check_item_statuses.js"); $this->headScript()->appendFile("check_save_statuses.js"); -$recordTotal = $this->results->getResultTotal(); ?> -<?php /* finc: we need search-results-col to pull content to full width, also used in print styles! - CK */ ?> -<div class="<?=$this->layoutClass('mainbody')?> search-results-col"> - <?php if (($recordTotal = $this->results->getResultTotal()) > 0): // only display these at very top if we have results ?> - <?php /* fid_bbi: Searchtools to be shown at the top - CK */ ?> - <div class="searchtools hidden-print"> - <strong><?=$this->transEsc('Search Tools')?>:</strong> - <a href="<?=$this->results->getUrlQuery()->setViewParam('rss')?>"><i class="fa fa-rss" aria-hidden="true"></i> <?=$this->transEsc('Get RSS Feed')?></a> - <span class="hidden-sm hidden-xs">—</span> - <a href="<?=$this->url('search-email')?>" class="mailSearch" data-lightbox id="mailSearch<?=$this->escapeHtmlAttr($this->results->getSearchId())?>"> - <i class="fa fa-envelope" aria-hidden="true"></i> <?=$this->transEsc('Email this Search')?> - </a> - <?php if ($this->accountCapabilities()->getSavedSearchSetting() === 'enabled'): ?> - <span class="hidden-sm hidden-xs">—</span> - <?php if (is_numeric($this->results->getSearchId())): ?> - <?php if ($this->results->isSavedSearch()): ?> - <a href="<?=$this->url('myresearch-savesearch')?>?delete=<?=urlencode($this->results->getSearchId())?>"><i class="fa fa-remove" - aria-hidden="true"></i> <?=$this->transEsc('save_search_remove')?></a> - <?php else: ?> - <a href="<?=$this->url('myresearch-savesearch')?>?save=<?=urlencode($this->results->getSearchId())?>"><i class="fa fa-save" aria-hidden="true"></i> <?=$this->transEsc('save_search')?></a> - <?php endif; ?> - <?php endif; ?> - <?php endif; ?> +<div class="results" id="sidebar-container"> + <h1 class="sr-only"><?=$this->transEsc('Search Results')?></h1> + + <button + class="results_sidebar-toggle" + type="button" + aria-controls="sidebar" + aria-label="<?=$this->transEsc('Show functions & filters')?>" + > + <?=$this->icon('small/filter')?> + <span><?=$this->transEsc('Functions & Filters')?></span> + </button> + + <div class="results_list"> + <h2 class="sr-only"><?=$this->translate('Search Results')?></h2> + + <?=$this->flashmessages()?> + + <div class="results_header"> + <div class="results_count"> + <?=$this->translate('%%count%% results', ['%%count%%' => $this->localizedNumber($recordTotal)])?> + </div> + + <?=$this->render('search/controls/sort.phtml')?> </div> - <?php /* fid_bbi: Searchtools to be shown at the top - END */ ?> - <?php endif; ?> - <?php if ($recordTotal > 0): // only display these at very top if we have results ?> - <?php foreach ($this->results->getRecommendations('top') as $index => $current): ?> - <?=$this->recommend($current, 'top', $index)?> - <?php endforeach; ?> - <?php endif; ?> - <?=$this->flashmessages()?> - <?php /* finc: remove 'hidden' below to show search-stats; we also hide the entire bar on xs + sm - CK */ ?> - <nav class="search-header hidden-print"> - <div class="search-stats"> - <?php /* finc: use spans for easier to show/hide choices - CK */ ?> - <?php if ($recordTotal > 0): ?> - <span class="hit-stats hidden-xs hidden-sm"> - <?=$this->context()->renderInContext('search/controls/showing.phtml', ['lookfor' => $lookfor, 'recordTotal' => $recordTotal])?> - </span> - <span class="offcanvas-toogler"> - <button class="search-filter-toggle btn btn-primary visible-xs" href="#search-sidebar" data-toggle="offcanvas" title="<?=$this->transEsc('sidebar_expand')?>"> - <?=$this->transEsc('Refine Results')?> - </button> - </span> - <?php else: ?> - <h2><?=$this->transEsc('nohit_heading')?></h2> + + <?php if (!$recordTotal): ?> + <p> + <?php if (isset($this->overrideEmptyMessage)): ?> + <?=$this->overrideEmptyMessage?> + <?php else: ?> + <?php $this->layout()->srmessage = $this->translate('nohit_lookfor_html', ['%%lookfor%%' => $this->escapeHtml($lookfor)]); ?> + <?=$this->layout()->srmessage?> + <?php endif; ?> + </p> + + <?php if (isset($this->parseError)): ?> + <p class="alert alert-danger"><?=$this->transEsc('nohit_parse_error')?></p> <?php endif; ?> - </div> - <?php if ($recordTotal > 0): ?> - <?php /* finc: use spans for easier to show/hide choices - CK */ ?> - <div class="search-controls"> - <span class="limit"> - <?=$this->render('search/controls/limit.phtml')?> - </span> - <?php /* fid_bbi: top pagination - CK */ ?> - <span class="pagination-short"> - <? $paginator = $this->results->getPaginator(); - $paginator->setPageRange(5); ?> - <?=$this->paginationControl($paginator, 'Sliding', 'search/pagination.phtml', ['results' => $this->results, 'options' => isset($this->paginationOptions) ? $this->paginationOptions : []])?> - </span> - <?php /* fid_bbi: top pagination - END */ ?> - <span class="sort right"> - <?=$this->render('search/controls/sort.phtml')?> - </span> - <span class="view"> - <?=$this->render('search/controls/view.phtml')?> - </span> - </div> - <?php endif; ?> - </nav> - <?php /* End Listing Options */ ?> - - <?php if ($recordTotal < 1): ?> - <p> - <?php if (isset($this->overrideEmptyMessage)): ?> - <?=$this->overrideEmptyMessage?> - <?php else: ?> - <?php $this->layout()->srmessage = $this->translate('nohit_lookfor_html', ['%%lookfor%%' => $this->escapeHtml($lookfor)]); ?> - <?=$this->layout()->srmessage?> + <?php foreach (($top = $this->results->getRecommendations('top')) as $index => $current): ?> + <?=$this->recommend($current, 'top', $index)?> + <?php endforeach; ?> + + <?php foreach ($this->results->getRecommendations('noresults') as $index => $current): ?> + <?php if (!in_array($current, $top)): ?> + <?=$this->recommend($current, 'noresults', $index)?> + <?php endif; ?> + <?php endforeach; ?> + <?php else: ?> + <?php if ($this->results->getPaginator()->getCurrentPageNumber() > 1): ?> + <?=$this->paginationControl( + $this->results->getPaginator(), + 'Sliding', + 'search/pagination.phtml', + ['results' => $this->results, 'options' => $this->paginationOptions ?? []] + )?> <?php endif; ?> - </p> - <?php if (isset($this->parseError)): ?> - <p class="alert alert-danger"><?=$this->transEsc('nohit_parse_error')?></p> + + <?=$this->render('search/list-' . $this->params->getView() . '.phtml')?> + + <?=$this->paginationControl( + $this->results->getPaginator(), + 'Sliding', + 'search/pagination.phtml', + ['results' => $this->results, 'options' => $this->paginationOptions ?? []] + )?> <?php endif; ?> - <?php foreach (($top = $this->results->getRecommendations('top')) as $index => $current): ?> - <?=$this->recommend($current, 'top', $index)?> - <?php endforeach; ?> - <?php foreach ($this->results->getRecommendations('noresults') as $index => $current): ?> - <?php if (!in_array($current, $top)): ?> - <?=$this->recommend($current, 'noresults', $index)?> + </div> + + <div id="sidebar" class="sidebar"> + <div class="sidebar_header"> + <h2><?=$this->transEsc('Functions & Filters')?></h2> + <button + class="-icon-only -small" + type="button" + aria-controls="sidebar" + aria-label="<?=$this->transEsc('Close functions & filters')?>" + > + <?=$this->icon('small/x')?> + <span class="sr-only"><?=$this->transEsc('Close')?></span> + </button> + </div> + + <div id="sidebar-inner" class="sidebar_inner"> + <?php if ($recordTotal > 0): ?> + <div class="results_actions"> + <?php // TODO: Content linked could still be broken, including lightboxes ?> + <?php $cart = $this->cart(); ?> + <?php if ($cart->isActive()): ?> + <a + id="cartItems" + href="<?=$this->url('cart-home')?>" + data-lightbox + > + <?=$this->icon('small/pin')?> + <?=$this->transEsc('Book Bag')?> + <?php // NOTE: Pin count updated via JS, must be <strong> ?> + (<strong><?=count($cart->getItems())?></strong>) + </a> + <?php endif; ?> + + <a href="<?=$this->url('myresearch-favorites')?>"> + <?=$this->icon('small/star')?> + <?=$this->transEsc('Favorites')?> + </a> + + <a href="<?=$this->results->getUrlQuery()->setViewParam('rss')?>"> + <?=$this->icon('small/rss')?> + <?=$this->transEsc('RSS Feed')?> + </a> + + <a + id="mailSearch<?=$this->escapeHtmlAttr($this->results->getSearchId())?>" + href="<?=$this->url('search-email')?>" + data-lightbox + > + <?=$this->icon('small/mail')?> + <?=$this->transEsc('Email')?> + </a> + + <a + href="<?=$this->url('search-history')?>" + data-lightbox + > + <?=$this->icon('small/clock')?> + <?=$this->transEsc('History')?> + </a> + + <?php if ($this->accountCapabilities()->getSavedSearchSetting() === 'enabled'): ?> + <?php if (is_numeric($this->results->getSearchId())): ?> + <?php if ($this->results->isSavedSearch()): ?> + <a href="<?=$this->url('myresearch-savesearch')?>?delete=<?=urlencode($this->results->getSearchId())?>"> + <?php // TODO: Change icon? ?> + <?=$this->icon('small/save')?> + <?=$this->transEsc('Remove')?> + </a> + <?php else: ?> + <a href="<?=$this->url('myresearch-savesearch')?>?save=<?=urlencode($this->results->getSearchId())?>"> + <?=$this->icon('small/save')?> + <?=$this->transEsc('Save')?> + </a> + <?php endif; ?> + <?php endif; ?> + <?php endif; ?> + </div> + + <?php foreach ($this->results->getRecommendations('top') as $index => $current): ?> + <?=$this->recommend($current, 'top', $index)?> + <?php endforeach; ?> <?php endif; ?> - <?php endforeach; ?> - <?php else: ?> - <form id="search-cart-form" method="post" name="bulkActionForm" action="<?=$this->url('cart-searchresultsbulk')?>" data-lightbox data-lightbox-onsubmit="bulkFormHandler"> - <?=$this->context($this)->renderInContext('search/bulk-action-buttons.phtml', ['idPrefix' => ''])?> - </form> - <?=$this->render('search/list-' . $this->params->getView() . '.phtml')?> - <?=$this->context($this)->renderInContext('search/bulk-action-buttons.phtml', ['idPrefix' => 'bottom_', 'formAttr' => 'search-cart-form'])?> - <?=$this->paginationControl($this->results->getPaginator(), 'Sliding', 'search/pagination.phtml', ['results' => $this->results, 'options' => isset($this->paginationOptions) ? $this->paginationOptions : []])?> - <?php endif; ?> -</div> -<?php /* End Main Listing */ ?> -<?php /* Narrow Search Options */ ?> -<div class="<?=$this->layoutClass('sidebar')?>" id="search-sidebar"> - <?php foreach ($this->results->getRecommendations('side') as $index => $current): ?> - <?=$this->recommend($current, 'side', $index)?> - <?php endforeach; ?> + <?php foreach ($this->results->getRecommendations('side') as $index => $current): ?> + <?=$this->recommend($current, 'side', $index)?> + <?php endforeach; ?> + </div> + </div> </div> -<?php /* End Narrow Search Options */ ?> <!-- fid_bbi: search - results - END --> diff --git a/themes/fid_bbi/theme.config.php b/themes/fid_bbi/theme.config.php index fd498ba6c1f2055b1eef101fc658fdd3e7fa4986..50933b43a3f43dcf4ba0257cb7f3b9c4b05c5d3a 100644 --- a/themes/fid_bbi/theme.config.php +++ b/themes/fid_bbi/theme.config.php @@ -3,7 +3,10 @@ return [ 'extends' => 'fid', // TODO: 'favicon' => 'favicon.ico', 'css' => [], - 'js' => [], + 'js' => [ + '../images/vendor/slim-select/dist/slimselect.min.js', + 'theme.js', + ], 'mixins' => [ 'worldcat', ],