Remove wrong binding from sprint create directive.

stable
Andrey Antukh 2014-07-09 17:44:06 +02:00
parent 38ecae0726
commit b315dc2f71
3 changed files with 27 additions and 12 deletions

View File

@ -104,6 +104,7 @@ CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope) ->
return {link: link} return {link: link}
CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) -> CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) ->
link = ($scope, $el, attrs) -> link = ($scope, $el, attrs) ->
$scope.form = {data: ""} $scope.form = {data: ""}
@ -135,12 +136,10 @@ CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) ->
return {link: link} return {link: link}
CreateEditSprint = ($repo, $confirm, $rs, $rootscope) -> CreateEditSprint = ($repo, $confirm, $rs, $rootscope) ->
link = ($scope, $el, attrs) -> link = ($scope, $el, attrs) ->
createSprint = true createSprint = true
$scope.milestonesCounter = "--"
bindOnce $scope, "sprints", (sprints) ->
$scope.milestonesCounter = sprints.length
submit = -> submit = ->
form = $el.find("form").checksley() form = $el.find("form").checksley()
@ -153,9 +152,7 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope) ->
promise = $repo.save($scope.sprint) promise = $repo.save($scope.sprint)
promise.then (data) -> promise.then (data) ->
if createSprint $scope.sprintsCounter += 1 if createSprint
$scope.milestonesCounter += 1
$el.addClass("hidden") $el.addClass("hidden")
$rootscope.$broadcast("sprintform:create:success", data) $rootscope.$broadcast("sprintform:create:success", data)
@ -221,8 +218,25 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope) ->
module = angular.module("taigaBacklog") module = angular.module("taigaBacklog")
module.directive("tgLbCreateEditUserstory", ["$tgRepo", "$tgModel", "$tgResources", "$rootScope", module.directive("tgLbCreateEditUserstory", [
CreateEditUserstoryDirective]) "$tgRepo",
module.directive("tgLbCreateBulkUserstories", ["$tgRepo", "$tgResources", "$rootScope", "$tgModel",
CreateBulkUserstoriesDirective]) "$tgResources",
module.directive("tgLbCreateEditSprint", ["$tgRepo", "$tgConfirm", "$tgResources", "$rootScope", CreateEditSprint]) "$rootScope",
CreateEditUserstoryDirective
])
module.directive("tgLbCreateBulkUserstories", [
"$tgRepo",
"$tgResources",
"$rootScope",
CreateBulkUserstoriesDirective
])
module.directive("tgLbCreateEditSprint", [
"$tgRepo",
"$tgConfirm",
"$tgResources",
"$rootScope",
CreateEditSprint
])

View File

@ -72,6 +72,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
loadSprints: -> loadSprints: ->
return @rs.sprints.list(@scope.projectId).then (sprints) => return @rs.sprints.list(@scope.projectId).then (sprints) =>
@scope.sprints = sprints @scope.sprints = sprints
@scope.sprintsCounter = sprints.length
return sprints return sprints
loadUserstories: -> loadUserstories: ->

View File

@ -4,7 +4,7 @@ section.sprints
div.summary div.summary
ul ul
li li
span.number(ng-bind="milestonesCounter") -- span.number(tg-bind-html="sprintsCounter") --
span.description <br/>sprints span.description <br/>sprints
div.new-sprint div.new-sprint
a.button.button-green(ng-click="ctrl.addNewSprint()", href="", title="Add New US") a.button.button-green(ng-click="ctrl.addNewSprint()", href="", title="Add New US")