Removing sprints from backlog
parent
c0fb543dc6
commit
bfa66bdad4
|
@ -135,8 +135,9 @@ CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) ->
|
|||
|
||||
return {link: link}
|
||||
|
||||
CreateSprint = ($repo, $rs, $rootscope) ->
|
||||
CreateEditSprint = ($repo, $confirm, $rs, $rootscope) ->
|
||||
link = ($scope, $el, attrs) ->
|
||||
createSprint = true
|
||||
$scope.milestonesCounter = "--"
|
||||
bindOnce $scope, "sprints", (sprints) ->
|
||||
$scope.milestonesCounter = sprints.length
|
||||
|
@ -146,17 +147,34 @@ CreateSprint = ($repo, $rs, $rootscope) ->
|
|||
if not form.validate()
|
||||
return
|
||||
|
||||
promise = $repo.create("milestones", $scope.sprint)
|
||||
if createSprint
|
||||
promise = $repo.create("milestones", $scope.sprint)
|
||||
else
|
||||
promise = $repo.save($scope.sprint)
|
||||
|
||||
promise.then (data) ->
|
||||
$scope.milestonesCounter += 1
|
||||
if createSprint
|
||||
$scope.milestonesCounter += 1
|
||||
|
||||
$el.addClass("hidden")
|
||||
$rootscope.$broadcast("sprintform:create:success", data)
|
||||
|
||||
promise.then null, (data) ->
|
||||
form.setErrors(data)
|
||||
|
||||
remove = ->
|
||||
#TODO: i18n
|
||||
title = "Delete sprint"
|
||||
subtitle = $scope.sprint.name
|
||||
|
||||
$confirm.ask(title, subtitle).then =>
|
||||
$repo.remove($scope.sprint).then ->
|
||||
$scope.milestonesCounter -= 1
|
||||
$el.addClass("hidden")
|
||||
$rootscope.$broadcast("sprintform:remove:success")
|
||||
|
||||
$scope.$on "sprintform:create", ->
|
||||
$el.removeClass("hidden")
|
||||
createSprint = true
|
||||
$scope.sprint = {
|
||||
project: $scope.projectId
|
||||
name: null
|
||||
|
@ -169,6 +187,21 @@ CreateSprint = ($repo, $rs, $rootscope) ->
|
|||
if sprintName?
|
||||
lastSprintNameDom.html(" last sprint is <strong> #{sprintName} ;-) </strong>")
|
||||
|
||||
$el.find(".delete-sprint").hide()
|
||||
$el.find(".title").text("New sprint") #TODO i18n
|
||||
$el.find(".button-green").text("Create") #TODO i18n
|
||||
$el.removeClass("hidden")
|
||||
|
||||
$scope.$on "sprintform:edit", (ctx, sprint) ->
|
||||
createSprint = false
|
||||
$scope.$apply ->
|
||||
$scope.sprint = sprint
|
||||
|
||||
$el.find(".delete-sprint").show()
|
||||
$el.find(".title").text("Edit sprint") #TODO i18n
|
||||
$el.find(".button-green").text("Save") #TODO i18n
|
||||
$el.removeClass("hidden")
|
||||
|
||||
$el.on "click", ".close", (event) ->
|
||||
event.preventDefault()
|
||||
$el.addClass("hidden")
|
||||
|
@ -177,6 +210,10 @@ CreateSprint = ($repo, $rs, $rootscope) ->
|
|||
event.preventDefault()
|
||||
submit()
|
||||
|
||||
$el.on "click", ".delete-sprint .icon-delete", (event) ->
|
||||
event.preventDefault()
|
||||
remove()
|
||||
|
||||
$scope.$on "$destroy", ->
|
||||
$el.off()
|
||||
|
||||
|
@ -188,4 +225,4 @@ module.directive("tgLbCreateEditUserstory", ["$tgRepo", "$tgModel", "$tgResource
|
|||
CreateEditUserstoryDirective])
|
||||
module.directive("tgLbCreateBulkUserstories", ["$tgRepo", "$tgResources", "$rootScope",
|
||||
CreateBulkUserstoriesDirective])
|
||||
module.directive("tgLbCreateSprint", ["$tgRepo", "$tgResources", "$rootScope", CreateSprint])
|
||||
module.directive("tgLbCreateEditSprint", ["$tgRepo", "$tgConfirm", "$tgResources", "$rootScope", CreateEditSprint])
|
||||
|
|
|
@ -57,6 +57,8 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
|||
@scope.$on("usform:bulk:success", @.loadUserstories)
|
||||
@scope.$on("sprintform:create:success", @.loadSprints)
|
||||
@scope.$on("sprintform:create:success", @.loadProjectStats)
|
||||
@scope.$on("sprintform:remove:success", @.loadSprints)
|
||||
@scope.$on("sprintform:remove:success", @.loadProjectStats)
|
||||
@scope.$on("usform:new:success", @.loadUserstories)
|
||||
@scope.$on("usform:edit:success", @.loadUserstories)
|
||||
|
||||
|
@ -402,7 +404,7 @@ BacklogDirective = ($repo, $rootscope) ->
|
|||
## Sprint Directive
|
||||
#############################################################################
|
||||
|
||||
BacklogSprintDirective = ($repo) ->
|
||||
BacklogSprintDirective = ($repo, $rootscope) ->
|
||||
|
||||
#########################
|
||||
## Common parts
|
||||
|
@ -430,6 +432,9 @@ BacklogSprintDirective = ($repo) ->
|
|||
target.toggleClass('active')
|
||||
$el.find(".sprint-table").toggleClass('open')
|
||||
|
||||
$el.on "click", ".sprint-name > .icon-edit", (event) ->
|
||||
$rootscope.$broadcast("sprintform:edit", sprint)
|
||||
|
||||
#########################
|
||||
## Drag & Drop Link
|
||||
#########################
|
||||
|
@ -819,7 +824,7 @@ GmBacklogGraphDirective = ->
|
|||
|
||||
|
||||
module.directive("tgBacklog", ["$tgRepo", "$rootScope", BacklogDirective])
|
||||
module.directive("tgBacklogSprint", ["$tgRepo", BacklogSprintDirective])
|
||||
module.directive("tgBacklogSprint", ["$tgRepo", "$rootScope", BacklogSprintDirective])
|
||||
module.directive("tgUsPoints", ["$tgRepo", UsPointsDirective])
|
||||
module.directive("tgUsRolePointsSelector", ["$rootScope", UsRolePointsSelectorDirective])
|
||||
module.directive("tgGmBacklogGraph", GmBacklogGraphDirective)
|
||||
|
|
|
@ -32,5 +32,5 @@ block content
|
|||
include views/modules/lightbox_add-new-us
|
||||
div.lightbox.lightbox_add-bulk.hidden(tg-lb-create-bulk-userstories)
|
||||
include views/modules/lightbox_add-bulk
|
||||
div.lightbox.lightbox_add-sprint.hidden(tg-lb-create-sprint)
|
||||
include views/modules/lightbox_add-sprint
|
||||
div.lightbox.lightbox_add-sprint.hidden(tg-lb-create-edit-sprint)
|
||||
include views/modules/lightbox_add-edit-sprint
|
||||
|
|
|
@ -10,6 +10,5 @@ form
|
|||
input.date-end(tg-date-selector, ng-model="sprint.estimated_finish", type="text", placeholder="Estimated End", data-required="true")
|
||||
a.button.button-green(href="", title="Save")
|
||||
span Create
|
||||
//-Should be only visible when in editable lightbox
|
||||
span.delete-sprint Do you want to delete this sprint?
|
||||
a.icon.icon-delete(href="", title="delete sprint")
|
||||
span.delete-sprint.hidden Do you want to delete this sprint?
|
||||
a.icon.icon-delete(href="", title="delete sprint")
|
Loading…
Reference in New Issue