From 08fd4cd78783c170fd707f95340db1e5933c5013 Mon Sep 17 00:00:00 2001 From: Adam Young <ayo...@redhat.com> Date: Fri, 4 Feb 2011 13:49:56 -0500 Subject: [PATCH] target section undo adds an undo link for the whole target section, incase the user changes the target type
--- install/ui/aci.js | 37 +++++++++++++++++++++++++++++++++++-- 1 files changed, 35 insertions(+), 2 deletions(-) diff --git a/install/ui/aci.js b/install/ui/aci.js index 036731237ee8a0f3bd80957520e9ee9ca546bf21..66d66ec396ee1c1d24cb7c8b251a0c3748b8a6b7 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -249,7 +249,35 @@ IPA.target_section = function(spec) { 'aci_by_filter' ]; var inputs = ['input', 'select', 'textarea']; + function create_undo(container) { + $('<span/>', { + name: 'target-undo', + style: 'display: none;', + 'class': 'ui-state-highlight ui-corner-all undo', + html: 'undo', + click: function(){ + that.reset(); + } + }).appendTo(container); + }; + + function get_undo() { + return $('span[name="target-undo"]', that.container); + }; + + function show_undo() { + var undo = get_undo(); + undo.css('display', 'inline'); + }; + + function hide_undo() { + var undo = get_undo(); + undo.css('display', 'none'); + }; + + function disable_inputs() { + show_undo(); for (var g = 0; g < groupings.length; g += 1 ){ for (var t = 0 ; t < inputs.length; t += 1){ $('.' + groupings[g] + ' '+ inputs[t]). @@ -369,6 +397,9 @@ IPA.target_section = function(spec) { } that.create = function(container) { + if (that.undo) { + create_undo(container); + } var dl = $('<dl/>', { 'class': 'aci-target' }).appendTo(container); @@ -455,13 +486,15 @@ IPA.target_section = function(spec) { that.attribute_table.object_type = record.type; that.section_load(record); + hide_undo(); + }; that.reset = function() { set_aci_type(that.record); that.attribute_table.object_type = that.record.type; - + hide_undo(); that.section_reset(); }; @@ -566,7 +599,7 @@ IPA.entity_factories.permission = function() { IPA.stanza({name:'identity', label:'Identity'}). input({name: 'cn', 'read_only': true})). section(IPA.rights_section()). - section(IPA.target_section({name: 'target', label: 'Target'}))); + section(IPA.target_section({name: 'target', label: 'Target',undo: true}))); }; -- 1.7.3.5
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel