Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #12805 from mansimarkaur/var_for_modal_in_dlg
Browse files Browse the repository at this point in the history
 Caching $(".modal-body", $dlg) in to its own variable
  • Loading branch information
zaggino committed Sep 28, 2016
2 parents 0aba2e0 + b407256 commit 9f50163
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/extensibility/ExtensionManagerDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ define(function (require, exports, module) {
views = [],
$search,
$searchClear,
$modalDlg,
context = { Strings: Strings, showRegistry: !!brackets.config.extension_registry },
models = [];

Expand All @@ -335,6 +336,7 @@ define(function (require, exports, module) {
$search.val("");
views.forEach(function (view, index) {
view.filter("");
$modalDlg.scrollTop(0);
});

if (!updateSearchDisabled()) {
Expand All @@ -360,14 +362,15 @@ define(function (require, exports, module) {
$dlg = dialog.getElement();
$search = $(".search", $dlg);
$searchClear = $(".search-clear", $dlg);
$modalDlg = $(".modal-body", $dlg);

function setActiveTab($tab) {
if (models[_activeTabIndex]) {
models[_activeTabIndex].scrollPos = $(".modal-body", $dlg).scrollTop();
models[_activeTabIndex].scrollPos = $modalDlg.scrollTop();
}
$tab.tab("show");
if (models[_activeTabIndex]) {
$(".modal-body", $dlg).scrollTop(models[_activeTabIndex].scrollPos || 0);
$modalDlg.scrollTop(models[_activeTabIndex].scrollPos || 0);
clearSearch();
}
}
Expand Down Expand Up @@ -434,7 +437,7 @@ define(function (require, exports, module) {
$(".spinner", $dlg).remove();

views.forEach(function (view) {
view.$el.appendTo($(".modal-body", $dlg));
view.$el.appendTo($modalDlg);
});

// Update search UI before new tab is shown
Expand All @@ -454,6 +457,7 @@ define(function (require, exports, module) {
var query = $(this).val();
views.forEach(function (view) {
view.filter(query);
$modalDlg.scrollTop(0);
});
}).on("click", ".search-clear", clearSearch);

Expand Down

0 comments on commit 9f50163

Please sign in to comment.