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 #9594 from MarcelGerber/extman-tabs
Browse files Browse the repository at this point in the history
For #5852: Clicking an Extension Manager tab while still loading will show it
  • Loading branch information
prksingh committed Jan 28, 2015
2 parents ee71e73 + e6ccd1b commit b0d19fc
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions src/extensibility/ExtensionManagerDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,17 @@ define(function (require, exports, module) {
return searchDisabled;
}

function clearSearch() {
$search.val("");
views.forEach(function (view, index) {
view.filter("");
});

if (!updateSearchDisabled()) {
$search.focus();
}
}

// Open the dialog
dialog = Dialogs.showModalDialogUsingTemplate(Mustache.render(dialogTemplate, context));

Expand All @@ -311,10 +322,14 @@ define(function (require, exports, module) {
$searchClear = $(".search-clear", $dlg);

function setActiveTab($tab) {
models[_activeTabIndex].scrollPos = $(".modal-body", $dlg).scrollTop();
if (models[_activeTabIndex]) {
models[_activeTabIndex].scrollPos = $(".modal-body", $dlg).scrollTop();
}
$tab.tab("show");
$(".modal-body", $dlg).scrollTop(models[_activeTabIndex].scrollPos || 0);
$searchClear.click();
if (models[_activeTabIndex]) {
$(".modal-body", $dlg).scrollTop(models[_activeTabIndex].scrollPos || 0);
clearSearch();
}
}

// Dialog tabs
Expand Down Expand Up @@ -400,16 +415,7 @@ define(function (require, exports, module) {
views.forEach(function (view) {
view.filter(query);
});
}).on("click", ".search-clear", function (e) {
$search.val("");
views.forEach(function (view, index) {
view.filter("");
});

if (!updateSearchDisabled()) {
$search.focus();
}
});
}).on("click", ".search-clear", clearSearch);

// Disable the search field when there are no items in the model
models.forEach(function (model, index) {
Expand All @@ -420,8 +426,12 @@ define(function (require, exports, module) {
});
});

// Open dialog to Installed tab if extension updates are available
if ($("#toolbar-extension-manager").hasClass('updatesAvailable')) {
var $activeTab = $dlg.find(".nav-tabs li.active a");
if ($activeTab.length) { // If there's already a tab selected, show it
$activeTab.parent().removeClass("active"); // workaround for bootstrap-tab
$activeTab.tab("show");
} else if ($("#toolbar-extension-manager").hasClass('updatesAvailable')) {
// Open dialog to Installed tab if extension updates are available
$dlg.find(".nav-tabs a.installed").tab("show");
} else { // Otherwise show the first tab
$dlg.find(".nav-tabs a:first").tab("show");
Expand Down

0 comments on commit b0d19fc

Please sign in to comment.