Bug 27613: Change pipe seperated online resource links to psuedo elements
authorLucas Gass <lucas@bywatersolutions.com>
Thu, 4 Feb 2021 00:27:11 +0000 (00:27 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 25 Feb 2022 00:35:35 +0000 (14:35 -1000)
To test:
1. Have a record with many 856 links
2. Look at the links on both the results and detail pages.
3. Look at the '|' and notice it is outside any HTML element, making it
   hard to remove.
4. Apply the patch and regenerate the CSS
5. Look at both the pages again and notice that the '|' is now a psuedo
   element.
6. It should look identical to the way it did without the patch
7. Switch the system pref OPACURLOpenInNewWindow to 'do' and make sure
   the the links look and function right still.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl

index a650a1f..55993aa 100644 (file)
@@ -1153,6 +1153,31 @@ div {
     }
 }
 
+.online_resources {
+    ul {
+        display: inline-block;
+        margin: 0 auto;
+        padding-left: 0;
+    }
+
+    li {
+        display: inline-block;
+        white-space: nowrap;
+
+        &::after {
+            content: " | ";
+        }
+
+        &:last-child {
+            &::after {
+                content: "";
+            }
+        }
+
+    }
+
+}
+
 #views {
     margin-bottom: .5em;
     padding: 0 2em .2em .2em;
index a7dd374..be0f96c 100644 (file)
 <!-- Image processing code added here, takes precedence over text links including y3z text   -->
         <xsl:if test="marc:datafield[@tag=856]">
         <span class="results_summary online_resources"><span class="label">Online resources: </span>
-        <xsl:for-each select="marc:datafield[@tag=856]">
-            <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
-           <a property="url">
-           <xsl:choose>
-             <xsl:when test="$OPACTrackClicks='track'">
-            <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
-             </xsl:when>
-             <xsl:when test="$OPACTrackClicks='anonymous'">
-            <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
-             </xsl:when>
-             <xsl:otherwise>
-              <xsl:attribute name="href">
-                  <xsl:if test="not(contains(marc:subfield[@code='u'],'://'))">
-                      <xsl:choose>
-                          <xsl:when test="@ind1=7">
-                              <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
-                          </xsl:when>
-                          <xsl:when test="@ind1=1">
-                              <xsl:text>ftp://</xsl:text>
-                          </xsl:when>
-                          <xsl:otherwise>
-                              <xsl:text>http://</xsl:text>
-                          </xsl:otherwise>
-                      </xsl:choose>
-                  </xsl:if>
-                  <xsl:value-of select="marc:subfield[@code='u']"/>
-              </xsl:attribute>
-             </xsl:otherwise>
-           </xsl:choose>
-            <xsl:if test="$OPACURLOpenInNewWindow='1'">
-                <xsl:attribute name="target">_blank</xsl:attribute>
-            </xsl:if>
+            <ul>
+            <xsl:for-each select="marc:datafield[@tag=856]">
+                <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
+            <li><a property="url">
             <xsl:choose>
-            <xsl:when test="($Show856uAsImage='Details' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
-                <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px</xsl:attribute></xsl:element><xsl:text></xsl:text>
-            </xsl:when>
-            <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
-                <xsl:call-template name="subfieldSelect">
-                    <xsl:with-param name="codes">y3z</xsl:with-param>
-                </xsl:call-template>
-            </xsl:when>
-            <xsl:when test="$URLLinkText!=''">
-                <xsl:value-of select="$URLLinkText"/>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:text>Click here to access online</xsl:text>
-            </xsl:otherwise>
-            </xsl:choose>
-            </a>
-            <xsl:choose>
-            <xsl:when test="position()=last()"><xsl:text>  </xsl:text></xsl:when>
-            <xsl:otherwise> | </xsl:otherwise>
+              <xsl:when test="$OPACTrackClicks='track'">
+                <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
+              </xsl:when>
+              <xsl:when test="$OPACTrackClicks='anonymous'">
+                <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
+              </xsl:when>
+              <xsl:otherwise>
+                  <xsl:attribute name="href">
+                      <xsl:if test="not(contains(marc:subfield[@code='u'],'://'))">
+                          <xsl:choose>
+                              <xsl:when test="@ind1=7">
+                                  <xsl:value-of select="marc:subfield[@code='2']"/><xsl:text>://</xsl:text>
+                              </xsl:when>
+                              <xsl:when test="@ind1=1">
+                                  <xsl:text>ftp://</xsl:text>
+                              </xsl:when>
+                              <xsl:otherwise>
+                                  <xsl:text>http://</xsl:text>
+                              </xsl:otherwise>
+                          </xsl:choose>
+                      </xsl:if>
+                      <xsl:value-of select="marc:subfield[@code='u']"/>
+                  </xsl:attribute>
+              </xsl:otherwise>
             </xsl:choose>
-        </xsl:for-each>
+                <xsl:if test="$OPACURLOpenInNewWindow='1'">
+                    <xsl:attribute name="target">_blank</xsl:attribute>
+                </xsl:if>
+                <xsl:choose>
+                <xsl:when test="($Show856uAsImage='Details' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
+                    <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px</xsl:attribute></xsl:element><xsl:text></xsl:text>
+                </xsl:when>
+                <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
+                    <xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">y3z</xsl:with-param>
+                    </xsl:call-template>
+                </xsl:when>
+                <xsl:when test="$URLLinkText!=''">
+                    <xsl:value-of select="$URLLinkText"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:text>Click here to access online</xsl:text>
+                </xsl:otherwise>
+                </xsl:choose>
+                </a></li>
+            </xsl:for-each>
+            </ul>
         </span>
         </xsl:if>
 
index 59a2cab..7e5b5ac 100644 (file)
     <xsl:if test="marc:datafield[@tag=856]">
          <span class="results_summary online_resources">
                           <span class="label">Online access: </span>
+                    <ul>
                             <xsl:for-each select="marc:datafield[@tag=856]">
                             <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable>
                             <xsl:if test="$OPACURLOpenInNewWindow='0'">
-                             <a>
+                             <li><a>
                              <xsl:choose>
                                <xsl:when test="$OPACTrackClicks='track'">
                       <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
                                        </xsl:choose>
                                     </xsl:when>
                                     </xsl:choose>
-                                    </a>
+                                    </a></li>
                               </xsl:if>
                             <xsl:if test="$OPACURLOpenInNewWindow='1'">
-                                   <a target='_blank'>
+                                   <li><a target='_blank'>
                                   <xsl:choose>
                                     <xsl:when test="$OPACTrackClicks='track'">
                       <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&amp;biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute>
                                        </xsl:choose>
                                     </xsl:when>
                                     </xsl:choose>
-                                    </a>
+                                    </a></li>
                               </xsl:if>
-                                    <xsl:choose>
-                                    <xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when>
-                                    <xsl:otherwise> | </xsl:otherwise>
-                                    </xsl:choose>
                             </xsl:for-each>
+                            </ul>
                             </span>
                         </xsl:if>