Fix tabs in the repo view

This commit is contained in:
Joseph Schorr 2015-03-31 14:40:34 -04:00
parent 9018cf14eb
commit 24b9fe5e48
2 changed files with 14 additions and 7 deletions

View file

@ -333,11 +333,14 @@ quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanServi
});
var activeTab = $location.search()['tab'];
var checkTabs = function() {
var tabs = $('a[data-toggle="tab"]');
if (tabs.length == 0) {
$timeout(checkTabs, 50);
return;
}
// Setup deep linking of tabs. This will change the search field of the URL whenever a tab
// is changed in the UI.
$timeout(function() {
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
tabs.on('shown.bs.tab', function (e) {
var tabName = e.target.getAttribute('data-target').substr(1);
$rootScope.$apply(function() {
var isDefaultTab = $('a[data-toggle="tab"]')[0] == e.target;
@ -357,7 +360,11 @@ quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanServi
if (activeTab) {
changeTab(activeTab);
}
}, 400); // 400ms to make sure angular has rendered.
};
// Setup deep linking of tabs. This will change the search field of the URL whenever a tab
// is changed in the UI.
$timeout(checkTabs, 50);
});
var initallyChecked = false;

View file

@ -37,12 +37,12 @@
<!-- Admin Only Tabs -->
<span class="cor-tab" tab-title="Usage Logs" tab-target="#logs" tab-init="showLogs()"
ng-if="viewScope.repository.can_admin">
ng-show="viewScope.repository.can_admin">
<i class="fa fa-bar-chart"></i>
</span>
<span class="cor-tab" tab-title="Settings" tab-target="#settings"
ng-if="viewScope.repository.can_admin">
ng-show="viewScope.repository.can_admin">
<i class="fa fa-gear"></i>
</span>
</div> <!-- /cor-tabs -->