From cc403bc682c42753982357a48a1f3bdab57bf91b Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Fri, 31 Mar 2017 08:20:59 -0400 Subject: [PATCH] added JS to handle the changing search query routing, evevents, catalog and site search --- index.php | 29 +++++++---------------------- parts/search-form.php | 6 +++--- sections/front-page.php | 6 +++--- sections/header.php | 6 +++--- 4 files changed, 16 insertions(+), 31 deletions(-) diff --git a/index.php b/index.php index 747bbd3..dbfcb8a 100644 --- a/index.php +++ b/index.php @@ -51,7 +51,7 @@ var baseUrl = ''; var eventsPage = ''; var url,queryType; - + // Public members return { getCatalogSearch: function(){ @@ -81,13 +81,13 @@ $([catalog,main,events]).each(function(){ $(this).on("change", function(){ - this.queryType = $(this).val(); - - switch(this.queryType){ + queryType = $(this).val(); + + switch(queryType){ case 'catalog': - this.url = 'https://charlevoix.bibliocommons.com/search?custom_query='; + this.url = 'https://charlevoix.bibliocommons.com/search'; form.attr("method", "GET"); - form.children('.search-input').attr('name','query'); + form.children('.search-input').attr('name','custom_query'); break; case 'site': this.url = baseUrl + 'site-search'; @@ -105,26 +105,11 @@ form.attr('action', this.url); }); - query = this.queryType; - }); - }, - queryType: this.queryType - + }, } })(); search.changeAction(search.getCatalogSearch(),search.getMainSearch(),search.getEventSearch(),search.getSearchForm()); - $('.searchform').on('submit', function(){ - var search_val = $(this).children('.search-input'); - if( search.queryType === 'catalog'){ - $(this).attr('action', this.url + search_val); - } else { - console.log(search.query); - return false; - } - - }); - console.log(search); }); diff --git a/parts/search-form.php b/parts/search-form.php index 68210b6..d4f4f35 100644 --- a/parts/search-form.php +++ b/parts/search-form.php @@ -2,8 +2,8 @@
- - - + + +
\ No newline at end of file diff --git a/sections/front-page.php b/sections/front-page.php index adac252..22e74ff 100644 --- a/sections/front-page.php +++ b/sections/front-page.php @@ -4,9 +4,9 @@
- - - + + +
diff --git a/sections/header.php b/sections/header.php index 516b5f1..326b5bb 100644 --- a/sections/header.php +++ b/sections/header.php @@ -14,9 +14,9 @@
- - - + + +
-- 2.17.1