Bugzilla – Attachment 122112 Details for
Bug 27170
ILL availability should be able to display arbitrary links to related resources
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27170: Add support for new 'links' property
Bug-27170-Add-support-for-new-links-property.patch (text/plain), 3.78 KB, created by
Andrew Isherwood
on 2021-06-18 10:00:14 UTC
(
hide
)
Description:
Bug 27170: Add support for new 'links' property
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2021-06-18 10:00:14 UTC
Size:
3.78 KB
patch
obsolete
>From 089ba436594b324ac51b9699e1c7da1c73e21805 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Tue, 8 Dec 2020 12:21:43 +0000 >Subject: [PATCH] Bug 27170: Add support for new 'links' property > >This commit adds support for the new 'links' property that will allow an >availability plugin to return an array of links for a result. These >links are parsed and appended to the title field of a results record. >--- > .../intranet-tmpl/prog/js/ill-availability.js | 24 ++++++++++++++++--- > .../bootstrap/js/ill-availability.js | 24 ++++++++++++++++--- > 2 files changed, 42 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/ill-availability.js b/koha-tmpl/intranet-tmpl/prog/js/ill-availability.js >index 289b934ffa..8515200063 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/ill-availability.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/ill-availability.js >@@ -1,5 +1,16 @@ > $(document).ready(function() { > >+ var getLinks = function(row) { >+ if (row.links.length === 0) { >+ return false; >+ } >+ return row.links.map(function(link) { >+ return '<a href="' + link.url + '" target="_blank">' + >+ link.text + >+ '</a>'; >+ }); >+ }; >+ > window.doSearch = function() { > // In case the source doesn't supply data required for DT to calculate > // pagination, we need to do it ourselves >@@ -51,9 +62,16 @@ $(document).ready(function() { > // Here we store them > var renders = { > title: function(data, type, row) { >- return row.url ? >- '<a href="'+row.url+'" target="_blank">'+row.title+'</a>' : >- row.title; >+ var links = getLinks(row); >+ if (links) { >+ return row.title + ' - ' + links.join(', '); >+ } else if (row.url) { >+ return '<a href="' + row.url + '" target="_blank">' + >+ row.title + >+ '</a>'; >+ } else { >+ return row.title; >+ } > }, > source: function(data, type, row) { > return row.opac_url ? >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/ill-availability.js b/koha-tmpl/opac-tmpl/bootstrap/js/ill-availability.js >index 9c0be4c105..239a3bfecd 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/ill-availability.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/ill-availability.js >@@ -1,5 +1,16 @@ > $(document).ready(function() { > >+ var getLinks = function(row) { >+ if (row.links.length === 0) { >+ return false; >+ } >+ return row.links.map(function(link) { >+ return '<a href="' + link.url + '" target="_blank">' + >+ link.text + >+ '</a>'; >+ }); >+ }; >+ > window.doSearch = function() { > // In case the source doesn't supply data required for DT to calculate > // pagination, we need to do it ourselves >@@ -51,9 +62,16 @@ $(document).ready(function() { > // Here we store them > var renders = { > title: function(data, type, row) { >- return row.url ? >- '<a href="'+row.url+'" target="_blank">'+row.title+'</a>' : >- row.title; >+ var links = getLinks(row); >+ if (links) { >+ return row.title + ' - ' + links.join(', '); >+ } else if (row.url) { >+ return '<a href="' + row.url + '" target="_blank">' + >+ row.title + >+ '</a>'; >+ } else { >+ return row.title; >+ } > }, > source: function(data, type, row) { > return row.opac_url ? >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27170
:
114256
|
122112
|
122113
|
122114
|
122115
|
122117
|
122167
|
122168
|
122169
|
122632
|
122633
|
122634
|
123339
|
123340
|
123341