Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIR-1409 Allow to customize badges/icons in search results #1084

Draft
wants to merge 3 commits into
base: 2023.06.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions mir-module/src/main/resources/xsl/response-mir-hit-oa.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="xalan://org.mycore.services.i18n.MCRTranslation"
exclude-result-prefixes="i18n xsl">

<xsl:template name="hit-oa">
<div class="hit_oa" data-toggle="tooltip">
<xsl:variable name="isOpenAccess" select="bool[@name='worldReadableComplete']='true'"/>

<xsl:choose>
<xsl:when test="$isOpenAccess">
<xsl:attribute name="title">
<xsl:value-of select="i18n:translate('mir.response.openAccess.true')"/>
</xsl:attribute>
<span class="badge badge-success">
<i class="fas fa-unlock-alt" aria-hidden="true"/>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="title">
<xsl:value-of select="i18n:translate('mir.response.openAccess.false')"/>
</xsl:attribute>
<span class="badge badge-warning">
<i class="fas fa-lock" aria-hidden="true"/>
</span>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
</xsl:stylesheet>
23 changes: 2 additions & 21 deletions mir-module/src/main/resources/xsl/response-mir.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<xsl:include href="resource:xsl/csl-export-gui.xsl" />
<xsl:include href="resource:xsl/response-facets.xsl"/>
<xsl:include href="resource:xsl/response-mir-hit-oa.xsl" />
<xsl:include href="resource:xsl/response-mir-utils.xsl" />

<xsl:param name="UserAgent" />
Expand Down Expand Up @@ -541,27 +542,7 @@
<!-- hit type -->
<div class="hit_tnd_container">
<div class="hit_tnd_content">
<div class="hit_oa" data-toggle="tooltip">
<xsl:variable name="isOpenAccess" select="bool[@name='worldReadableComplete']='true'" />
<xsl:choose>
<xsl:when test="$isOpenAccess">
<xsl:attribute name="title">
<xsl:value-of select="i18n:translate('mir.response.openAccess.true')" />
</xsl:attribute>
<span class="badge badge-success">
<i class="fas fa-unlock-alt" aria-hidden="true"></i>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="title">
<xsl:value-of select="i18n:translate('mir.response.openAccess.false')" />
</xsl:attribute>
<span class="badge badge-warning">
<i class="fas fa-lock" aria-hidden="true"></i>
</span>
</xsl:otherwise>
</xsl:choose>
</div>
<xsl:call-template name="hit-oa"/>
<xsl:choose>
<xsl:when test="arr[@name='mods.genre']">
<xsl:for-each select="arr[@name='mods.genre']/str">
Expand Down
Loading