Start on new repo page

This commit is contained in:
Joseph Schorr 2013-10-24 17:41:55 -04:00
parent 9dc9e0c940
commit 70fd9afb2b
7 changed files with 204 additions and 3 deletions

View file

@ -893,4 +893,42 @@ function V1Ctrl($scope, UserService) {
$scope.browseRepos = function() {
document.location = '/repository/';
};
}
function NewRepoCtrl($scope, UserService) {
$scope.repo = {
'is_public': 1,
'description': '',
'initialize': false
};
$scope.$watch( function () { return UserService.currentUser(); }, function (currentUser) {
$scope.user = currentUser;
if ($scope.user.anonymous) {
document.location = '/signin/';
}
}, true);
$scope.editDescription = function() {
if (!$scope.markdownDescriptionEditor) {
var converter = Markdown.getSanitizingConverter();
var editor = new Markdown.Editor(converter, '-description');
editor.run();
$scope.markdownDescriptionEditor = editor;
}
$('#wmd-input-description')[0].value = $scope.repo.description;
$('#editModal').modal({});
};
$scope.getMarkedDown = function(string) {
if (!string) { return ''; }
return getMarkedDown(string);
};
$scope.saveDescription = function() {
$('#editModal').modal('hide');
$scope.repo.description = $('#wmd-input-description')[0].value;
};
}