- add build button to the sensitivity evaluation
- scope the action buttons in the .actionsidebar class
- always trigger the sensitivity method on document.ready()
---
 src/app/views/pools/index.haml        |    2 +-
 src/app/views/templates/index.haml    |    2 +-
 src/app/views/users/index.haml        |    2 +-
 src/public/javascripts/application.js |   20 +++++++++++++-------
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/app/views/pools/index.haml b/src/app/views/pools/index.haml
index bd2ee69..f713d70 100644
--- a/src/app/views/pools/index.haml
+++ b/src/app/views/pools/index.haml
@@ -32,5 +32,5 @@
 
 :javascript
   $(document).ready(function () {
-    $("input[type='checkbox']").buttonSensitivity();
+    $("input[type='checkbox']").buttonSensitivity().change();
   });
diff --git a/src/app/views/templates/index.haml 
b/src/app/views/templates/index.haml
index d2200b1..2f69626 100644
--- a/src/app/views/templates/index.haml
+++ b/src/app/views/templates/index.haml
@@ -61,5 +61,5 @@
 
 :javascript
   $(document).ready(function () {
-    $("#tables input[type='checkbox']").buttonSensitivity();
+    $("#tables input[type='checkbox']").buttonSensitivity().change();
   });
diff --git a/src/app/views/users/index.haml b/src/app/views/users/index.haml
index deba8cb..a26900b 100644
--- a/src/app/views/users/index.haml
+++ b/src/app/views/users/index.haml
@@ -40,5 +40,5 @@
 
 :javascript
   $(document).ready(function () {
-    $("input[type='checkbox']").buttonSensitivity();
+    $("input[type='checkbox']").buttonSensitivity().change();
   });
diff --git a/src/public/javascripts/application.js 
b/src/public/javascripts/application.js
index 8d90e74..425b6ad 100644
--- a/src/public/javascripts/application.js
+++ b/src/public/javascripts/application.js
@@ -79,28 +79,34 @@ var Aggregator = {
   };
   $.fn.buttonSensitivity = function () {
     var $checkboxes = $(this),
-      $edit = $('.edit'),
-      $delete = $('.delete'),
-      $rename = $('.rename'),
-      $copy = $('.copy'),
-      $build = $('.build');
+      $edit = $('.actionsidebar .edit'),
+      $delete = $('.actionsidebar .delete'),
+      $rename = $('.actionsidebar .rename'),
+      $copy = $('.actionsidebar .copy'),
+      $build = $('.actionsidebar .build');
     return $checkboxes.change(function () {
       var $checked = $checkboxes.filter(':checked');
       if ($checked.length === 0) {
-        //disable the edit and delete action if there is none
+        //disable the build, edit and delete action if there is none selected
+        $build.addClass("disabled");
         $edit.addClass("disabled");
         $delete.addClass("disabled");
+        $("input", $build).attr("disabled","disabled");
         $("input", $edit).attr("disabled","disabled");
         $("input", $delete).attr("disabled","disabled");
       } else if ($checked.length > 1) {
-        //disable the edit if there is more than one
+        //disable the build and edit if there is more than one
         $edit.addClass("disabled");
+        $build.addClass("disabled");
         $delete.removeClass("disabled");
+        $("input", $build).attr("disabled","disabled");
         $("input", $edit).attr("disabled","disabled");
         $("input", $delete).removeAttr("disabled");
       } else {
+        $("input", $build).removeAttr("disabled");
         $("input", $edit).removeAttr("disabled");
         $("input", $delete).removeAttr("disabled");
+        $build.removeClass("disabled");
         $edit.removeClass("disabled");
         $delete.removeClass("disabled");
       }
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to