Add sprintId to bulk issues

stable
Álex Hermida 2018-07-11 08:49:32 +02:00 committed by Alex Hermida
parent 580ee04fa2
commit e63b1be5e0
4 changed files with 15 additions and 9 deletions

View File

@ -33,20 +33,21 @@ module = angular.module("taigaIssues")
## Issue Bulk Create Lightbox Directive ## Issue Bulk Create Lightbox Directive
############################################################################# #############################################################################
CreateBulkIssuesDirective = ($repo, $rs, $confirm, $rootscope, $loading, lightboxService) -> CreateBulkIssuesDirective = ($repo, $rs, $confirm, $rootscope, $loading, lightboxService, $model) ->
link = ($scope, $el, attrs) -> link = ($scope, $el, attrs) ->
form = null form = null
$scope.$on "issueform:bulk", (ctx, projectId, status)-> $scope.$on "issueform:bulk", (ctx, projectId, milestoneId, status)->
form.reset() if form form.reset() if form
lightboxService.open($el) lightboxService.open($el)
$scope.new = { $scope.new = {
projectId: projectId projectId: projectId,
milestoneId: milestoneId,
bulk: "" bulk: ""
} }
submit = debounce 2000, (event) => submit = debounce 2000, (event) ->
event.preventDefault() event.preventDefault()
form = $el.find("form").checksley() form = $el.find("form").checksley()
@ -59,9 +60,11 @@ CreateBulkIssuesDirective = ($repo, $rs, $confirm, $rootscope, $loading, lightbo
data = $scope.new.bulk data = $scope.new.bulk
projectId = $scope.new.projectId projectId = $scope.new.projectId
milestoneId = $scope.new.milestoneId
promise = $rs.issues.bulkCreate(projectId, data) promise = $rs.issues.bulkCreate(projectId, milestoneId, data)
promise.then (result) -> promise.then (result) ->
result = _.map(result.data, (x) -> $model.make_model('issues', x))
currentLoading.finish() currentLoading.finish()
$rootscope.$broadcast("issueform:new:success", result) $rootscope.$broadcast("issueform:new:success", result)
lightboxService.close($el) lightboxService.close($el)
@ -81,4 +84,4 @@ CreateBulkIssuesDirective = ($repo, $rs, $confirm, $rootscope, $loading, lightbo
return {link: link} return {link: link}
module.directive("tgLbCreateBulkIssues", ["$tgRepo", "$tgResources", "$tgConfirm", "$rootScope", "$tgLoading", module.directive("tgLbCreateBulkIssues", ["$tgRepo", "$tgResources", "$tgConfirm", "$rootScope", "$tgLoading",
"lightboxService", CreateBulkIssuesDirective]) "lightboxService", "$tgModel", CreateBulkIssuesDirective])

View File

@ -57,9 +57,9 @@ resourceProvider = ($repo, $http, $urls, $storage, $q) ->
service.storeQueryParams(projectId, params) service.storeQueryParams(projectId, params)
return $repo.queryMany("issues", params) return $repo.queryMany("issues", params)
service.bulkCreate = (projectId, data) -> service.bulkCreate = (projectId, milestoneId, data) ->
url = $urls.resolve("bulk-create-issues") url = $urls.resolve("bulk-create-issues")
params = {project_id: projectId, bulk_issues: data} params = {project_id: projectId, milestone_id: milestoneId, bulk_issues: data}
return $http.post(url, params) return $http.post(url, params)
service.upvote = (issueId) -> service.upvote = (issueId) ->

View File

@ -594,7 +594,7 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin, taiga
'sprintId': @scope.sprintId 'sprintId': @scope.sprintId
}) })
when "standard" then @rootscope.$broadcast("taskform:new", @scope.sprintId, us?.id) when "standard" then @rootscope.$broadcast("taskform:new", @scope.sprintId, us?.id)
when "bulk" then @rootscope.$broadcast("taskform:bulk", @scope.sprintId, us?.id) when "bulk" then @rootscope.$broadcast("issueform:bulk", @scope.projectId, @scope.sprintId)
toggleFold: (id) -> toggleFold: (id) ->
@taskboardTasksService.toggleFold(id) @taskboardTasksService.toggleFold(id)

View File

@ -52,5 +52,8 @@ div.wrapper(
div.lightbox.lightbox-generic-bulk.lightbox-task-bulk(tg-lb-create-bulk-tasks) div.lightbox.lightbox-generic-bulk.lightbox-task-bulk(tg-lb-create-bulk-tasks)
include ../includes/modules/lightbox-task-bulk include ../includes/modules/lightbox-task-bulk
div.lightbox.lightbox-generic-bulk(tg-lb-create-bulk-issues)
include ../includes/modules/lightbox-issue-bulk
div.lightbox.lightbox-select-user(tg-lb-assignedto) div.lightbox.lightbox-select-user(tg-lb-assignedto)
include ../common/lightbox/lightbox-assigned-to include ../common/lightbox/lightbox-assigned-to