diff --git a/groups/home/src/main4.js b/groups/home/src/main4.js index 42e3985..7d7a1fe 100644 --- a/groups/home/src/main4.js +++ b/groups/home/src/main4.js @@ -97,7 +97,7 @@ const onesearchComponent = {
{{ item.fullName }} @@ -131,7 +131,75 @@ const onesearchComponent = {
`, - props: ['selecteditem', 'searchstring', 'placeholderstring', 'displayeditem', 'materialtype'] + methods: { + selectdropdown(item, itemName) { + this.displayeditem = itemName; // swap in current item at the top of the dropdown + this.selecteditem = item; // store the data from the dropdown selection + this.placeholderstring = 'Enter search term here'; + }, + submitSearch() { + if (this.displayeditem === 'Define Your Search') { + this.placeholderstring = 'Please make a selection'; + this.searchstring = ''; // remove the search string + if (!this.$refs.blueBorder1.classList.contains('open')) { // if the dropdown is not open + this.$refs.oneSearchMenu.click(); // open the dropdown + } + } else { + this.$refs.primoQueryString.value = `any,contains,${this.$refs.primoQueryTempString.value.replace(/[,]/g, ' ')}`; // vueified OLS widget code + this.$refs.oneSearchForm.submit(); // submit the form + } + }, + }, + data() { + return { + selecteditem: {}, // initialize the data from the dropdown selection + searchstring: '', // initialize an empty search string + placeholderstring: 'Enter search term here', // initialize the placeholder + displayeditem: 'Define Your Search', // the text displayed a the top of the OneSearch dropdown + materialtype: { + Books: { + fullName: 'Books', + baseUrl: 'https://cuny-kb.primo.exlibrisgroup.com/discovery/search', + tab: 'Everything', + searchScope: 'IZ_CI_AW', + input: '', + id: 1, + }, + Articles: { + fullName: 'Articles (Peer reviewed)', + baseUrl: 'https://cuny-kb.primo.exlibrisgroup.com/discovery/search', + tab: 'Everything', + searchScope: 'IZ_CI_AW', + input: '', + id: 2, + }, + Reserves: { + fullName: 'Course reserves', + baseUrl: 'https://cuny-kb.primo.exlibrisgroup.com/discovery/search', + tab: 'CourseReserves', + searchScope: 'CourseReserves', + input: '', + id: 3, + }, + Newspapers: { + fullName: 'Newspapers and Magazines', + baseUrl: 'https://cuny-kb.primo.exlibrisgroup.com/discovery/npsearch', + tab: 'Everything', + searchScope: 'IZ_CI_AW', + input: '', + id: 4, + }, + Journals: { + fullName: 'Journals', + baseUrl: 'https://cuny-kb.primo.exlibrisgroup.com/discovery/jsearch', + tab: 'jsearch_slot', + searchScope: 'IZ_CI_AW', + input: '', + id: 5, + } + } + } + } } const { createApp } = Vue @@ -370,74 +438,5 @@ const app2 = createApp({ components: { 'onesearch-component': onesearchComponent }, - methods: { - selectDropdown(item, itemName) { - this.displayeditem = itemName; // swap in current item at the top of the dropdown - this.selecteditem = item; // store the data from the dropdown selection - this.placeholderstring = 'Enter search term here'; - }, - submitSearch() { - if (this.displayeditem === 'Define Your Search') { - this.placeholderstring = 'Please make a selection'; - this.searchstring = ''; // remove the search string - if (!this.$refs.blueBorder1.classList.contains('open')) { // if the dropdown is not open - this.$refs.oneSearchMenu.click(); // open the dropdown - } - } else { - this.$refs.primoQueryString.value = `any,contains,${this.$refs.primoQueryTempString.value.replace(/[,]/g, ' ')}`; // vueified OLS widget code - this.$refs.oneSearchForm.submit(); // submit the form - } - }, - }, - data() { - return { - selecteditem: {}, // initialize the data from the dropdown selection - searchstring: '', // initialize an empty search string - placeholderstring: 'Enter search term here', // initialize the placeholder - displayeditem: 'Define Your Search', // the text displayed a the top of the OneSearch dropdown - materialtype: { - Books: { - fullName: 'Books', - baseUrl: 'https://cuny-kb.primo.exlibrisgroup.com/discovery/search', - tab: 'Everything', - searchScope: 'IZ_CI_AW', - input: '', - id: 1, - }, - Articles: { - fullName: 'Articles (Peer reviewed)', - baseUrl: 'https://cuny-kb.primo.exlibrisgroup.com/discovery/search', - tab: 'Everything', - searchScope: 'IZ_CI_AW', - input: '', - id: 2, - }, - Reserves: { - fullName: 'Course reserves', - baseUrl: 'https://cuny-kb.primo.exlibrisgroup.com/discovery/search', - tab: 'CourseReserves', - searchScope: 'CourseReserves', - input: '', - id: 3, - }, - Newspapers: { - fullName: 'Newspapers and Magazines', - baseUrl: 'https://cuny-kb.primo.exlibrisgroup.com/discovery/npsearch', - tab: 'Everything', - searchScope: 'IZ_CI_AW', - input: '', - id: 4, - }, - Journals: { - fullName: 'Journals', - baseUrl: 'https://cuny-kb.primo.exlibrisgroup.com/discovery/jsearch', - tab: 'jsearch_slot', - searchScope: 'IZ_CI_AW', - input: '', - id: 5, - } - } - } - } }) app2.mount('#app2');