From eb13e206a06739a93d381706dae76d85f71a699a Mon Sep 17 00:00:00 2001 From: Oleksiy 'Alex' Levshyn Date: Tue, 5 Dec 2023 15:02:29 +0100 Subject: [PATCH] MIR-1241 Response mir facets should be dynamic (#901) * MIR-1241: split the response-mir.xsl file, dynamic facets were split into a separate facets.xsl file; improved usability and customized the code in the mir_results.scss file; added some facets to the solr-config.json file and corresponding messages to messages_*.properties files. * MIR-1241: remove new fields from solr-config.json for SOLR request handler /select, remove some new messages from messages_*.properties * MIR-1241: add facets for classifications * MIR-1241: split the response-mir.xsl file, dynamic facets were split into a separate facets.xsl file; improved usability and customized the code in the mir_results.scss file; added some facets to the solr-config.json file and corresponding messages to messages_*.properties files. * MIR-1241 * MIR-1241: remove unused file facets.xsl * MIR-1241: refactoring: reducing the number of calls to URI-Resolver * MIR-1241: fix redundant condition * MIR-1241: remove variables $MIR.Response.Facet.Prefix.Classification, $classId * MIR-1241 Moved facet related template to response-facets.xsl. Use include via resource: uri * MIR-1241 Simplified code for arbtrary facets * MIR-1241 Parse classification only once * MIR-1241 Support dynamic facet titles, allow to read values from category.top solr field * MIR-1241 Fix $ClassId to 'category.top' * MIR-1241 Renamed variable * MIR-1241 Removed extra handling for mods.genre and worldReadableComplete facets * MIR-1241 Reduce diff in mir_results.scss (removed changes caused by code format) --------- Co-authored-by: Silvio Hermann Co-authored-by: Oleksiy 'Alex' Levshyn --- .../mir-layout/scss/common/mir_results.scss | 84 ++++++--- .../config/mir/messages_de.properties | 10 +- .../config/mir/messages_en.properties | 10 +- .../config/mir/messages_it.properties | 10 +- .../resources/config/mir/mycore.properties | 1 - .../config/mir/solr/main/solr-config.json | 4 +- .../main/resources/xsl/response-facets.xsl | 177 ++++++++++++++++++ .../main/resources/xsl/response-mir-utils.xsl | 2 +- .../src/main/resources/xsl/response-mir.xsl | 144 +------------- 9 files changed, 263 insertions(+), 179 deletions(-) create mode 100644 mir-module/src/main/resources/xsl/response-facets.xsl diff --git a/mir-layout/src/main/resources/META-INF/resources/mir-layout/scss/common/mir_results.scss b/mir-layout/src/main/resources/META-INF/resources/mir-layout/scss/common/mir_results.scss index 8b643a29cd..1e02a54ced 100644 --- a/mir-layout/src/main/resources/META-INF/resources/mir-layout/scss/common/mir_results.scss +++ b/mir-layout/src/main/resources/META-INF/resources/mir-layout/scss/common/mir_results.scss @@ -12,6 +12,7 @@ $filter_border: #ccc !default; $filter_headline: #999 !default; $filter_hits: #999 !default; $filter: #666 !default; +$hover_darken: 20%; @-webkit-keyframes bouncedelay { 0%, 80%, 100% { -webkit-transform: scale(0.0) } @@ -89,54 +90,75 @@ $filter: #666 !default; float: left; width: 100%; .card-header { + cursor: pointer; .card-title { font-size: 1rem; color: $filter_headline; margin-bottom: 0px; + &:hover { + color: darken($filter_headline, $hover_darken); + } } } .filter { li { - .checkbox { + cursor: pointer; + &:hover * { + background-color: transparent; + } + &:hover { + .custom-checkbox { + label { + .title { + color: darken($filter, $hover_darken); + } + .hits { + color: darken($filter_hits, $hover_darken); + } + } + } + } + .custom-checkbox { margin-top: 0px; margin-bottom: 0px; label { + cursor: pointer; vertical-align: middle; + .hits { + color: $filter_hits; + } } - .hits { - color: $filter_hits; + } + } + } + &.worldReadableComplete { + li[data-fq^='worldReadableComplete']{ + .title:before{ + display: inline-block; + font: normal normal 900 14px/1 'Font Awesome 5 Free'; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + margin-right: 5px; + } + } + li[data-fq='worldReadableComplete:true'] { + .title { + @extend .text-success; + &:before{ + content: "\f13e"; //fa-unlock-alt + } + } + } + li[data-fq='worldReadableComplete:false'] { + .title { + @extend .text-warning; + &:before{ + content: "\f023"; //fa-lock } } } } - &.oa { - li[data-fq^='worldReadableComplete']{ - .title:before{ - display: inline-block; - font: normal normal 900 14px/1 'Font Awesome 5 Free'; - text-rendering: auto; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - margin-right: 5px; - } - } - li[data-fq='worldReadableComplete:true'] { - .title { - @extend .text-success; - &:before{ - content: "\f13e"; //fa-unlock-alt - } - } - } - li[data-fq='worldReadableComplete:false'] { - .title { - @extend .text-warning; - &:before{ - content: "\f023"; //fa-lock - } - } - } - } } } diff --git a/mir-module/src/main/resources/config/mir/messages_de.properties b/mir-module/src/main/resources/config/mir/messages_de.properties index b9868ed24a..0f7cf65586 100644 --- a/mir-module/src/main/resources/config/mir/messages_de.properties +++ b/mir-module/src/main/resources/config/mir/messages_de.properties @@ -627,12 +627,16 @@ mir.relatedItem.reviewOf = Rezension von mir.relatedItem.search = Verkn\u00FCpfte Publikationen als separate Trefferliste anzeigen mir.relatedItem.series = In Serie mir.response.button.filter = Filter -mir.response.openAccess.facet.false = keine oder gesch\u00FCtze Dateien -mir.response.openAccess.facet.title = Verf\u00FCgbarkeit -mir.response.openAccess.facet.true = Dateien frei zug\u00E4nglich +mir.response.facet.worldReadableComplete.title = Verf\u00FCgbarkeit +mir.response.facet.worldReadableComplete.value.true = Dateien frei zug\u00E4nglich +mir.response.facet.worldReadableComplete.value.false = keine oder gesch\u00FCtze Dateien mir.response.openAccess.false = Keine frei verf\u00FCgbare Datei angehangen. mir.response.openAccess.true = Frei verf\u00FCgbare Datei angehangen. mir.response.relevance = Relevanz des Treffers in Bezug auf alle Treffer dieser Suche +mir.response.facet.mods.genre.title = Typ +mir.response.facet.createdby.title = Erstellt von +mir.response.facet.modifiedby.title = Angepasst von +mir.response.facet.mods.author.title = Autor*in mir.results.hitDoesNotExist = Dieser Treffer kann nicht angezeigt werden oder wurde gerade gel\u00F6scht. mir.rights = Lizenz mir.rightsHolder = Rechteinhaber: diff --git a/mir-module/src/main/resources/config/mir/messages_en.properties b/mir-module/src/main/resources/config/mir/messages_en.properties index 036d5ec66e..3e2b2954fa 100644 --- a/mir-module/src/main/resources/config/mir/messages_en.properties +++ b/mir-module/src/main/resources/config/mir/messages_en.properties @@ -600,12 +600,16 @@ mir.relatedItem.references = References mir.relatedItem.reviewOf = Review of mir.relatedItem.search = Show related publications as separate result list mir.relatedItem.series = In Series -mir.response.openAccess.facet.false = no or protected files -mir.response.openAccess.facet.title = Availability -mir.response.openAccess.facet.true = Files freely accessible +mir.response.facet.worldReadableComplete.title = Availability +mir.response.facet.worldReadableComplete.value.false = no or protected files +mir.response.facet.worldReadableComplete.value.true = Files freely accessible mir.response.openAccess.false = No free available file attached. mir.response.openAccess.true = Free available file attached. mir.response.relevance = Relevance of this hit in relation to all hits of current search +mir.response.facet.mods.genre.title = Type +mir.response.facet.createdby.title = Created by +mir.response.facet.modifiedby.title = Modified by +mir.response.facet.mods.author.title = Author mir.results.hitDoesNotExist = This result can not be displayed or was recently deleted. mir.rights = License mir.rightsHolder = License Holder: diff --git a/mir-module/src/main/resources/config/mir/messages_it.properties b/mir-module/src/main/resources/config/mir/messages_it.properties index 90aeaee382..8045bf1bc7 100644 --- a/mir-module/src/main/resources/config/mir/messages_it.properties +++ b/mir-module/src/main/resources/config/mir/messages_it.properties @@ -44,8 +44,12 @@ mir.metaData.panel.heading.mir_admindata_panel = Informazioni di sistema mir.placeholder.characteristics.factor = Impact Factor mir.placeholder.characteristics.year = YYYY mir.response.button.filter = Filtri -mir.response.openAccess.facet.false = file no o protetti -mir.response.openAccess.facet.title = Disponibilit\u00E0 -mir.response.openAccess.facet.true = File liberamente accessibili +mir.response.facet.worldReadableComplete.title = Disponibilit\u00E0 +mir.response.facet.worldReadableComplete.value.true = File liberamente accessibili +mir.response.facet.worldReadableComplete.value.false = file no o protetti +mir.response.facet.mods.genre.title = Tipo +mir.response.facet.createdby.title = Creato da +mir.response.facet.modifiedby.title = Modificato da +mir.response.facet.mods.author.title = Autore user.profile.id.orcid = Your ORCID iD diff --git a/mir-module/src/main/resources/config/mir/mycore.properties b/mir-module/src/main/resources/config/mir/mycore.properties index 87ace973f3..ae5d8f3618 100644 --- a/mir-module/src/main/resources/config/mir/mycore.properties +++ b/mir-module/src/main/resources/config/mir/mycore.properties @@ -258,7 +258,6 @@ MCR.Solr.HTTPResponseHeader.Content-Security-Policy= # MIR still works with dynamic generated solr fields MCR.Solr.DynamicFields=true - ############################################################################## # URIResolver & ContentTransformer # ############################################################################## diff --git a/mir-module/src/main/resources/config/mir/solr/main/solr-config.json b/mir-module/src/main/resources/config/mir/solr/main/solr-config.json index de76733f1f..ca5e818beb 100644 --- a/mir-module/src/main/resources/config/mir/solr/main/solr-config.json +++ b/mir-module/src/main/resources/config/mir/solr/main/solr-config.json @@ -191,7 +191,9 @@ }, "appends": { "facet": "true", - "facet.field": "mods.genre", + "facet.field": [ + "mods.genre" + ], "facet.mincount": "1" } } diff --git a/mir-module/src/main/resources/xsl/response-facets.xsl b/mir-module/src/main/resources/xsl/response-facets.xsl new file mode 100644 index 0000000000..94d9c1df08 --- /dev/null +++ b/mir-module/src/main/resources/xsl/response-facets.xsl @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + +
+
+

+ + + + + + + + + + + + + + + + + + + + + + +

+
+ + +
+
    + + + + + +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  • +
    + + + true + + + + +
    +
  • +
    +
    + +
    diff --git a/mir-module/src/main/resources/xsl/response-mir-utils.xsl b/mir-module/src/main/resources/xsl/response-mir-utils.xsl index b3cea856a4..9b006438d5 100644 --- a/mir-module/src/main/resources/xsl/response-mir-utils.xsl +++ b/mir-module/src/main/resources/xsl/response-mir-utils.xsl @@ -393,4 +393,4 @@ - \ No newline at end of file + diff --git a/mir-module/src/main/resources/xsl/response-mir.xsl b/mir-module/src/main/resources/xsl/response-mir.xsl index 5f90225876..b203b86c88 100644 --- a/mir-module/src/main/resources/xsl/response-mir.xsl +++ b/mir-module/src/main/resources/xsl/response-mir.xsl @@ -11,12 +11,11 @@ xmlns:mcrxsl="xalan://org.mycore.common.xml.MCRXMLFunctions" xmlns:basket="xalan://org.mycore.frontend.basket.MCRBasketManager" xmlns:decoder="xalan://java.net.URLDecoder" - exclude-result-prefixes="i18n mods str exslt mcr acl mcrxsl basket encoder decoder" -> - - - + exclude-result-prefixes="i18n mods str exslt mcr acl mcrxsl basket encoder decoder"> + + + @@ -231,40 +230,10 @@ - -
    -
    -

    - -

    -
    -
    -
      - - - - -
    -
    -
    -
    - -
    -
    -

    - -

    -
    -
    -
      - - - - -
    -
    -
    -
    + + + + @@ -916,103 +885,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • -
    - - - true - - - -
    -
  • -
    -
    -