summaryrefslogtreecommitdiffstats
path: root/install/ui/dialog.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-05-27 12:04:20 -0500
committerAdam Young <ayoung@redhat.com>2011-05-27 21:38:26 -0400
commit6304d9173c16e082d6844b329987680b85086cb7 (patch)
tree957c54e65b73f9f75f3e789f7f4804df1ef89c14 /install/ui/dialog.js
parente91aa64d4ae6d85284c3b062f5ba03a8da27f547 (diff)
downloadfreeipa-6304d9173c16e082d6844b329987680b85086cb7.tar.gz
freeipa-6304d9173c16e082d6844b329987680b85086cb7.tar.xz
freeipa-6304d9173c16e082d6844b329987680b85086cb7.zip
Fixed problem deleting value in text field.
Previously deleting a value in a text field did not work because the field is not included in the modify operation when the value is empty. The details facet's update() method has been modified to update only dirty fields. The section lists in details facet and dialog have been converted into ordered maps. Ticket #1256
Diffstat (limited to 'install/ui/dialog.js')
-rw-r--r--install/ui/dialog.js36
1 files changed, 21 insertions, 15 deletions
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index 9cba47fdd..4f93760bf 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -41,8 +41,7 @@ IPA.dialog = function(spec) {
that.buttons = {};
that.fields = $.ordered_map();
-
- that.sections = [];
+ that.sections = $.ordered_map();
that.__defineGetter__("entity_name", function(){
return that._entity_name;
@@ -56,8 +55,9 @@ IPA.dialog = function(spec) {
fields[i].entity_name = entity_name;
}
- for (var j=0; j<that.sections.length; j++) {
- that.sections[j].entity_name = entity_name;
+ var sections = that.sections.values;
+ for (var j=0; j<sections.length; j++) {
+ sections[j].entity_name = entity_name;
}
});
@@ -97,7 +97,7 @@ IPA.dialog = function(spec) {
};
that.add_section = function(section) {
- that.sections.push(section);
+ that.sections.put(section.name, section);
return that;
};
@@ -123,8 +123,9 @@ IPA.dialog = function(spec) {
field.init();
}
- for (var j=0; j<that.sections.length; j++) {
- var section = that.sections[j];
+ var sections = that.sections.values;
+ for (var j=0; j<sections.length; j++) {
+ var section = sections[j];
section.entity_name = that.entity_name;
section.init();
}
@@ -158,8 +159,9 @@ IPA.dialog = function(spec) {
field.create(span);
}
- for (var j=0; j<that.sections.length; j++) {
- var section = that.sections[j];
+ var sections = that.sections.values;
+ for (var j=0; j<sections.length; j++) {
+ var section = sections[j];
var div = $('<div/>', {
name: section.name,
@@ -182,8 +184,9 @@ IPA.dialog = function(spec) {
field.setup(span);
}
- for (var j=0; j<that.sections.length; j++) {
- var section = that.sections[j];
+ var sections = that.sections.values;
+ for (var j=0; j<sections.length; j++) {
+ var section = sections[j];
var div = $('div.details-section[name='+section.name+']',
that.container);
@@ -251,8 +254,9 @@ IPA.dialog = function(spec) {
record[field.name] = values.join(',');
}
- for (var j=0; j<that.sections.length; j++) {
- var section = that.sections[j];
+ var sections = that.sections.values;
+ for (var j=0; j<sections.length; j++) {
+ var section = sections[j];
if (section.save) {
section.save(record);
@@ -271,8 +275,10 @@ IPA.dialog = function(spec) {
var field = fields[i];
field.reset();
}
- for (var j=0; j<that.sections.length; j++) {
- that.sections[j].reset();
+
+ var sections = that.sections.values;
+ for (var j=0; j<sections.length; j++) {
+ sections[j].reset();
}
};