fix issues and US create and bulk
parent
b3809b507c
commit
cb44f84e12
|
@ -335,8 +335,8 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
||||||
|
|
||||||
addNewUs: (type) ->
|
addNewUs: (type) ->
|
||||||
switch type
|
switch type
|
||||||
when "standard" then @rootscope.$broadcast("usform:new", @scope.project.default_us_status)
|
when "standard" then @rootscope.$broadcast("usform:new", @scope.projectId, @scope.project.default_us_status)
|
||||||
when "bulk" then @rootscope.$broadcast("usform:bulk")
|
when "bulk" then @rootscope.$broadcast("usform:bulk", @scope.projectId, @scope.project.default_us_status)
|
||||||
|
|
||||||
addNewSprint: () ->
|
addNewSprint: () ->
|
||||||
@rootscope.$broadcast("sprintform:create")
|
@rootscope.$broadcast("sprintform:create")
|
||||||
|
|
|
@ -72,11 +72,11 @@ CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
isNew = true
|
isNew = true
|
||||||
|
|
||||||
$scope.$on "usform:new", (ctx, statusId) ->
|
$scope.$on "usform:new", (ctx, projectId, status) ->
|
||||||
$scope.us = {
|
$scope.us = {
|
||||||
project: $scope.projectId
|
project: projectId
|
||||||
|
status: status
|
||||||
is_archived: false
|
is_archived: false
|
||||||
status: statusId or $scope.project.default_us_status
|
|
||||||
}
|
}
|
||||||
isNew = true
|
isNew = true
|
||||||
# Update texts for creation
|
# Update texts for creation
|
||||||
|
@ -113,7 +113,6 @@ CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope) ->
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
if not form.validate()
|
if not form.validate()
|
||||||
return
|
return
|
||||||
|
@ -166,11 +165,13 @@ module.directive("tgLbCreateEditUserstory", [
|
||||||
|
|
||||||
CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) ->
|
CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
$scope.form = {data: ""}
|
$scope.$on "usform:bulk", (ctx, projectId, status) ->
|
||||||
|
$scope.new = {
|
||||||
$scope.$on "usform:bulk", ->
|
projectId: projectId
|
||||||
|
statusId: status
|
||||||
|
bulk: ""
|
||||||
|
}
|
||||||
$el.removeClass("hidden")
|
$el.removeClass("hidden")
|
||||||
$scope.form = {data: ""}
|
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
$el.on "click", ".close", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -183,10 +184,7 @@ CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) ->
|
||||||
if not form.validate()
|
if not form.validate()
|
||||||
return
|
return
|
||||||
|
|
||||||
data = $scope.form.data
|
$rs.userstories.bulkCreate($scope.new.projectId, $scope.new.statusId, $scope.new.bulk).then (result) ->
|
||||||
projectId = $scope.projectId
|
|
||||||
|
|
||||||
$rs.userstories.bulkCreate(projectId, data).then (result) ->
|
|
||||||
$rootscope.$broadcast("usform:bulk:success", result)
|
$rootscope.$broadcast("usform:bulk:success", result)
|
||||||
$el.addClass("hidden")
|
$el.addClass("hidden")
|
||||||
|
|
||||||
|
|
|
@ -33,16 +33,16 @@ CreateIssueDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
$scope.issue = {}
|
$scope.issue = {}
|
||||||
|
|
||||||
$scope.$on "issueform:new", ->
|
$scope.$on "issueform:new", (ctx, project)->
|
||||||
$el.removeClass("hidden")
|
$el.removeClass("hidden")
|
||||||
|
|
||||||
$scope.issue = {
|
$scope.issue = {
|
||||||
project: $scope.projectId
|
project: project.id
|
||||||
subject: ""
|
subject: ""
|
||||||
status: $scope.project.default_issue_status
|
status: project.default_issue_status
|
||||||
type: $scope.project.default_issue_type
|
type: project.default_issue_type
|
||||||
priority: $scope.project.default_priority
|
priority: project.default_priority
|
||||||
severity: $scope.project.default_severity
|
severity: project.default_severity
|
||||||
estimated_start: null
|
estimated_start: null
|
||||||
estimated_finish: null
|
estimated_finish: null
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,6 @@ CreateIssueDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
||||||
submit = ->
|
submit = ->
|
||||||
console.log $scope.issue
|
|
||||||
if not form.validate()
|
if not form.validate()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -83,11 +82,12 @@ CreateIssueDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
|
|
||||||
CreateBulkIssuesDirective = ($repo, $rs, $rootscope) ->
|
CreateBulkIssuesDirective = ($repo, $rs, $rootscope) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
$scope.form = {data: "", usId: null}
|
$scope.$on "issueform:bulk", (ctx, projectId, status)->
|
||||||
|
|
||||||
$scope.$on "issueform:bulk", (ctx, sprintId, usId)->
|
|
||||||
$el.removeClass("hidden")
|
$el.removeClass("hidden")
|
||||||
$scope.form = {data: "", sprintId: sprintId, usId: usId}
|
$scope.new = {
|
||||||
|
projectId: projectId
|
||||||
|
bulk: ""
|
||||||
|
}
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
$el.on "click", ".close", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -100,12 +100,12 @@ CreateBulkIssuesDirective = ($repo, $rs, $rootscope) ->
|
||||||
if not form.validate()
|
if not form.validate()
|
||||||
return
|
return
|
||||||
|
|
||||||
data = $scope.form.data
|
data = $scope.new.bulk
|
||||||
projectId = $scope.projectId
|
projectId = $scope.new.projectId
|
||||||
|
|
||||||
promise = $rs.issues.bulkCreate(projectId, data)
|
promise = $rs.issues.bulkCreate(projectId, data)
|
||||||
promise.then (result) ->
|
promise.then (result) ->
|
||||||
$rootscope.$broadcast("issueform:bulk:success", result)
|
$rootscope.$broadcast("issueform:new:success", result)
|
||||||
$el.addClass("hidden")
|
$el.addClass("hidden")
|
||||||
|
|
||||||
# TODO: error handling
|
# TODO: error handling
|
||||||
|
|
|
@ -57,7 +57,7 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
console.log "FAIL" #TODO
|
console.log "FAIL" #TODO
|
||||||
|
|
||||||
@scope.$on "issueform:new:succcess", =>
|
@scope.$on "issueform:new:success", =>
|
||||||
@.loadIssues()
|
@.loadIssues()
|
||||||
@.loadFilters()
|
@.loadFilters()
|
||||||
|
|
||||||
|
@ -192,10 +192,10 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
|
|
||||||
# Functions used from templates
|
# Functions used from templates
|
||||||
addNewIssue: ->
|
addNewIssue: ->
|
||||||
@rootscope.$broadcast("issueform:new")
|
@rootscope.$broadcast("issueform:new", @scope.project)
|
||||||
|
|
||||||
addIssuesInBulk: ->
|
addIssuesInBulk: ->
|
||||||
@rootscope.$broadcast("issueform:bulk")
|
@rootscope.$broadcast("issueform:bulk", @scope.projectId)
|
||||||
|
|
||||||
|
|
||||||
module.controller("IssuesController", IssuesController)
|
module.controller("IssuesController", IssuesController)
|
||||||
|
|
|
@ -55,6 +55,7 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
console.log "FAIL"
|
console.log "FAIL"
|
||||||
|
|
||||||
@scope.$on("usform:new:success", @.onNewUserstory)
|
@scope.$on("usform:new:success", @.onNewUserstory)
|
||||||
|
@scope.$on("usform:bulk:success", @.onNewUserstory)
|
||||||
@scope.$on("usform:edit:success", @.onUserstoryEdited)
|
@scope.$on("usform:edit:success", @.onUserstoryEdited)
|
||||||
@scope.$on("assigned-to:added", @.onAssignedToChanged)
|
@scope.$on("assigned-to:added", @.onAssignedToChanged)
|
||||||
@scope.$on("kanban:us:move", @.moveUs)
|
@scope.$on("kanban:us:move", @.moveUs)
|
||||||
|
@ -66,15 +67,21 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
|
|
||||||
addNewUs: (type, statusId) ->
|
addNewUs: (type, statusId) ->
|
||||||
switch type
|
switch type
|
||||||
when "standard" then @rootscope.$broadcast("usform:new", statusId)
|
when "standard" then @rootscope.$broadcast("usform:new", @scope.projectId, statusId)
|
||||||
when "bulk" then @rootscope.$broadcast("usform:bulk", statusId)
|
when "bulk" then @rootscope.$broadcast("usform:bulk", @scope.projectId, statusId)
|
||||||
|
|
||||||
changeUsAssignedTo: (us) ->
|
changeUsAssignedTo: (us) ->
|
||||||
@rootscope.$broadcast("assigned-to:add", us)
|
@rootscope.$broadcast("assigned-to:add", us)
|
||||||
|
|
||||||
# Scope Events Handlers
|
# Scope Events Handlers
|
||||||
|
|
||||||
onNewUserstory: (ctx, us) ->
|
onNewUserstory: (ctx, result) ->
|
||||||
|
if result.data
|
||||||
|
items = result.data
|
||||||
|
else
|
||||||
|
items = [result]
|
||||||
|
|
||||||
|
for us in items
|
||||||
@scope.usByStatus[us.status].splice(0, 0, us)
|
@scope.usByStatus[us.status].splice(0, 0, us)
|
||||||
|
|
||||||
onAssignedToChanged: (ctx, userid, us) ->
|
onAssignedToChanged: (ctx, userid, us) ->
|
||||||
|
|
|
@ -34,10 +34,16 @@ resourceProvider = ($repo, $http, $urls) ->
|
||||||
|
|
||||||
return $repo.queryMany("userstories", params)
|
return $repo.queryMany("userstories", params)
|
||||||
|
|
||||||
service.bulkCreate = (projectId, data) ->
|
service.bulkCreate = (projectId, status, bulk) ->
|
||||||
|
data = {
|
||||||
|
projectId: projectId
|
||||||
|
statusId: status
|
||||||
|
bulkStories: bulk
|
||||||
|
}
|
||||||
|
|
||||||
url = $urls.resolve("bulk-create-us")
|
url = $urls.resolve("bulk-create-us")
|
||||||
params = {projectId: projectId, bulkStories: data}
|
|
||||||
return $http.post(url, params)
|
return $http.post(url, data)
|
||||||
|
|
||||||
service.bulkUpdateOrder = (projectId, data) ->
|
service.bulkUpdateOrder = (projectId, data) ->
|
||||||
url = $urls.resolve("bulk-update-us-order")
|
url = $urls.resolve("bulk-update-us-order")
|
||||||
|
|
|
@ -25,4 +25,7 @@ block content
|
||||||
div.lightbox.lightbox_add-new-us.hidden(tg-lb-create-edit-userstory)
|
div.lightbox.lightbox_add-new-us.hidden(tg-lb-create-edit-userstory)
|
||||||
include views/modules/lightbox_add-new-us
|
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_select_user.hidden(tg-lb-assignedto)
|
div.lightbox.lightbox_select_user.hidden(tg-lb-assignedto)
|
||||||
|
|
|
@ -5,7 +5,7 @@ div.kanban-table
|
||||||
ng-style="{'border-top-color':s.color}")
|
ng-style="{'border-top-color':s.color}")
|
||||||
span(tg-bo-html="s.name")
|
span(tg-bo-html="s.name")
|
||||||
a.icon.icon-plus(href="", title="Add New task", ng-click="ctrl.addNewUs('standard', s.id)")
|
a.icon.icon-plus(href="", title="Add New task", ng-click="ctrl.addNewUs('standard', s.id)")
|
||||||
a.icon.icon-bulk(href="", title="Add New bulk")
|
a.icon.icon-bulk(href="", title="Add New bulk", ng-click="ctrl.addNewUs('bulk', s.id)")
|
||||||
|
|
||||||
div.kanban-table-body
|
div.kanban-table-body
|
||||||
div.kanban-table-inner
|
div.kanban-table-inner
|
||||||
|
|
|
@ -3,6 +3,6 @@ a.close(href="", title="close")
|
||||||
form
|
form
|
||||||
h2.title(tg-i18n="common.new-bulk")
|
h2.title(tg-i18n="common.new-bulk")
|
||||||
fieldset
|
fieldset
|
||||||
textarea(tg-i18n="placeholder:common.one-item-line", ng-model="form.data", data-required="true")
|
textarea(tg-i18n="placeholder:common.one-item-line", ng-model="new.bulk", data-required="true")
|
||||||
a.button.button-green(href="", tg-i18n="title:common.save")
|
a.button.button-green(href="", tg-i18n="title:common.save")
|
||||||
span(tg-i18n="common.save")
|
span(tg-i18n="common.save")
|
||||||
|
|
Loading…
Reference in New Issue