@ucd-lib/theme-elements 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucd-lib/theme-elements",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Custom elements for the UCD brand theme",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -87,8 +87,27 @@ export default class UcdlibSilsSearchRedirect extends LitElement {
87
87
  */
88
88
  _onSubmit(e){
89
89
  e.preventDefault();
90
+ this.doSearch('simple-search');
91
+
92
+ }
93
+
94
+ /**
95
+ * @method _onAdvancedSearch
96
+ * @description Called when advanced search button is clicked
97
+ * @private
98
+ */
99
+ _onAdvancedSearch(){
100
+ this.doSearch('advanced-search');
101
+ }
102
+
103
+ /**
104
+ * @method doSearch
105
+ * @description Either redirects to Primo or fires event listener
106
+ * @param {*} searchType - advanced or basic
107
+ */
108
+ doSearch(searchType){
109
+ let advanced = searchType == "advanced-search";
90
110
  let corpus = this.ucdOnly ? "ucd" : "everything";
91
- let advanced = e.submitter.id == "advanced-search";
92
111
 
93
112
  let url = this.primo.makeSearchUrl(this.query, corpus, advanced);
94
113
  if ( this.preventRedirect ) {
@@ -107,7 +107,7 @@ return html`
107
107
  <div class="checkbox u-space-mr--small u-space-mt--small">
108
108
  <input id="corpus" type="checkbox" ?checked=${this.ucdOnly} @input=${this._onCorpusChange}><label for="corpus">UC Davis libraries only</label>
109
109
  </div>
110
- <button id="advanced-search" class="u-space-mt--small" type="submit">Advanced Search</button>
110
+ <button id="advanced-search" class="u-space-mt--small" type="button" @click=${this._onAdvancedSearch}>Advanced Search</button>
111
111
  </div>
112
112
  </form>
113
113