Bug 12116 - Move fixFloat jQuery plugin outside of language-specific directory
authorOwen Leonard <oleonard@myacpl.org>
Mon, 21 Apr 2014 16:11:58 +0000 (12:11 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 25 Apr 2014 15:21:11 +0000 (15:21 +0000)
This patch moves the fixFloat jQuery plugin to
intranet-tmpl/prog/lib/jquery/plugins so that it will not be duplicated
for each set of translated templates.

This patch also includes a change to staff-global.css to override some
style the floating toolbar inherited when we added Bootstrap widgets.

To test, apply the patch and confirm that the toolbar "sticks" to the
top of the screen when scrolling down on the following pages:

- System preferences
- Authorities editor (Authorities -> New authority)
- Cataloging editor (Cataloging -> New record)
- List contents view (Lists -> View a list's contents)

Followed test plan. Patch behaves as expected.
Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.fixFloat.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.fixFloat.js [deleted file]
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt

diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.fixFloat.js b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.fixFloat.js
new file mode 100644 (file)
index 0000000..0a6fde0
--- /dev/null
@@ -0,0 +1,68 @@
+/* Source: http://www.webspeaks.in/2011/07/new-gmail-like-floating-toolbar-jquery.html
+   Revision: http://jsfiddle.net/pasmalin/AyjeZ/
+*/
+(function($){
+  $.fn.fixFloat = function(options){
+
+    var defaults = {
+      enabled: true
+    };
+    var options = $.extend(defaults, options);
+
+    var offsetTop;    /**Distance of the element from the top of window**/
+    var s;        /**Scrolled distance from the top of window through which we have moved**/
+    var fixMe = true;
+    var repositionMe = true;
+
+    var tbh = $(this);
+    var originalOffset = tbh.position().top;  /**Get the actual distance of the element from the top mychange:change to position better work**/
+
+    if (tbh.css('position')!='absolute') {
+      var tbhBis = $("<div></div>");
+      tbhBis.css({"display":tbh.css("display"),"visibility":"hidden"});
+      tbhBis.width(tbh.outerWidth(true));
+      tbhBis.height(tbh.outerHeight(true));
+      tbh.after(tbhBis);
+      tbh.width(tbh.width());
+      tbh.css({'position':'absolute'});
+    }
+
+    if(options.enabled){
+      $(window).scroll(function(){
+        var offsetTop = tbh.offset().top;  /**Get the current distance of the element from the top **/
+        var s = parseInt($(window).scrollTop(), 10);  /**Get the from the top of wondow through which we have scrolled**/
+        var fixMe = true;
+        if(s > offsetTop){
+          fixMe = true;
+        }else{
+          fixMe = false;
+        }
+
+        if(s < originalOffset){
+          repositionMe = true;
+        }else{
+          repositionMe = false;
+        }
+
+        if(fixMe){
+          var cssObj = {
+            'position' : 'fixed',
+            'top' : '0px',
+            'z-index' : '1000'
+          }
+          tbh.css(cssObj);
+          tbh.addClass("floating");
+        }
+        if(repositionMe){
+          var cssObj = {
+            'position' : 'absolute',
+            'top' : originalOffset,
+            'z-index' : '1'
+          }
+          tbh.css(cssObj);
+          tbh.removeClass("floating");
+        }
+      });
+    }
+  };
+})(jQuery);
\ No newline at end of file
index 8abe90d..1db0427 100644 (file)
@@ -2611,11 +2611,18 @@ fieldset.rows table.mceListBox {
 }
 
 /* Class to be added to toolbar when it starts being fixed at the top of the screen*/
+
 .floating {
     -webkit-box-shadow: 0px 3px 2px 0px rgba(0, 0, 0, .5);
     box-shadow: 0px 3px 2px 0px rgba(0, 0, 0, .5);
 }
 
+div#toolbar.floating,
+#searchheader.floating {
+    border-radius: 0;
+    margin-top: 0;
+}
+
 .inline {
     display : inline;
 }
diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.fixFloat.js b/koha-tmpl/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.fixFloat.js
deleted file mode 100644 (file)
index 0a6fde0..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Source: http://www.webspeaks.in/2011/07/new-gmail-like-floating-toolbar-jquery.html
-   Revision: http://jsfiddle.net/pasmalin/AyjeZ/
-*/
-(function($){
-  $.fn.fixFloat = function(options){
-
-    var defaults = {
-      enabled: true
-    };
-    var options = $.extend(defaults, options);
-
-    var offsetTop;    /**Distance of the element from the top of window**/
-    var s;        /**Scrolled distance from the top of window through which we have moved**/
-    var fixMe = true;
-    var repositionMe = true;
-
-    var tbh = $(this);
-    var originalOffset = tbh.position().top;  /**Get the actual distance of the element from the top mychange:change to position better work**/
-
-    if (tbh.css('position')!='absolute') {
-      var tbhBis = $("<div></div>");
-      tbhBis.css({"display":tbh.css("display"),"visibility":"hidden"});
-      tbhBis.width(tbh.outerWidth(true));
-      tbhBis.height(tbh.outerHeight(true));
-      tbh.after(tbhBis);
-      tbh.width(tbh.width());
-      tbh.css({'position':'absolute'});
-    }
-
-    if(options.enabled){
-      $(window).scroll(function(){
-        var offsetTop = tbh.offset().top;  /**Get the current distance of the element from the top **/
-        var s = parseInt($(window).scrollTop(), 10);  /**Get the from the top of wondow through which we have scrolled**/
-        var fixMe = true;
-        if(s > offsetTop){
-          fixMe = true;
-        }else{
-          fixMe = false;
-        }
-
-        if(s < originalOffset){
-          repositionMe = true;
-        }else{
-          repositionMe = false;
-        }
-
-        if(fixMe){
-          var cssObj = {
-            'position' : 'fixed',
-            'top' : '0px',
-            'z-index' : '1000'
-          }
-          tbh.css(cssObj);
-          tbh.addClass("floating");
-        }
-        if(repositionMe){
-          var cssObj = {
-            'position' : 'absolute',
-            'top' : originalOffset,
-            'z-index' : '1'
-          }
-          tbh.css(cssObj);
-          tbh.removeClass("floating");
-        }
-      });
-    }
-  };
-})(jQuery);
\ No newline at end of file
index f81f1a9..63ecaaf 100644 (file)
@@ -7,7 +7,7 @@
 [% IF ( bidi ) %]
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/right-to-left.css" />
 [% END %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
 <script type="text/javascript">
 //<![CDATA[
     [% UNLESS ( searchfield ) %]$(document).ready(function(){
index ae61553..e8afb18 100644 (file)
@@ -1,7 +1,7 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Authorities &rsaquo; [% IF ( authid ) %]Modify authority #[% authid %] ([% authtypetext %])[% ELSE %]Adding authority ([% authtypetext %])[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
 <script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
 
 <script type="text/javascript">
index 8cd1945..01218b2 100644 (file)
@@ -2,7 +2,7 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Cataloging &rsaquo; [% IF ( biblionumber ) %]Editing [% title |html %] (Record number [% biblionumber %])[% ELSE %]Add MARC record[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
 <script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
 [% INCLUDE 'browser-strings.inc' %]
 <!--[if lt IE 9]>
index baa04ab..23d815f 100644 (file)
@@ -3,7 +3,7 @@
 [% INCLUDE 'doc-head-close.inc' %]
 [% IF ( viewshelf ) %]
     <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
-    <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
+    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
 [% END %]
 <script type="text/javascript">
 //<![CDATA[