Skip to content

Commit

Permalink
Prevent creating a project without a name or budget
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Young committed Sep 11, 2016
1 parent 977f986 commit d814c09
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ goldfishControllers.controller('ProjectListCtrl', ['$scope','Projects','Clients'
});
$scope.saveProject = function(data, id) {
var project = new Projects(_.extend(data, {id: id}));
if (!project.budget) return "Please specify a budget";
if (!project.name) return "Please enter a name for the project";
return project.$save();
}
$scope.addProject = function() {
Expand All @@ -81,6 +83,8 @@ goldfishControllers.controller('ProjectViewCtrl', ['$scope','$routeParams','Proj
$scope.project = Projects.get({id:$routeParams.projectID});
$scope.saveProject = function(data, id) {
var project = new Projects(_.extend(data, {id: id}));
if (!project.budget) return "Please specify a budget";
if (!project.name) return "Please enter a name for the project";
return project.$save();
}
$scope.loadClients = function() {
Expand Down

0 comments on commit d814c09

Please sign in to comment.