first working radio buttons

This commit is contained in:
Mark Eaton
2024-11-04 12:20:09 -05:00
committed by GitHub
parent 916fec030a
commit 3bce14e99a
+17 -16
View File
@@ -58,7 +58,7 @@ const onesearchComponent = {
enctype="application/x-www-form-urlencoded; charset=utf-8" enctype="application/x-www-form-urlencoded; charset=utf-8"
> >
<!-- default is "everything" option suggested from OLS widget builder --> <!-- default is "everything" option suggested from OLS widget builder -->
<div v-if="selecteditem.input" v-html="selecteditem.input"></div> <div v-if="selecteditem" v-html="selecteditem"</div>
<input name="vid" value="01CUNY_KB:CUNY_KB" type="hidden" /> <input name="vid" value="01CUNY_KB:CUNY_KB" type="hidden" />
<input name="tab" value="Everything" type="hidden" /> <input name="tab" value="Everything" type="hidden" />
<input name="search_scope" value="IZ_CI_AW" type="hidden" /> <input name="search_scope" value="IZ_CI_AW" type="hidden" />
@@ -132,12 +132,25 @@ const onesearchComponent = {
@click.stop.prevent="submitSearch" @click.stop.prevent="submitSearch"
/> />
</div> </div>
<div>
<input type="radio"
id="booksradio"
name="radio1"
@click="selectradio('books')"
>
<label for="booksradio">Books</label>
<input type="radio"
id="articlesradio"
name="radio1"
@click="selectradio('articles')"
>
<label for="articlesradio">Articles</label>
</div>
</div> </div>
</form>`, </form>`,
methods: { methods: {
selectdropdown(item, itemName) { selectradio(radiooutput) {
this.displayeditem = itemName; // swap in current item at the top of the dropdown this.selecteditem = "<input name='facet' value='rtype,include," + radiooutput + "' type='hidden' />"; // store the data from the dropdown selection
this.selecteditem = item; // store the data from the dropdown selection
}, },
submitSearch() { submitSearch() {
this.$refs.primoQueryString.value = `any,contains,${this.$refs.primoQueryTempString.value.replace( this.$refs.primoQueryString.value = `any,contains,${this.$refs.primoQueryTempString.value.replace(
@@ -152,18 +165,6 @@ const onesearchComponent = {
selecteditem: {}, // initialize the data from the dropdown selection selecteditem: {}, // initialize the data from the dropdown selection
searchstring: "", // initialize an empty search string searchstring: "", // initialize an empty search string
displayeditem: "Define Your Search", // the text displayed a the top of the OneSearch dropdown displayeditem: "Define Your Search", // the text displayed a the top of the OneSearch dropdown
materialtype: {
Books: {
input:
'<input name="facet" value="rtype,include,books" type="hidden" />',
id: 1,
},
Articles: {
input:
'<input name="mfacet" value="rtype,include,articles,1" type="hidden" /><input name="facet" value="tlevel,include,peer_reviewed" type="hidden" />',
id: 2,
},
},
}; };
}, },
}; };