2760: Merge branch 'master' into 2760-folder-hierarchy
[arvados.git] / apps / workbench / app / assets / javascripts / pipeline_instances.js
index 3209d67782b7fd6fb9760cef5523f6476c62b752..26a0c3e2fd723f460af42d0ee1e92aa79d58b9bb 100644 (file)
@@ -9,37 +9,39 @@ function run_pipeline_button_state() {
 }
 
 $(document).on('editable:success', function(event, tag, response, newValue) {
+    var $tag = $(tag);
     if ($('.run-pipeline-button').length == 0)
         return;
-    tag = $(tag);
-    if (tag.hasClass("required")) {
+    if ($tag.hasClass("required")) {
         if (newValue && newValue.trim() != "") {
-            tag.removeClass("editable-empty");
-            tag.parent().css("background-color", "");
-            tag.parent().prev().css("background-color", "");
+            $tag.removeClass("editable-empty");
+            $tag.parent().css("background-color", "");
+            $tag.parent().prev().css("background-color", "");
         }
         else {
-            tag.addClass("editable-empty");
-            tag.parent().css("background-color", "#ffdddd");
-            tag.parent().prev().css("background-color", "#ffdddd");
+            $tag.addClass("editable-empty");
+            $tag.parent().css("background-color", "#ffdddd");
+            $tag.parent().prev().css("background-color", "#ffdddd");
         }
     }
-    if (tag.attr('data-name')) {
+    if ($tag.attr('data-name')) {
         // Update other inputs representing the same piece of data
-        $('[data-name="' + tag.attr('data-name') + '"]').html(newValue);
+        $('.editable[data-name="' + $tag.attr('data-name') + '"]').
+            editable('setValue', newValue);
     }
     run_pipeline_button_state();
 });
 
 $(document).on('ready ajax:complete', function() {
     $('a.editable.required').each(function() {
-        if (this.hasClass("editable-empty")) {
-            this.parent().css("background-color", "#ffdddd");
-            this.parent().prev().css("background-color", "#ffdddd");
+        var $tag = $(this);
+        if ($tag.hasClass("editable-empty")) {
+            $tag.parent().css("background-color", "#ffdddd");
+            $tag.parent().prev().css("background-color", "#ffdddd");
         }
         else {
-            this.parent().css("background-color", "");
-            this.parent().prev().css("background-color", "");
+            $tag.parent().css("background-color", "");
+            $tag.parent().prev().css("background-color", "");
         }
     });
     run_pipeline_button_state();