From 485a6ce583e79c8686b40795deb6976ae35d01fb Mon Sep 17 00:00:00 2001 From: UcDust Date: Thu, 21 Nov 2024 15:58:31 -0800 Subject: [PATCH] change fast links to be search links #257 --- .../pages/collection/app-collection.tpl.js | 3 +-- .../elements/pages/record/app-record.tpl.js | 3 +-- .../client/public/lib/utils/index.js | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/services/fin/ucd-lib-client/client/public/elements/pages/collection/app-collection.tpl.js b/services/fin/ucd-lib-client/client/public/elements/pages/collection/app-collection.tpl.js index be00f74..848c8e3 100644 --- a/services/fin/ucd-lib-client/client/public/elements/pages/collection/app-collection.tpl.js +++ b/services/fin/ucd-lib-client/client/public/elements/pages/collection/app-collection.tpl.js @@ -557,8 +557,7 @@ export default function render() { Subjects: ${this.subjects.map( (about, index) => - html`${index > 0 ? ", " : ""}${about["name"] || about["@id"]}` + html`${index > 0 ? ", " : ""}${about["name"] || about["@id"]}` )}
diff --git a/services/fin/ucd-lib-client/client/public/elements/pages/record/app-record.tpl.js b/services/fin/ucd-lib-client/client/public/elements/pages/record/app-record.tpl.js index df5ae8a..e284737 100644 --- a/services/fin/ucd-lib-client/client/public/elements/pages/record/app-record.tpl.js +++ b/services/fin/ucd-lib-client/client/public/elements/pages/record/app-record.tpl.js @@ -363,8 +363,7 @@ export default function render() {
${this.subjects.map( (about, index) => - html`${index > 0 ? ", " : ""}${about["name"] || about["@id"]}` + html`${index > 0 ? ", " : ""}${about["name"] || about["@id"]}` )}
diff --git a/services/fin/ucd-lib-client/client/public/lib/utils/index.js b/services/fin/ucd-lib-client/client/public/lib/utils/index.js index 21c7fa2..ebad1d5 100644 --- a/services/fin/ucd-lib-client/client/public/lib/utils/index.js +++ b/services/fin/ucd-lib-client/client/public/lib/utils/index.js @@ -270,6 +270,21 @@ class Utils { return null; } + + /** + * @method getSubjectUrl + * @description given a subject string, build search url + * + * @param {Object} recordModel + * @param {String} subject + * @returns {String} search url for subject + */ + getSubjectUrl(recordModel, subject) { + let searchDocument = recordModel.emptySearchDocument(); + let subjectFacet = '@graph.subjects.name'; + recordModel.appendKeywordFilter(searchDocument, subjectFacet, subject); + return '/search/'+recordModel.searchDocumentToUrl(searchDocument); + } } module.exports = new Utils();