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,6 +189,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
};
$scope.createCard = function (stack, title) {
if (this['addCardForm' + stack].$valid) {
var newCard = {
'title': title,
'stackId': stack,
@@ -198,6 +199,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
$scope.stackservice.addCard(data);
$scope.newCard.title = '';
});
}
};
$scope.stackDelete = function (stack) {

View File

@@ -152,9 +152,12 @@
</ul>
<!-- CREATE CARD //-->
<div class="card create" ng-class="{emptyStack: !s.cards.length}"
ng-style="{'border-color':'#{{ boardservice.getCurrent().color }}'}" ng-if="boardservice.canEdit() && checkCanEdit() && params.filter!=='archive'">
<form ng-submit="createCard(s.id, newCard.title)">
<div
class="card create"
ng-class="{emptyStack: !s.cards.length}"
ng-style="{'border-color':'#{{ boardservice.getCurrent().color }}'}"
ng-if="boardservice.canEdit() && checkCanEdit() && params.filter !== 'archive'">
<form name="addCardForm{{ s.id }}" ng-submit="createCard(s.id, newCard.title)">
<h4 ng-if="status.addCard[s.id]">
<input type="text" autofocus-on-insert
ng-model="newCard.title"