Skip to content

Commit

Permalink
Merge pull request #879 from markwal/onSettingsShown
Browse files Browse the repository at this point in the history
onSettingsShown/Hidden call only on parent dialog shown/hidden
  • Loading branch information
foosel committed May 5, 2015
2 parents 84cda5c + dbc2fe9 commit 3e5298f
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/octoprint/static/js/app/viewmodels/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,23 @@ $(function() {
};

self.onAllBound = function(allViewModels) {
self.settingsDialog.on('show', function() {
_.each(allViewModels, function(viewModel) {
if (viewModel.hasOwnProperty("onSettingsShown")) {
viewModel.onSettingsShown();
}
});
self.settingsDialog.on('show', function(event) {
if (event.target.id == "settings_dialog") {
_.each(allViewModels, function(viewModel) {
if (viewModel.hasOwnProperty("onSettingsShown")) {
viewModel.onSettingsShown();
}
});
}
});
self.settingsDialog.on('hidden', function() {
_.each(allViewModels, function(viewModel) {
if (viewModel.hasOwnProperty("onSettingsHidden")) {
viewModel.onSettingsHidden();
}
});
if (event.target.id == "settings_dialog") {
_.each(allViewModels, function(viewModel) {
if (viewModel.hasOwnProperty("onSettingsHidden")) {
viewModel.onSettingsHidden();
}
});
}
});
self.settingsDialog.on('beforeSave', function () {
_.each(allViewModels, function (viewModel) {
Expand Down

0 comments on commit 3e5298f

Please sign in to comment.