Last active
June 20, 2023 16:10
-
-
Save jkarlsen/6a0d7fea2543b24259fadecc9108080e to your computer and use it in GitHub Desktop.
Code for default Primo VE view that links to college-level views
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
'use strict'; | |
const app = angular.module('viewCustom', ['angularLoad']); | |
app.component('prmSearchResultAvailabilityLineAfter', { | |
bindings: { parentCtrl: '<' }, | |
// the template includes the component that we are defining below | |
template: | |
'<lr-view-buttons parent-ctrl="$ctrl.parentCtrl"></lr-view-buttons>' | |
}); | |
app.component('lrViewButtons', { | |
bindings: { parentCtrl: '<' }, | |
// the template does not need to be changed unless you want to change the html, e.g. to change the wording, layout etc. | |
template: | |
`<div layout="row" layout-align="center" style="font-weight:bold;" ng-if="::$ctrl.parentCtrl.isFullView === true"> | |
<div layout="column" layout-align="center"> | |
<p>See this record in a college-level OneSearch view:</p> | |
</div> | |
<div layout="column"> | |
<ul layout="row"> | |
<li ng-repeat="library in $ctrl.views" style="list-style-type:none;"> | |
<md-button external-link="" ng-href="https://{{::$ctrl.host}}/discovery/fulldisplay?docid={{::$ctrl.docID}}&vid={{::$ctrl.institutionCode}}:{{::library.view}}&search_scope={{::library.scope}}&tab={{::library.tab}}" target="_blank">{{::library.view}} | |
<md-icon md-svg-icon="primo-ui:open-in-new" aria-label="Open in new tab"></md-icon> | |
</md-button> | |
</li> | |
</ul> | |
</div> | |
</div>`, | |
controller: [ | |
'$location', | |
function ($location) { | |
const vm = this; | |
vm.$onInit = () => { | |
vm.host = $location.host(); | |
// **** replace the value currently in quotes below with your own institution code **** | |
vm.institutionCode = '01CACCL_LRCCD'; | |
vm.views = [ | |
// *** you need to replace the values below with what is used in the views you want to link to. Currently there are four, but there can be as many/few as needed. *** | |
{ view: 'arc', scope: 'arc_everything', tab: 'everything' }, | |
{ view: 'crc', scope: 'crc_everything', tab: 'everything' }, | |
{ view: 'flc', scope: 'flc_everything', tab: 'everything' }, | |
{ view: 'scc', scope: 'scc_everything', tab: 'everything' } | |
]; | |
vm.docID = vm.parentCtrl.result.pnx.control.sourcerecordid[0]; | |
}; | |
}, | |
] | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment