Merge branch '2290-user-activity'
[arvados.git] / apps / workbench / app / assets / javascripts / application.js
index dc7177060ed3e085756837e664368e400d6945cc..e7884b95165173bdce213624172957085e05c737 100644 (file)
@@ -41,6 +41,7 @@ jQuery(function($){
         }
         targets.fadeToggle(200);
     });
+
     $(document).
         on('ajax:send', function(e, xhr) {
             $('.loading').fadeTo('fast', 1);
@@ -83,7 +84,7 @@ jQuery(function($){
                 parent().
                 find('>span').
                 append(new_tag_span).
-                append(' ');
+                append('  ');
             $.ajax($(this).attr('data-remote-href'),
                            {dataType: 'json',
                             type: $(this).attr('data-remote-method'),
@@ -105,10 +106,11 @@ jQuery(function($){
         });
 
     HeaderRowFixer = function(selector) {
-        var tables = $(selector);
         this.duplicateTheadTr = function() {
-            tables.each(function() {
+            $(selector).each(function() {
                 var the_table = this;
+                if ($('>tbody>tr:first>th', the_table).length > 0)
+                    return;
                 $('>tbody', the_table).
                     prepend($('>thead>tr', the_table).
                             clone().
@@ -116,9 +118,9 @@ jQuery(function($){
             });
         }
         this.fixThead = function() {
-            tables.each(function() {
+            $(selector).each(function() {
                 var widths = [];
-                $('> tbody > tr:eq(0) > td', this).each( function(i,v){
+                $('> tbody > tr:eq(1) > td', this).each( function(i,v){
                     widths.push($(v).width());
                 });
                 for(i=0;i<widths.length;i++) {
@@ -127,10 +129,15 @@ jQuery(function($){
             });
         }
     }
+    
     var fixer = new HeaderRowFixer('.table-fixed-header-row');
-    fixer.fixThead();
     fixer.duplicateTheadTr();
+    fixer.fixThead();
     $(window).resize(function(){
         fixer.fixThead();
     });
-})(jQuery);
+    $(document).on('ajax:complete', function(e, status) {
+        fixer.duplicateTheadTr();
+        fixer.fixThead();
+    });
+});