Redo the landing page to:

- Show the user's top repos if they have any
  - Show a link to the guide and the repos list if they do not

- Add a getting starting guide
- Redo the repos list to show the user's repos and the top 10 public repos separately
This commit is contained in:
Joseph Schorr 2013-10-02 00:28:24 -04:00
parent f12ed9859c
commit 927b280f1a
9 changed files with 220 additions and 23 deletions

View file

@ -77,6 +77,9 @@ function HeaderCtrl($scope, UserService) {
});
}
function GuideCtrl($scope, Restangular) {
}
function RepoListCtrl($scope, Restangular) {
$scope.getCommentFirstLine = function(commentString) {
return getMarkedDown(getFirstTextLine(commentString));
@ -89,12 +92,22 @@ function RepoListCtrl($scope, Restangular) {
$('.spin').spin();
$scope.loading = true;
$scope.public_repositories = null;
$scope.private_repositories = null;
// Load the list of repositories.
var repositoryFetch = Restangular.all('repository/');
repositoryFetch.getList().then(function(resp) {
$scope.repositories = resp.repositories;
$scope.loading = false;
// Load the list of personal repositories.
var repositoryPrivateFetch = Restangular.all('repository/');
repositoryPrivateFetch.getList({'public': false, 'sort': true}).then(function(resp) {
$scope.private_repositories = resp.repositories;
$scope.loading = !($scope.public_repositories && $scope.private_repositories);
});
// Load the list of public repositories.
var options = {'public': true, 'private': false, 'sort': true, 'limit': 10};
var repositoryPublicFetch = Restangular.all('repository/');
repositoryPublicFetch.getList(options).then(function(resp) {
$scope.public_repositories = resp.repositories;
$scope.loading = !($scope.public_repositories && $scope.private_repositories);
});
}
@ -103,12 +116,20 @@ function LandingCtrl($scope, $timeout, Restangular, UserService) {
$('.spin').spin();
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
if (!currentUser.anonymous) {
$scope.loadMyRepos();
}
$scope.user = currentUser;
}, true);
$scope.awaitingConfirmation = false;
$scope.registering = false;
$scope.getCommentFirstLine = function(commentString) {
return getMarkedDown(getFirstTextLine(commentString));
};
$scope.browseRepos = function() {
document.location = '/#/repository';
};
@ -130,6 +151,23 @@ function LandingCtrl($scope, $timeout, Restangular, UserService) {
});
});
};
$scope.loadMyRepos = function() {
$scope.loadingmyrepos = true;
// Load the list of repositories.
var params = {
'limit': 5,
'public': false,
'sort': true
};
var repositoryFetch = Restangular.all('repository/');
repositoryFetch.getList(params).then(function(resp) {
$scope.myrepos = resp.repositories;
$scope.loadingmyrepos = false;
});
};
}
function RepoCtrl($scope, Restangular, $routeParams, $rootScope) {