Refreshing number of sprints when creating a new one

stable
Alejandro Alonso 2014-06-30 09:16:45 +02:00
parent 48568705cf
commit f7ecb95485
2 changed files with 7 additions and 2 deletions

View File

@ -166,6 +166,10 @@ CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) ->
CreateSprint = ($repo, $rs, $rootscope) -> CreateSprint = ($repo, $rs, $rootscope) ->
link = ($scope, $el, attrs) -> link = ($scope, $el, attrs) ->
$scope.milestonesCounter = "--"
bindOnce $scope, "stats", (stats) ->
$scope.milestonesCounter = stats.milestones.length
submit = -> submit = ->
form = $el.find("form").checksley() form = $el.find("form").checksley()
if not form.validate() if not form.validate()
@ -173,6 +177,7 @@ CreateSprint = ($repo, $rs, $rootscope) ->
promise = $repo.create("milestones", $scope.sprint) promise = $repo.create("milestones", $scope.sprint)
promise.then (data) -> promise.then (data) ->
$scope.milestonesCounter += 1
$el.addClass("hidden") $el.addClass("hidden")
$rootscope.$broadcast("sprintform:create:success", data) $rootscope.$broadcast("sprintform:create:success", data)
@ -191,7 +196,7 @@ CreateSprint = ($repo, $rs, $rootscope) ->
lastSprintNameDom = $el.find(".last-sprint-name") lastSprintNameDom = $el.find(".last-sprint-name")
sprintName = $scope.sprints?[0].name sprintName = $scope.sprints?[0].name
if sprintName? if sprintName?
lastSprintNameDom.text(" last sprint is <strong> #{sprintName} ;-) </strong>") lastSprintNameDom.html(" last sprint is <strong> #{sprintName} ;-) </strong>")
$el.on "click", ".close", (event) -> $el.on "click", ".close", (event) ->
event.preventDefault() event.preventDefault()

View File

@ -4,7 +4,7 @@ section.sprints
div.summary div.summary
ul ul
li li
span.number(tg-bo-html="stats.total_milestones") -- span.number(ng-bind="milestonesCounter") --
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")