Skip to content

Commit

Permalink
change fast links to be search links #257
Browse files Browse the repository at this point in the history
  • Loading branch information
UcDust committed Nov 21, 2024
1 parent 716b1f9 commit 485a6ce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,7 @@ export default function render() {
<span class="collection-label">Subjects: </span>
${this.subjects.map(
(about, index) =>
html`${index > 0 ? ", " : ""}<a href="${about["@id"]}"
>${about["name"] || about["@id"]}</a>`
html`${index > 0 ? ", " : ""}<a href="${utils.getSubjectUrl(this.RecordModel, about["name"] || about["@id"])}">${about["name"] || about["@id"]}</a>`
)}
</div>
<div style="margin-bottom: .4rem;" ?hidden="${!this.material}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ export default function render() {
<div class="value" id="subjectValue">
${this.subjects.map(
(about, index) =>
html`${index > 0 ? ", " : ""}<a href="${about["@id"]}"
>${about["name"] || about["@id"]}</a>`
html`${index > 0 ? ", " : ""}<a href="${utils.getSubjectUrl(this.RecordModel, about["name"] || about["@id"])}">${about["name"] || about["@id"]}</a>`
)}
</div>
</div>
Expand Down
15 changes: 15 additions & 0 deletions services/fin/ucd-lib-client/client/public/lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit 485a6ce

Please sign in to comment.