From 3dae30a45fe055f73c40fb6a854b8a6dc41b6976 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 21 Dec 2015 16:16:53 -0500 Subject: [PATCH] added jquery to switch between category and product view --- js/app.js | 11 +++++++++-- js/custom/upcp.js | 11 +++++++++-- page.php | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/js/app.js b/js/app.js index abf0db5..4d4f88f 100644 --- a/js/app.js +++ b/js/app.js @@ -22,6 +22,15 @@ $(document).ready(function () { $(document).ready(function () { "use strict"; + // don't display products on the main "products page" + if ((window.location.href.indexOf("products-2") >= 0)){ + $("#productsView").css("display", "none"); + } + if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){ + $("#productsView").css("display", "inherit"); + $("#categoriesView").css("display", "none"); + } + // navigate back to products page if on product page if ((window.location.href.indexOf("products-2/?pagename") >= 0)) { // $("#viewBtns").css("display", "none"); @@ -36,7 +45,6 @@ $(document).ready(function () { } // change output view - if (!(window.location.href.indexOf("products-2/?pagename") >= 0)) { $("#grid").on("click", function (e) { document.cookie = "view=grid"; @@ -47,7 +55,6 @@ $(document).ready(function () { location.reload(); }); } - $("#categoryDropdown").change(function() { $("#catSubmit").submit(); }); diff --git a/js/custom/upcp.js b/js/custom/upcp.js index ab6e832..c1d7394 100644 --- a/js/custom/upcp.js +++ b/js/custom/upcp.js @@ -2,6 +2,15 @@ $(document).ready(function () { "use strict"; + // don't display products on the main "products page" + if ((window.location.href.indexOf("products-2") >= 0)){ + $("#productsView").css("display", "none"); + } + if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){ + $("#productsView").css("display", "inherit"); + $("#categoriesView").css("display", "none"); + } + // navigate back to products page if on product page if ((window.location.href.indexOf("products-2/?pagename") >= 0)) { // $("#viewBtns").css("display", "none"); @@ -16,7 +25,6 @@ $(document).ready(function () { } // change output view - if (!(window.location.href.indexOf("products-2/?pagename") >= 0)) { $("#grid").on("click", function (e) { document.cookie = "view=grid"; @@ -27,7 +35,6 @@ $(document).ready(function () { location.reload(); }); } - $("#categoryDropdown").change(function() { $("#catSubmit").submit(); }); diff --git a/page.php b/page.php index a57d297..7882e2b 100644 --- a/page.php +++ b/page.php @@ -17,6 +17,7 @@

+