For ticket https://fedorahosted.org/freeipa/ticket/668
From 664d5f27c9aa8954674bcab9ea89029b9f73d70c Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Thu, 27 Jan 2011 16:37:48 -0500
Subject: [PATCH 172/172] default disable delete

---
 install/ui/ipa.css   |   16 ++++++++++++++++
 install/ui/search.js |   16 +++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index e3760f32ae583e25fc4bb84a7f12a6775264caba..6ba60dfff2a0e2568034d5d6ce6ca146dc11bcbc 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -43,6 +43,11 @@ body{
     cursor: pointer;
 }
 
+.input_link_disabled {
+    cursor: default;
+    color:black;
+}
+
 .input_link span.ui-icon {
     -moz-border-radius: 0.3em;
     border: 1px solid #B8B8B8;
@@ -52,6 +57,17 @@ body{
     top: 50%;
 }
 
+.input_link_disabled span.ui-icon {
+    -moz-border-radius: 0.3em;
+    border: 1px solid #B8B8B8;
+    margin: -0.9em 0.4em 0em -0.3em;
+    position: absolute;
+    left: .2em;
+    top: 50%;
+}
+
+
+
 .ipa-icon {
 	font-size: 0.7em;
 	padding-right: 0.3em;
diff --git a/install/ui/search.js b/install/ui/search.js
index b88de20a7c90e59f1bf56bd4aa64fc45ee32e013..20a6f51fc66251f8f8109da8286f8a3a6f935848 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -103,10 +103,12 @@ IPA.search_widget =  function (spec) {
         that.remove_button = IPA.action_button({
             'label': IPA.messages.button.remove,
             'icon': 'ui-icon-trash',
-            'click': function() { that.remove(that.container); }
         });
+        that.remove_button.addClass('input_link_disabled');
+
         button.replaceWith(that.remove_button);
 
+
         button = $('input[name=add]', search_buttons);
         that.add_button = IPA.action_button({
             'label': IPA.messages.button.add,
@@ -156,6 +158,18 @@ IPA.search_widget =  function (spec) {
             $('input', action_panel).val(null);
 
         }
+
+        if(count === 0){
+            var remove_button =  $('a[title=Delete]', action_panel);
+            remove_button.addClass('input_link_disabled');
+            remove_button.unbind('click');
+
+        }else{
+            var remove_button =  $('a[title=Delete]', action_panel);
+            remove_button.click(function() { that.remove(that.container); });
+            remove_button.removeClass('input_link_disabled');
+        }
+
         return false;
     };
 
-- 
1.7.3.5

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to