Fix bug #1353: Update estimated dates in backlog when update an sprint
parent
576d5b31da
commit
ca4711d3f3
|
@ -21,44 +21,25 @@
|
||||||
|
|
||||||
taiga = @.taiga
|
taiga = @.taiga
|
||||||
|
|
||||||
mixOf = @.taiga.mixOf
|
|
||||||
toggleText = @.taiga.toggleText
|
|
||||||
scopeDefer = @.taiga.scopeDefer
|
|
||||||
bindOnce = @.taiga.bindOnce
|
|
||||||
groupBy = @.taiga.groupBy
|
|
||||||
|
|
||||||
module = angular.module("taigaBacklog")
|
module = angular.module("taigaBacklog")
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Sprint Directive
|
## Sprint Actions Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
BacklogSprintDirective = ($repo, $rootscope) ->
|
BacklogSprintDirective = ($repo, $rootscope) ->
|
||||||
## Common parts
|
link = ($scope, $el, $attrs) ->
|
||||||
linkCommon = ($scope, $el, $attrs, $ctrl) ->
|
$scope.$watch $attrs.tgBacklogSprint, (sprint) ->
|
||||||
sprint = $scope.$eval($attrs.tgBacklogSprint)
|
|
||||||
if $scope.$first
|
|
||||||
$el.addClass("sprint-current")
|
|
||||||
$el.find(".sprint-table").addClass('open')
|
|
||||||
|
|
||||||
else if sprint.closed
|
|
||||||
$el.addClass("sprint-closed")
|
|
||||||
|
|
||||||
else if not $scope.$first and not sprint.closed
|
|
||||||
$el.addClass("sprint-old-open")
|
|
||||||
|
|
||||||
# Update progress bars
|
|
||||||
$scope.$watch $attrs.tgBacklogSprint, (value) ->
|
|
||||||
sprint = $scope.$eval($attrs.tgBacklogSprint)
|
sprint = $scope.$eval($attrs.tgBacklogSprint)
|
||||||
|
|
||||||
if sprint.total_points
|
if $scope.$first
|
||||||
progressPercentage = Math.round(100 * (sprint.closed_points / sprint.total_points))
|
$el.addClass("sprint-current")
|
||||||
else
|
$el.find(".sprint-table").addClass('open')
|
||||||
progressPercentage = 0
|
else if sprint.closed
|
||||||
|
$el.addClass("sprint-closed")
|
||||||
$el.find(".current-progress").css("width", "#{progressPercentage}%")
|
else if not $scope.$first and not sprint.closed
|
||||||
|
$el.addClass("sprint-old-open")
|
||||||
$el.find(".sprint-table").disableSelection()
|
|
||||||
|
|
||||||
# Event Handlers
|
# Event Handlers
|
||||||
$el.on "click", ".sprint-name > .icon-arrow-up", (event) ->
|
$el.on "click", ".sprint-name > .icon-arrow-up", (event) ->
|
||||||
|
@ -67,15 +48,92 @@ BacklogSprintDirective = ($repo, $rootscope) ->
|
||||||
$el.find(".sprint-table").toggleClass('open')
|
$el.find(".sprint-table").toggleClass('open')
|
||||||
|
|
||||||
$el.on "click", ".sprint-name > .icon-edit", (event) ->
|
$el.on "click", ".sprint-name > .icon-edit", (event) ->
|
||||||
|
sprint = $scope.$eval($attrs.tgBacklogSprint)
|
||||||
$rootscope.$broadcast("sprintform:edit", sprint)
|
$rootscope.$broadcast("sprintform:edit", sprint)
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
|
||||||
$ctrl = $el.closest("div.wrapper").controller()
|
|
||||||
linkCommon($scope, $el, $attrs, $ctrl)
|
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
||||||
return {link: link}
|
return {link: link}
|
||||||
|
|
||||||
module.directive("tgBacklogSprint", ["$tgRepo", "$rootScope", BacklogSprintDirective])
|
module.directive("tgBacklogSprint", ["$tgRepo", "$rootScope", BacklogSprintDirective])
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
## Sprint Header Directive
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
BacklogSprintHeaderDirective = ($navUrls) ->
|
||||||
|
template = _.template("""
|
||||||
|
<div class="sprint-name">
|
||||||
|
<a class="icon icon-arrow-up" href="" title="Compact Sprint"></a>
|
||||||
|
|
||||||
|
<% if(isVisible){ %>
|
||||||
|
<a href="<%- taskboardUrl %>" title="'Go to the taskboard of '<%- name %>'">
|
||||||
|
<span><%- name %></span>
|
||||||
|
</a>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<% if(isEditable){ %>
|
||||||
|
<a class="icon icon-edit" href="" title="Edit Sprint"></a>
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sprint-summary">
|
||||||
|
<div class="sprint-date"><%- estimatedDateRange %></div>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<span class="number"><%- closedPoints %></span>
|
||||||
|
<span class="description">closed</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span class="number"><%- totalPoints %></span>
|
||||||
|
<span class="description">total</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
""")
|
||||||
|
|
||||||
|
link = ($scope, $el, $attrs, $model) ->
|
||||||
|
isEditable = ->
|
||||||
|
return $scope.project.my_permissions.indexOf("modify_milestone") != -1
|
||||||
|
|
||||||
|
isVisible = ->
|
||||||
|
return $scope.project.my_permissions.indexOf("view_milestones") != -1
|
||||||
|
|
||||||
|
render = (sprint) ->
|
||||||
|
taskboardUrl = $navUrls.resolve("project-taskboard",
|
||||||
|
{project: $scope.project.slug, sprint: sprint.slug})
|
||||||
|
|
||||||
|
start = moment(sprint.estimated_start).format("DD MMM YYYY")
|
||||||
|
finish = moment(sprint.estimated_finish).format("DD MMM YYYY")
|
||||||
|
estimatedDateRange = "#{start}-#{finish}"
|
||||||
|
|
||||||
|
ctx = {
|
||||||
|
name: sprint.name
|
||||||
|
taskboardUrl: taskboardUrl
|
||||||
|
estimatedDateRange: estimatedDateRange
|
||||||
|
closedPoints: sprint.closed_points or 0
|
||||||
|
totalPoints: sprint.total_points or 0
|
||||||
|
isVisible: isVisible()
|
||||||
|
isEditable: isEditable()
|
||||||
|
}
|
||||||
|
$el.html(template(ctx))
|
||||||
|
|
||||||
|
|
||||||
|
$scope.$watch $attrs.ngModel, (sprint) ->
|
||||||
|
render(sprint)
|
||||||
|
|
||||||
|
$scope.$on "sprintform:edit:success", ->
|
||||||
|
render($model.$modelValue)
|
||||||
|
|
||||||
|
$scope.$on "$destroy", ->
|
||||||
|
$el.off()
|
||||||
|
|
||||||
|
return {
|
||||||
|
link: link
|
||||||
|
restrict: "EA"
|
||||||
|
require: "ngModel"
|
||||||
|
}
|
||||||
|
|
||||||
|
module.directive("tgBacklogSprintHeader", ["$tgNavUrls", "$tgRepo", "$rootScope", BacklogSprintHeaderDirective])
|
||||||
|
|
|
@ -12,39 +12,23 @@ section.sprints
|
||||||
tg-check-permission="add_milestone")
|
tg-check-permission="add_milestone")
|
||||||
span.text + New sprint
|
span.text + New sprint
|
||||||
|
|
||||||
section.sprint(ng-repeat="sprint in sprints track by sprint.id"
|
section.sprint(ng-repeat="sprint in sprints track by sprint.id" tg-backlog-sprint="sprint")
|
||||||
tg-backlog-sprint="sprint")
|
header(tg-backlog-sprint-header, ng-model="sprint")
|
||||||
header
|
|
||||||
div.sprint-name
|
|
||||||
a.icon.icon-arrow-up(href="", title="Compact Sprint")
|
|
||||||
a(href="", tg-bo-title="'Go to Taskboard of ' + sprint.name",
|
|
||||||
tg-nav="project-taskboard:project=project.slug,sprint=sprint.slug",
|
|
||||||
tg-check-permission="view_milestones")
|
|
||||||
span {{ sprint.name }}
|
|
||||||
a.icon.icon-edit(tg-check-permission="modify_milestone", href="", title="Edit Sprint")
|
|
||||||
|
|
||||||
div.sprint-summary
|
div.sprint-progress-bar(tg-progress-bar="100 * sprint.closed_points / sprint.total_points")
|
||||||
div.sprint-date(tg-date-range="sprint.estimated_start,sprint.estimated_finish")
|
|
||||||
ul
|
|
||||||
li
|
|
||||||
span.number(ng-bind="sprint.closed_points|default:''") --
|
|
||||||
span.description closed
|
|
||||||
li
|
|
||||||
span.number(ng-bind="sprint.total_points|default:''")
|
|
||||||
span.description total
|
|
||||||
|
|
||||||
div.sprint-progress-bar(tg-progress-bar="100 * sprint.closed_points / total_points")
|
|
||||||
|
|
||||||
div.sprint-table(tg-sprint-sortable)
|
div.sprint-table(tg-sprint-sortable)
|
||||||
div.row.milestone-us-item-row(ng-repeat="us in sprint.user_stories track by us.id")
|
div.row.milestone-us-item-row(ng-repeat="us in sprint.user_stories track by us.id")
|
||||||
div.column-us.width-8
|
div.column-us.width-8
|
||||||
a.us-name.clickable(tg-nav="project-userstories-detail:project=project.slug,ref=us.ref",
|
a.us-name.clickable(tg-nav="project-userstories-detail:project=project.slug,ref=us.ref",
|
||||||
tg-bo-title="'#' + us.ref + ' ' + us.subject", ng-class="{closed: us.is_closed}")
|
tg-bo-title="'#' + us.ref + ' ' + us.subject",
|
||||||
|
ng-class="{closed: us.is_closed}")
|
||||||
span(tg-bo-ref="us.ref")
|
span(tg-bo-ref="us.ref")
|
||||||
span(tg-bo-bind="us.subject")
|
span(tg-bo-bind="us.subject")
|
||||||
div.column-points.width-1(tg-bo-bind="us.total_points", ng-class="{closed: us.is_closed}")
|
div.column-points.width-1(tg-bo-bind="us.total_points", ng-class="{closed: us.is_closed}")
|
||||||
|
|
||||||
a.button.button-gray(href="", tg-bo-title="'Go to Taskboard of ' + sprint.name",
|
a.button.button-gray(tg-bo-title="'Go to Taskboard of ' + sprint.name",
|
||||||
tg-nav="project-taskboard:project=project.slug,sprint=sprint.slug",
|
tg-nav="project-taskboard:project=project.slug,sprint=sprint.slug",
|
||||||
tg-check-permission="view_milestones")
|
tg-check-permission="view_milestones")
|
||||||
|
|
||||||
span Sprint Taskboard
|
span Sprint Taskboard
|
||||||
|
|
Loading…
Reference in New Issue