Redo header bar to trim options when we can and make the repositories page the default landing page for logged in users

This commit is contained in:
Joseph Schorr 2015-04-08 15:15:21 -04:00
parent af468a8c6a
commit 2e3704f7ba
6 changed files with 47 additions and 32 deletions

View file

@ -5,20 +5,26 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse" style="padding: 0px; padding-left: 4px; padding-right: 4px;">
&equiv;
</button>
<a class="navbar-brand" href="/" target="{{ appLinkTarget() }}">
<a class="navbar-brand" ng-href="{{ user.anonymous ? '/' : '/repository/' }}" target="{{ appLinkTarget() }}">
<span id="quay-logo" ng-style="{'background-image': 'url(' + getEnterpriseLogo() + ')'}"></span>
</a>
</div>
<!-- Collapsable stuff -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav navbar-links">
<!-- Not signed in -->
<ul class="nav navbar-nav navbar-links" ng-if="user.anonymous">
<li><a ng-href="/tour/" target="{{ appLinkTarget() }}" quay-section="tour">Tour</a></li>
<li><a ng-href="/repository/" target="{{ appLinkTarget() }}" quay-section="repository">Repositories</a></li>
<li><a href="http://docs.quay.io/" target="_blank">Docs</a></li>
<li><a ng-href="/tutorial/" target="{{ appLinkTarget() }}" quay-section="tutorial">Tutorial</a></li>
<li quay-require="['BILLING']"><a ng-href="/plans/" target="{{ appLinkTarget() }}" quay-section="plans">Pricing</a></li>
<li><a ng-href="{{ user.organizations.length ? '/organizations/' : '/tour/organizations/' }}" target="{{ appLinkTarget() }}" quay-section="organization">Organizations</a></li>
<li><a href="http://docs.quay.io/" target="_blank">Docs</a></li>
</ul>
<!-- Signed in -->
<ul class="nav navbar-nav navbar-links" ng-if="!user.anonymous">
<li><a ng-href="/repository/" target="{{ appLinkTarget() }}" quay-section="repository">Repositories</a></li>
<li><a ng-href="/tutorial/" target="{{ appLinkTarget() }}" quay-section="tutorial">Tutorial</a></li>
<li><a href="http://docs.quay.io/" target="_blank">Docs</a></li>
</ul>
<!-- Phone -->
@ -118,7 +124,6 @@
Account Settings
</a>
</li>
<li><a ng-href="/organizations/" target="{{ appLinkTarget() }}">Organizations</a></li>
<li ng-if="user.super_user"><a href="/superuser/"><strong>Super User Admin Panel</strong></a></li>
<li><a href="javascript:void(0)" ng-click="signout()">Sign out</a></li>
</ul>

View file

@ -13,26 +13,30 @@ angular.module('quay').directive('headerBar', function () {
scope: {
},
controller: function($rootScope, $scope, $element, $location, $timeout, hotkeys, UserService, PlanService, ApiService, NotificationService, Config, CreateService) {
// Register hotkeys:
hotkeys.add({
combo: '/',
description: 'Show search',
callback: function(e) {
e.preventDefault();
e.stopPropagation();
$scope.toggleSearch();
}
});
$scope.isNewLayout = Config.isNewLayout();
hotkeys.add({
combo: 'alt+c',
description: 'Create new repository',
callback: function(e) {
e.preventDefault();
e.stopPropagation();
$location.url('/new');
}
});
if ($scope.isNewLayout) {
// Register hotkeys:
hotkeys.add({
combo: '/',
description: 'Show search',
callback: function(e) {
e.preventDefault();
e.stopPropagation();
$scope.toggleSearch();
}
});
hotkeys.add({
combo: 'alt+c',
description: 'Create new repository',
callback: function(e) {
e.preventDefault();
e.stopPropagation();
$location.url('/new');
}
});
}
$scope.notificationService = NotificationService;
$scope.searchVisible = false;
@ -43,7 +47,6 @@ angular.module('quay').directive('headerBar', function () {
// Monitor any user changes and place the current user into the scope.
UserService.updateUserIn($scope);
$scope.isNewLayout = Config.isNewLayout();
$scope.currentPageContext = {};

View file

@ -1,6 +1,7 @@
(function() {
/**
* Landing page.
* DEPRECATED: Remove the code for viewing when logged in.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('landing', 'landing.html', LandingCtrl, {
@ -8,7 +9,7 @@
});
}]);
function LandingCtrl($scope, UserService, ApiService, Features, Config) {
function LandingCtrl($scope, $location, UserService, ApiService, Features, Config) {
$scope.namespace = null;
$scope.currentScreenshot = 'repo-view';
@ -16,7 +17,12 @@
loadMyRepos(namespace);
});
UserService.updateUserIn($scope, function() {
UserService.updateUserIn($scope, function(user) {
if (!user.anonymous && Config.isNewLayout()) {
$location.path('/repository');
return;
}
loadMyRepos($scope.namespace);
});

View file

@ -1,6 +1,6 @@
(function() {
/**
* Page which displays the list of organizations of which the user is a member.
* DEPRECATED: Page which displays the list of organizations of which the user is a member.
*/
angular.module('quayPages').config(['pages', function(pages) {
pages.create('organizations', 'organizations.html', OrgsCtrl, {

View file

@ -12,7 +12,8 @@ function(ApiService, CookieService, $rootScope, Config) {
username: null,
email: null,
organizations: [],
logins: []
logins: [],
beforeload: true
}
var userService = {}

View file

@ -11,10 +11,10 @@
</div>
<!-- Loading -->
<div class="cor-loader" ng-if="loading"></div>
<div class="cor-loader" ng-if="loading || user.beforeload"></div>
<!-- Not signed in -->
<div class="co-main-content-panel" ng-if="!loading && user.anonymous">
<div class="co-main-content-panel" ng-if="!loading && user.anonymous && !user.beforeload">
<!-- The user is not logged in -->
<div class="cor-container signin-container row">