Fix bug #741: Kanban/Taskboard/Backlog drag and drop start on all the element
parent
bcf87d7df1
commit
68f48f6a1c
|
@ -52,7 +52,6 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
|
|
||||||
$el.sortable({
|
$el.sortable({
|
||||||
connectWith: ".sprint-table"
|
connectWith: ".sprint-table"
|
||||||
handle: ".icon-drag-v",
|
|
||||||
containment: ".wrapper"
|
containment: ".wrapper"
|
||||||
dropOnEmpty: true
|
dropOnEmpty: true
|
||||||
placeholder: "row us-item-row us-item-drag sortable-placeholder"
|
placeholder: "row us-item-row us-item-drag sortable-placeholder"
|
||||||
|
@ -75,6 +74,7 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
|
|
||||||
deleteElement(ui.item)
|
deleteElement(ui.item)
|
||||||
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
|
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
|
||||||
|
ui.item.find('a').removeClass('noclick')
|
||||||
|
|
||||||
$el.on "sortstop", (event, ui) ->
|
$el.on "sortstop", (event, ui) ->
|
||||||
# When parent not exists, do nothing
|
# When parent not exists, do nothing
|
||||||
|
@ -84,6 +84,10 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
itemUs = ui.item.scope().us
|
itemUs = ui.item.scope().us
|
||||||
itemIndex = ui.item.index()
|
itemIndex = ui.item.index()
|
||||||
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
|
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
|
||||||
|
ui.item.find('a').removeClass('noclick')
|
||||||
|
|
||||||
|
$el.on "sortstart", (event, ui) ->
|
||||||
|
ui.item.find('a').addClass('noclick')
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
@ -109,6 +113,7 @@ BacklogEmptySortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
|
|
||||||
deleteElement(ui.item)
|
deleteElement(ui.item)
|
||||||
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
|
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
|
||||||
|
ui.item.find('a').removeClass('noclick')
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
@ -132,6 +137,7 @@ SprintSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
|
|
||||||
deleteElement(ui.item)
|
deleteElement(ui.item)
|
||||||
$scope.$emit("sprint:us:move", itemUs, itemIndex, $scope.sprint.id)
|
$scope.$emit("sprint:us:move", itemUs, itemIndex, $scope.sprint.id)
|
||||||
|
ui.item.find('a').removeClass('noclick')
|
||||||
|
|
||||||
$el.on "sortstop", (event, ui) ->
|
$el.on "sortstop", (event, ui) ->
|
||||||
# When parent not exists, do nothing
|
# When parent not exists, do nothing
|
||||||
|
@ -142,6 +148,7 @@ SprintSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
itemIndex = ui.item.index()
|
itemIndex = ui.item.index()
|
||||||
|
|
||||||
$scope.$emit("sprint:us:move", itemUs, itemIndex, $scope.sprint.id)
|
$scope.$emit("sprint:us:move", itemUs, itemIndex, $scope.sprint.id)
|
||||||
|
ui.item.find('a').removeClass('noclick')
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,9 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
target = $(event.currentTarget)
|
target = $(event.currentTarget)
|
||||||
|
|
||||||
|
if target.hasClass('noclick')
|
||||||
|
return
|
||||||
|
|
||||||
fullUrl = target.data("fullUrl")
|
fullUrl = target.data("fullUrl")
|
||||||
|
|
||||||
switch event.which
|
switch event.which
|
||||||
|
|
|
@ -74,9 +74,6 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
|
|
||||||
# Template actions
|
# Template actions
|
||||||
|
|
||||||
editUserStory: (us) ->
|
|
||||||
@rootscope.$broadcast("usform:edit", us)
|
|
||||||
|
|
||||||
addNewUs: (type, statusId) ->
|
addNewUs: (type, statusId) ->
|
||||||
switch type
|
switch type
|
||||||
when "standard" then @rootscope.$broadcast("usform:new", @scope.projectId, statusId, @scope.usStatusList)
|
when "standard" then @rootscope.$broadcast("usform:new", @scope.projectId, statusId, @scope.usStatusList)
|
||||||
|
@ -245,8 +242,14 @@ module.directive("tgKanbanRowSizeFixer", KanbanRowSizeFixer)
|
||||||
## Kaban User Story Directive
|
## Kaban User Story Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
KanbanUserstoryDirective = ->
|
KanbanUserstoryDirective = ($rootscope) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs, $model) ->
|
||||||
|
$el.find(".icon-edit").on "click", (event) ->
|
||||||
|
if $el.find('.icon-edit').hasClass('noclick')
|
||||||
|
return
|
||||||
|
$scope.$apply ->
|
||||||
|
$rootscope.$broadcast("usform:edit", $model.$modelValue)
|
||||||
|
|
||||||
$el.disableSelection()
|
$el.disableSelection()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -256,7 +259,7 @@ KanbanUserstoryDirective = ->
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgKanbanUserstory", KanbanUserstoryDirective)
|
module.directive("tgKanbanUserstory", ["$rootScope", KanbanUserstoryDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -322,6 +325,9 @@ KanbanUserDirective = ($log) ->
|
||||||
username_label = $el.parent().find("a.task-assigned")
|
username_label = $el.parent().find("a.task-assigned")
|
||||||
username_label.html(ctx.name)
|
username_label.html(ctx.name)
|
||||||
username_label.on "click", (event) ->
|
username_label.on "click", (event) ->
|
||||||
|
if $el.find('a').hasClass('noclick')
|
||||||
|
return
|
||||||
|
|
||||||
us = $model.$modelValue
|
us = $model.$modelValue
|
||||||
$ctrl = $el.controller()
|
$ctrl = $el.controller()
|
||||||
$ctrl.changeUsAssignedTo(us)
|
$ctrl.changeUsAssignedTo(us)
|
||||||
|
@ -330,6 +336,9 @@ KanbanUserDirective = ($log) ->
|
||||||
if project.my_permissions.indexOf("modify_us") > -1
|
if project.my_permissions.indexOf("modify_us") > -1
|
||||||
clickable = true
|
clickable = true
|
||||||
$el.on "click", (event) =>
|
$el.on "click", (event) =>
|
||||||
|
if $el.find('a').hasClass('noclick')
|
||||||
|
return
|
||||||
|
|
||||||
us = $model.$modelValue
|
us = $model.$modelValue
|
||||||
$ctrl = $el.controller()
|
$ctrl = $el.controller()
|
||||||
$ctrl.changeUsAssignedTo(us)
|
$ctrl.changeUsAssignedTo(us)
|
||||||
|
|
|
@ -58,7 +58,7 @@ KanbanSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
itemEl.remove()
|
itemEl.remove()
|
||||||
|
|
||||||
tdom.sortable({
|
tdom.sortable({
|
||||||
handle: ".icon-drag-h"
|
handle: ".kanban-task-inner"
|
||||||
dropOnEmpty: true
|
dropOnEmpty: true
|
||||||
connectWith: ".kanban-uses-box"
|
connectWith: ".kanban-uses-box"
|
||||||
revert: 400
|
revert: 400
|
||||||
|
@ -80,8 +80,11 @@ KanbanSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
$scope.$apply ->
|
$scope.$apply ->
|
||||||
$rootscope.$broadcast("kanban:us:move", itemUs, newStatusId, itemIndex)
|
$rootscope.$broadcast("kanban:us:move", itemUs, newStatusId, itemIndex)
|
||||||
|
|
||||||
|
ui.item.find('a').removeClass('noclick')
|
||||||
|
|
||||||
tdom.on "sortstart", (event, ui) ->
|
tdom.on "sortstart", (event, ui) ->
|
||||||
oldParentScope = ui.item.parent().scope()
|
oldParentScope = ui.item.parent().scope()
|
||||||
|
ui.item.find('a').addClass('noclick')
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
|
@ -181,9 +181,6 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
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("taskform:bulk", @scope.sprintId, us?.id)
|
||||||
|
|
||||||
editTask: (task) ->
|
|
||||||
@rootscope.$broadcast("taskform:edit", task)
|
|
||||||
|
|
||||||
editTaskAssignedTo: (task) ->
|
editTaskAssignedTo: (task) ->
|
||||||
@rootscope.$broadcast("assigned-to:add", task)
|
@rootscope.$broadcast("assigned-to:add", task)
|
||||||
|
|
||||||
|
@ -222,15 +219,21 @@ module.directive("tgTaskboard", ["$rootScope", TaskboardDirective])
|
||||||
## Taskboard Task Directive
|
## Taskboard Task Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
TaskboardTaskDirective = ->
|
TaskboardTaskDirective = ($rootscope) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs, $model) ->
|
||||||
console.log "taskboard task"
|
console.log "taskboard task"
|
||||||
|
$el.find(".icon-edit").on "click", (event) ->
|
||||||
|
if $el.find('.icon-edit').hasClass('noclick')
|
||||||
|
return
|
||||||
|
$scope.$apply ->
|
||||||
|
$rootscope.$broadcast("taskform:edit", $scope.task)
|
||||||
|
|
||||||
$el.disableSelection()
|
$el.disableSelection()
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgTaskboardTask", TaskboardTaskDirective)
|
module.directive("tgTaskboardTask", ["$rootScope", TaskboardTaskDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -283,13 +286,23 @@ TaskboardUserDirective = ($log) ->
|
||||||
|
|
||||||
html = template(ctx)
|
html = template(ctx)
|
||||||
$el.html(html)
|
$el.html(html)
|
||||||
|
username_label = $el.parent().find("a.task-assigned")
|
||||||
|
username_label.html(ctx.name)
|
||||||
|
username_label.on "click", (event) ->
|
||||||
|
if $el.find('a').hasClass('noclick')
|
||||||
|
return
|
||||||
|
|
||||||
$el.parent().find("a.task-assigned").html(ctx.name)
|
us = $model.$modelValue
|
||||||
|
$ctrl = $el.controller()
|
||||||
|
$ctrl.editTaskAssignedTo(us)
|
||||||
|
|
||||||
bindOnce $scope, "project", (project) ->
|
bindOnce $scope, "project", (project) ->
|
||||||
if project.my_permissions.indexOf("modify_task") > -1
|
if project.my_permissions.indexOf("modify_task") > -1
|
||||||
clickable = true
|
clickable = true
|
||||||
$el.on "click", (event) =>
|
$el.on "click", (event) =>
|
||||||
|
if $el.find('a').hasClass('noclick')
|
||||||
|
return
|
||||||
|
|
||||||
us = $model.$modelValue
|
us = $model.$modelValue
|
||||||
$ctrl = $el.controller()
|
$ctrl = $el.controller()
|
||||||
$ctrl.editTaskAssignedTo(us)
|
$ctrl.editTaskAssignedTo(us)
|
||||||
|
|
|
@ -48,7 +48,7 @@ TaskboardSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
itemEl.remove()
|
itemEl.remove()
|
||||||
|
|
||||||
tdom.sortable({
|
tdom.sortable({
|
||||||
handle: ".icon-drag-h",
|
handle: ".taskboard-task-inner",
|
||||||
dropOnEmpty: true
|
dropOnEmpty: true
|
||||||
connectWith: ".taskboard-tasks-box"
|
connectWith: ".taskboard-tasks-box"
|
||||||
revert: 400
|
revert: 400
|
||||||
|
@ -72,8 +72,11 @@ TaskboardSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
$scope.$apply ->
|
$scope.$apply ->
|
||||||
$rootscope.$broadcast("taskboard:task:move", itemTask, newUsId, newStatusId, itemIndex)
|
$rootscope.$broadcast("taskboard:task:move", itemTask, newUsId, newStatusId, itemIndex)
|
||||||
|
|
||||||
|
ui.item.find('a').removeClass('noclick')
|
||||||
|
|
||||||
tdom.on "sortstart", (event, ui) ->
|
tdom.on "sortstart", (event, ui) ->
|
||||||
oldParentScope = ui.item.parent().scope()
|
oldParentScope = ui.item.parent().scope()
|
||||||
|
ui.item.find('a').addClass('noclick')
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
|
@ -9,5 +9,5 @@ div.kanban-task-inner
|
||||||
p.task-points
|
p.task-points
|
||||||
span(tg-bind-html="us.total_points") --
|
span(tg-bind-html="us.total_points") --
|
||||||
span points
|
span points
|
||||||
a.icon.icon-edit(tg-check-permission, permission="modify_us", href="", title="Edit", ng-click="ctrl.editUserStory(us)")
|
a.icon.icon-edit(tg-check-permission, permission="modify_us", href="", title="Edit")
|
||||||
a.icon.icon-drag-h(tg-check-permission, permission="modify_us", href="", title="Drag&Drop")
|
a.icon.icon-drag-h(tg-check-permission, permission="modify_us", href="", title="Drag&Drop")
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
div.taskboard-tagline(tg-colorize-tags="task.tags", tg-colorize-tags-type="taskboard")
|
div.taskboard-tagline(tg-colorize-tags="task.tags", tg-colorize-tags-type="taskboard")
|
||||||
div.taskboard-task-inner
|
div.taskboard-task-inner
|
||||||
div.taskboard-user-avatar(tg-taskboard-user-avatar="task.assigned_to", ng-model="task",
|
div.taskboard-user-avatar(tg-taskboard-user-avatar="task.assigned_to", ng-model="task",
|
||||||
click="ctrl.editTaskAssignedTo(task)",
|
|
||||||
ng-class="{iocaine: task.is_iocaine}")
|
ng-class="{iocaine: task.is_iocaine}")
|
||||||
span.icon.icon-iocaine(ng-if="task.is_iocaine")
|
span.icon.icon-iocaine(ng-if="task.is_iocaine")
|
||||||
p.taskboard-text
|
p.taskboard-text
|
||||||
a.task-assigned(href="", ng-click="ctrl.editTaskAssignedTo(task)", title="Assign task")
|
a.task-assigned(href="", title="Assign task")
|
||||||
span.task-num(tg-bo-ref="task.ref")
|
span.task-num(tg-bo-ref="task.ref")
|
||||||
a.task-name(href="", title="See task details", tg-bind-html="task.subject",
|
a.task-name(href="", title="See task details", tg-bind-html="task.subject",
|
||||||
tg-nav="project-tasks-detail:project=project.slug,ref=task.ref")
|
tg-nav="project-tasks-detail:project=project.slug,ref=task.ref")
|
||||||
a.icon.icon-edit(tg-check-permission, permission="modify_task",
|
a.icon.icon-edit(tg-check-permission, permission="modify_task",
|
||||||
href="", title="Edit task", ng-click="ctrl.editTask(task)")
|
href="", title="Edit task")
|
||||||
|
|
||||||
a.icon.icon-drag-h(tg-check-permission, permission="modify_task",
|
a.icon.icon-drag-h(tg-check-permission, permission="modify_task",
|
||||||
href="", title="Drag&Drop")
|
href="", title="Drag&Drop")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
.kanban-task {
|
.kanban-task {
|
||||||
background: $postit;
|
background: $postit;
|
||||||
|
cursor: move;
|
||||||
position: relative;
|
position: relative;
|
||||||
&:last-child {
|
&:last-child {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
@include transition (box-shadow .4s linear);
|
@include transition (box-shadow .4s linear);
|
||||||
background: $postit;
|
background: $postit;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
cursor: move;
|
||||||
min-height: 7rem;
|
min-height: 7rem;
|
||||||
position: relative;
|
position: relative;
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
|
@ -108,6 +108,7 @@
|
||||||
|
|
||||||
.backlog-table-body {
|
.backlog-table-body {
|
||||||
.row {
|
.row {
|
||||||
|
cursor: move;
|
||||||
position: relative;
|
position: relative;
|
||||||
&:hover {
|
&:hover {
|
||||||
@include transition (background .2s ease-in);
|
@include transition (background .2s ease-in);
|
||||||
|
|
Loading…
Reference in New Issue