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

View File

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