Fixed memory leak caused by is_dirty dialogs.

Ticket 1054
This commit is contained in:
Endi S. Dewata 2011-03-04 15:05:02 -06:00 committed by Adam Young
parent f4b8b36959
commit 8b041cd1a3
2 changed files with 26 additions and 27 deletions

View File

@ -351,24 +351,21 @@ IPA.association_table_widget = function (spec) {
that.table_setup(container); that.table_setup(container);
var dialog = $('<div/>', { var dialog = IPA.dialog({
html: IPA.messages.dialogs.dirty_message title: IPA.messages.dialogs.dirty_title,
}).appendTo(container); width: '20em'
});
var buttons = {}; dialog.create = function() {
dialog.container.append(IPA.messages.dialogs.dirty_message);
buttons[IPA.messages.buttons.ok] = function() {
dialog.dialog('close');
}; };
dialog.dialog({ dialog.add_button(IPA.messages.buttons.ok, function() {
autoOpen: false, dialog.close();
title: IPA.messages.dialogs.dirty_title,
modal: true,
width: '20em',
buttons: buttons
}); });
dialog.init();
var entity = IPA.get_entity(that.entity_name); var entity = IPA.get_entity(that.entity_name);
var facet_name = IPA.current_facet(entity); var facet_name = IPA.current_facet(entity);
var facet = entity.get_facet(facet_name); var facet = entity.get_facet(facet_name);
@ -383,7 +380,7 @@ IPA.association_table_widget = function (spec) {
} }
if (facet.is_dirty()) { if (facet.is_dirty()) {
dialog.dialog('open'); dialog.open(that.container);
} else { } else {
that.show_remove_dialog(); that.show_remove_dialog();
} }
@ -402,7 +399,7 @@ IPA.association_table_widget = function (spec) {
} }
if (facet.is_dirty()) { if (facet.is_dirty()) {
dialog.dialog('open'); dialog.open(that.container);
} else { } else {
that.show_add_dialog(); that.show_add_dialog();
} }

View File

@ -135,24 +135,26 @@ var IPA = ( function () {
if (IPA.current_entity){ if (IPA.current_entity){
var facet_name = IPA.current_facet(IPA.current_entity); var facet_name = IPA.current_facet(IPA.current_entity);
var facet = IPA.current_entity.facets_by_name[facet_name]; var facet = IPA.current_entity.facets_by_name[facet_name];
if (facet.is_dirty()){ if (facet.is_dirty()){
var message_box = $("<div/>",{
html: IPA.messages.dialogs.dirty_message
}).
appendTo($("#navigation"));
var buttons = {}; var dialog = IPA.dialog({
title: IPA.messages.dialogs.dirty_title,
width: '20em'
});
buttons[IPA.messages.buttons.ok] = function() { dialog.create = function() {
$(this).dialog("close"); dialog.container.append(IPA.messages.dialogs.dirty_message);
}; };
message_box.dialog({ dialog.add_button(IPA.messages.buttons.ok, function() {
title: IPA.messages.dialogs.dirty_title, dialog.close();
modal:true,
width: '20em',
buttons: buttons
}); });
dialog.init();
dialog.open($('#navigation'));
return false; return false;
} }
} }