From 5ca4234dcfc974825d497e605ee2801aba71c42e Mon Sep 17 00:00:00 2001 From: jfucci Date: Wed, 7 Oct 2015 21:09:56 -0400 Subject: [PATCH 1/4] Multiple repository support --- client/app/projects/profile/profile.html | 8 ++- client/app/projects/profile/profile.scss | 6 ++- client/app/projects/projects.controller.js | 17 +++++-- client/app/projects/projects.html | 59 +++++++++++++--------- client/app/projects/projects.scss | 39 +++++++++++--- server/api/project/project.model.js | 2 +- 6 files changed, 91 insertions(+), 40 deletions(-) diff --git a/client/app/projects/profile/profile.html b/client/app/projects/profile/profile.html index d8f12909..b3419699 100644 --- a/client/app/projects/profile/profile.html +++ b/client/app/projects/profile/profile.html @@ -16,7 +16,13 @@

{{project.name}}

Join Project
Leave Project
Website - Repository + Repository +
+ +
Blog diff --git a/client/app/projects/profile/profile.scss b/client/app/projects/profile/profile.scss index 1ee1a16b..7f7cbbbe 100644 --- a/client/app/projects/profile/profile.scss +++ b/client/app/projects/profile/profile.scss @@ -148,4 +148,8 @@ desc textarea{ #nameDiv { margin-top: 30px -} \ No newline at end of file +} + +#repos { + display: block; +} diff --git a/client/app/projects/projects.controller.js b/client/app/projects/projects.controller.js index 1d709304..7e973d3b 100644 --- a/client/app/projects/projects.controller.js +++ b/client/app/projects/projects.controller.js @@ -3,7 +3,7 @@ angular.module('observatory3App') .controller('ProjectsCtrl', function ($scope, $location, $http) { $scope.projects = []; - $scope.projectToAdd = {active: true}; + $scope.projectToAdd = {active: true, repositories: [""]}; $scope.getCurrentProjects = function() { $http.get('/api/projects').success(function(projects) { @@ -20,10 +20,8 @@ angular.module('observatory3App') }; $scope.getInfo = function() { - if($scope.projectToAdd.repositoryUrl) { - var splitUrl = $scope.projectToAdd.repositoryUrl.split('/'); - $scope.projectToAdd.githubUsername = splitUrl[splitUrl.length - 2]; - $scope.projectToAdd.githubProjectName = $scope.projectToAdd.name = splitUrl[splitUrl.length - 1]; + if($scope.projectToAdd.githubUsername && $scope.projectToAdd.githubProjectName) { + $scope.projectToAdd.name = $scope.projectToAdd.githubProjectName; $.getJSON('https://api.github.com/repos/' + $scope.projectToAdd.githubUsername + '/' + $scope.projectToAdd.githubProjectName, function(response) { $scope.projectToAdd.websiteURL = response.homepage; $scope.projectToAdd.description = response.description; @@ -32,11 +30,20 @@ angular.module('observatory3App') } }; + $scope.addRepository = function() { + $scope.projectToAdd.repositories[$scope.projectToAdd.repositories.length] = ""; + } + + $scope.removeRepository = function(index) { + $scope.projectToAdd.repositories.splice(index, 1); + } + $scope.submit = function(form) { $scope.submitted = true; if(form.$valid) { $scope.submitted = false; + $scope.projectToAdd.repositories[0] = "https://github.com/" + $scope.projectToAdd.githubUsername + "/" + $scope.projectToAdd.githubProjectName; $('#addProject').modal('hide'); // use setTimeout because hiding the modal takes longer than the post request // and results in the modal disappearing but the overlay staying if not used diff --git a/client/app/projects/projects.html b/client/app/projects/projects.html index 45fd47cb..50df074d 100644 --- a/client/app/projects/projects.html +++ b/client/app/projects/projects.html @@ -26,13 +26,32 @@

{{ past ? "Past" : "Current" }} RCOS Projects