Fix bug #1017
parent
7fe5a10fa8
commit
47b94f95d7
|
@ -49,7 +49,6 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService, $loading)
|
||||||
newSprint.estimated_start = moment(newSprint.estimated_start).format("YYYY-MM-DD")
|
newSprint.estimated_start = moment(newSprint.estimated_start).format("YYYY-MM-DD")
|
||||||
newSprint.estimated_finish = moment(newSprint.estimated_finish).format("YYYY-MM-DD")
|
newSprint.estimated_finish = moment(newSprint.estimated_finish).format("YYYY-MM-DD")
|
||||||
promise = $repo.create("milestones", newSprint)
|
promise = $repo.create("milestones", newSprint)
|
||||||
|
|
||||||
else
|
else
|
||||||
newSprint.setAttr("estimated_start", moment(newSprint.estimated_start).format("YYYY-MM-DD"))
|
newSprint.setAttr("estimated_start", moment(newSprint.estimated_start).format("YYYY-MM-DD"))
|
||||||
newSprint.setAttr("estimated_finish", moment(newSprint.estimated_finish).format("YYYY-MM-DD"))
|
newSprint.setAttr("estimated_finish", moment(newSprint.estimated_finish).format("YYYY-MM-DD"))
|
||||||
|
@ -91,19 +90,26 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService, $loading)
|
||||||
$scope.sprint.project = projectId
|
$scope.sprint.project = projectId
|
||||||
$scope.sprint.name = null
|
$scope.sprint.name = null
|
||||||
$scope.sprint.slug = null
|
$scope.sprint.slug = null
|
||||||
|
|
||||||
|
lastSprint = $scope.sprints[0]
|
||||||
|
|
||||||
|
estimatedStart = moment()
|
||||||
if $scope.sprint.estimated_start
|
if $scope.sprint.estimated_start
|
||||||
$scope.sprint.estimated_start = moment($scope.sprint.estimated_start).format("DD MMM YYYY")
|
estimatedStart = moment($scope.sprint.estimated_start)
|
||||||
else
|
else if lastSprint?
|
||||||
$scope.sprint.estimated_start = moment().format("DD MMM YYYY")
|
estimatedStart = moment(lastSprint.estimated_finish)
|
||||||
|
$scope.sprint.estimated_start = estimatedStart.format("DD MMM YYYY")
|
||||||
|
|
||||||
|
estimatedFinish = moment().add(2, "weeks")
|
||||||
if $scope.sprint.estimated_finish
|
if $scope.sprint.estimated_finish
|
||||||
$scope.sprint.estimated_finish = moment($scope.sprint.estimated_finish).format("DD MMM YYYY")
|
estimatedFinish = moment($scope.sprint.estimated_finish)
|
||||||
else
|
else if lastSprint?
|
||||||
$scope.sprint.estimated_finish = moment().format("DD MMM YYYY")
|
estimatedFinish = moment(lastSprint.estimated_finish).add(2, "weeks")
|
||||||
|
$scope.sprint.estimated_finish = estimatedFinish.format("DD MMM YYYY")
|
||||||
|
|
||||||
lastSprintNameDom = $el.find(".last-sprint-name")
|
lastSprintNameDom = $el.find(".last-sprint-name")
|
||||||
sprintName = $scope.sprints?[0]?.name
|
if lastSprint?.name?
|
||||||
if sprintName?
|
lastSprintNameDom.html(" last sprint is <strong> #{lastSprint.name} ;-) </strong>")
|
||||||
lastSprintNameDom.html(" last sprint is <strong> #{sprintName} ;-) </strong>")
|
|
||||||
|
|
||||||
$el.find(".delete-sprint").hide()
|
$el.find(".delete-sprint").hide()
|
||||||
$el.find(".title").text("New sprint") #TODO i18n
|
$el.find(".title").text("New sprint") #TODO i18n
|
||||||
|
|
|
@ -99,12 +99,9 @@ DateSelectorDirective =->
|
||||||
$scope.$watch $attrs.lessThan, (val) ->
|
$scope.$watch $attrs.lessThan, (val) ->
|
||||||
$el.picker.setMaxDate(moment(val))
|
$el.picker.setMaxDate(moment(val))
|
||||||
|
|
||||||
$scope.$on "sprints:loaded", (ctx, sprints) =>
|
|
||||||
if sprints.length > 0
|
$scope.$watch $attrs.ngModel, (val) ->
|
||||||
estimatedStart = sprints[0].estimated_finish
|
$el.picker.setDate(val) if val?
|
||||||
selectedDate = estimatedStart
|
|
||||||
$el.val(moment(estimatedStart).format("DD MMM YYYY"))
|
|
||||||
$el.picker.setDate(estimatedStart)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
link: link
|
link: link
|
||||||
|
|
Loading…
Reference in New Issue