Implements validation when adding new cards

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
This commit is contained in:
Michael Weimann
2018-08-29 16:49:09 +02:00
committed by Julius Härtl
parent 84969180e2
commit d17cd78605
2 changed files with 17 additions and 12 deletions

View File

@@ -189,15 +189,17 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
};
$scope.createCard = function (stack, title) {
var newCard = {
'title': title,
'stackId': stack,
'type': 'plain'
};
CardService.create(newCard).then(function (data) {
$scope.stackservice.addCard(data);
$scope.newCard.title = '';
});
if (this['addCardForm' + stack].$valid) {
var newCard = {
'title': title,
'stackId': stack,
'type': 'plain'
};
CardService.create(newCard).then(function (data) {
$scope.stackservice.addCard(data);
$scope.newCard.title = '';
});
}
};
$scope.stackDelete = function (stack) {