Validate issue form

stable
David Barragán Merino 2014-08-07 11:01:37 +02:00
parent 0290e68b13
commit 4ba0e590f9
2 changed files with 7 additions and 3 deletions

View File

@ -138,9 +138,13 @@ IssueDirective = ($tgrepo, $log, $location, $confirm) ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
$ctrl = $el.controller() $ctrl = $el.controller()
form = $el.checksley()
linkSidebar($scope, $el, $attrs, $ctrl) linkSidebar($scope, $el, $attrs, $ctrl)
$el.on "click", ".save-issue", (event) -> $el.on "click", ".save-issue", (event) ->
if not form.validate()
return
$tgrepo.save($scope.issue).then -> $tgrepo.save($scope.issue).then ->
$confirm.notify("success") $confirm.notify("success")
$location.path("/project/#{$scope.project.slug}/issues/#{$scope.issue.ref}") $location.path("/project/#{$scope.project.slug}/issues/#{$scope.issue.ref}")

View File

@ -4,8 +4,8 @@ block head
title Taiga Project management web application with scrum in mind! title Taiga Project management web application with scrum in mind!
block content block content
div.wrapper(tg-issue-detail, ng-controller="IssueDetailController as ctrl", form.wrapper(tg-issue-detail, ng-controller="IssueDetailController as ctrl",
ng-init="section='issues'") ng-init="section='issues'")
div.main.us-detail div.main.us-detail
div.us-detail-header div.us-detail-header
include views/components/mainTitle include views/components/mainTitle
@ -13,7 +13,7 @@ block content
section.us-story-main-data section.us-story-main-data
div.us-title(ng-class="{blocked: issue.is_blocked}") div.us-title(ng-class="{blocked: issue.is_blocked}")
input(type="text", ng-model="issue.subject") input(type="text", ng-model="issue.subject", data-required="true", data-maxlength="500")
p.block-desc-container(ng-show="issue.is_blocked") p.block-desc-container(ng-show="issue.is_blocked")
span.block-description-title Blocked span.block-description-title Blocked
span.block-description(tg-bind-html="issue.blocked_note || 'This issue is blocked'") span.block-description(tg-bind-html="issue.blocked_note || 'This issue is blocked'")