From 003fadb5960f535e238b6b50836836dd599412a6 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Thu, 22 Sep 2016 15:10:07 -0400
Subject: [PATCH] Keep retain filter state in sessionStorage. Closes
 VUFIND-1175.

---
 themes/bootstrap3/js/common.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js
index 554ed519f2a..21e1a8b639d 100644
--- a/themes/bootstrap3/js/common.js
+++ b/themes/bootstrap3/js/common.js
@@ -361,4 +361,12 @@ $(document).ready(function commonDocReady() {
   });
   $('.facet.list-group .collapse').on('shown.bs.collapse', facetSessionStorage);
   $('.facet.list-group .collapse').on('hidden.bs.collapse', facetSessionStorage);
+
+  // retain filter sessionStorage
+  $('.searchFormKeepFilters').click(function() {
+    sessionStorage.setItem('vufind_retain_filters', this.checked);
+  });
+  if (sessionStorage.getItem('vufind_retain_filters')) {
+    $('.searchFormKeepFilters').prop('checked', sessionStorage.getItem('vufind_retain_filters') == 'true');
+  }
 });
-- 
GitLab