Merge branch 'master' into 2871-preload-objects
[arvados.git] / apps / workbench / app / assets / javascripts / application.js
index 6afc8c3b040c31cf83375ac7051dc63328851902..7b09d5242cb5283f971ca216827c3105f55cc731 100644 (file)
@@ -19,6 +19,7 @@
 //= require bootstrap/popover
 //= require bootstrap/collapse
 //= require bootstrap/modal
+//= require bootstrap/button
 //= require bootstrap3-editable/bootstrap-editable
 //= require_tree .
 
@@ -28,7 +29,6 @@ jQuery(function($){
             'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
         }
     });
-    $('.editable').editable();
     $('[data-toggle=tooltip]').tooltip();
 
     $('.expand-collapse-row').on('click', function(event) {
@@ -43,12 +43,20 @@ jQuery(function($){
         targets.fadeToggle(200);
     });
 
+    var ajaxCount = 0;
+
     $(document).
         on('ajax:send', function(e, xhr) {
-            $('.loading').fadeTo('fast', 1);
+            ajaxCount += 1;
+            if (ajaxCount == 1) {
+                $('.loading').fadeTo('fast', 1);
+            }
         }).
         on('ajax:complete', function(e, status) {
-            $('.loading').fadeOut('fast', 0);
+            ajaxCount -= 1;
+            if (ajaxCount == 0) {
+                $('.loading').fadeOut('fast', 0);
+            }
         }).
         on('click', '.removable-tag a', function(e) {
             var tag_span = $(this).parents('[data-tag-link-uuid]').eq(0)
@@ -105,6 +113,12 @@ jQuery(function($){
             return false;
         });
 
+    $(document).
+        on('ajax:complete ready', function() {
+            // See http://getbootstrap.com/javascript/#buttons
+            $('.btn').button();
+        });
+
     HeaderRowFixer = function(selector) {
         this.duplicateTheadTr = function() {
             $(selector).each(function() {