LP#1772680: Fixed search and css issues
authorJaswinder Singh <Jaswinder.Singh0011@gmail.com>
Tue, 2 Oct 2018 15:56:04 +0000 (11:56 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 16 Mar 2020 19:09:45 +0000 (15:09 -0400)
Signed-off-by: Jaswinder Singh <jaswinder.singh0011@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/opac/ebook_api/rbdigital/register_modal.tt2
Open-ILS/src/templates/opac/parts/vendor_tabs.tt2
Open-ILS/web/css/skin/default/ebook/rbdigital.css
Open-ILS/web/js/ui/default/opac/ebook_api/rbdigital.js

index 8f9d458..ea484d0 100644 (file)
@@ -57,7 +57,7 @@
           <div class="center-text">
             Your RBdigital account has been created!<br><br>
             Please remember the RBdigital password you just created. It may be different from your PINES password.<br><br>
-            Visit <a href="https://[% vendor_library_url %]/#/help/support" target="_blank">https://[% vendor_library_url %]</a>/#/help/support to learn about RBdigital and to download RBdigital mobile and desktop apps.<br><br>
+            Visit <a href="https://[% vendor_library_url %]/#/help/support" target="_blank">https://[% vendor_library_url %]/#/help/support</a> to learn about RBdigital and to download RBdigital mobile and desktop apps.<br><br>
             Visit <a href="https://[% vendor_library_url %]" target="_blank">https://[% vendor_library_url %]</a> to search for e-books and e-audiobooks at RBdigital.com or use the RBdigital tab to search from them from this PINES site
           </div>
           <button id="btnCloseRegisterSuccess" type="submit" class="btn btn-danger btn-default pull-right" data-dismiss="modal">Ok</button>
index d3872da..8d4cc05 100644 (file)
             %]
                 <a id="lnkSearchResults_[%  vendor.vendor_key %]" 
                     href="[% vendor_search_url; %]" class="[% vendor_tab_class %]">[% vendor.name %]</a>
-            [% END; %]    
+            [% END; %]
+            [% IF vendor_key != 'default'; %]
+                <span type="hidden" id="hasVendors" />
+            [% END; %]
+            
         </div>
     </div>
     <input type="hidden" id="rbdigitalPatronId" value="[% ctx.rbdigital_patron_id %]">
index ae0f0f8..35770b9 100644 (file)
@@ -53,7 +53,6 @@
 
 .rbdigital #registerProgress, #registerError {
     font-size: 125%;
-    font-weight: bold;
     color: red;
     margin-left: 2em;
 }
@@ -116,9 +115,10 @@ a.opac-button:hover {
 
 #rbdigital_footer_links {
     padding: 1em;
+    padding-right: 0;
 }
 
-#rbdigital_footer_links span {
+#rbdigital_footer_links span:not(:first-child) {
     margin-right: 1em;
 }
 
index c9910f1..071be99 100644 (file)
@@ -3,6 +3,7 @@ var vendor_rbdigital = new Vendor("rbdigital");
 var ebook_spinner;
 var rbdigitalPatronId;
 var EG_ID_FIELD_SEPARATOR = '__';
+var EG_QUERY_STRING = "eg[query_string]";
 
 $( document ).ready(function() {
     ebook_rbdigital = new Ebook('rbdigital', 0);
@@ -25,6 +26,17 @@ $( document ).ready(function() {
         trigger: 'hover focus'
     });
 
+    //Update Default Vendor link
+    if ($('#hasVendors')) {
+        var query_string = getValueFromLocalStorage(EG_QUERY_STRING);
+        var default_search_link = $("#lnkSearchResults_default");
+        var default_search_uri = default_search_link.attr('href');
+
+        if (query_string.length > 0) {
+            default_search_link.attr("href",default_search_uri+ query_string);
+        }
+    }
+
 });
 
 function setupEventHandlers() {
@@ -63,7 +75,10 @@ function setupEventHandlers() {
         return false;
     });
 
-    $("#lnkSearchResults_rbdigital").click(function(event){
+    $("#lnkSearchResults_rbdigital").click(function(event) {
+        //Presist existing query string to a local storage
+        saveToLocalStorage(EG_QUERY_STRING, window.location.search);
+
         //Do not show registration modal if patronid exists
         if (rbdigitalPatronId > 0) {
             return true;
@@ -551,4 +566,24 @@ function checkPasswordStrength(password) {
 
 String.prototype.ucfirst = function() {
     return this.charAt(0).toUpperCase() + this.substr(1);
+}
+
+/**
+ * Call this method save value to local storage
+ * @param {string} key 
+ * @param {string} query_string 
+ */
+function saveToLocalStorage(key, query_string) {
+    localStorage.setItem(key, JSON.stringify(query_string));
+}
+
+/**
+ * Call this method to get value from local storage
+ * @param {string} key 
+ * @returns String containing value from localstorage (if any)
+ */
+function getValueFromLocalStorage(key) {
+    if (typeof localStorage[key] != 'undefined' ) {
+        return JSON.parse(localStorage[key]);
+    }
 }
\ No newline at end of file