diff --git a/app/coffee/modules/backlog/sortable.coffee b/app/coffee/modules/backlog/sortable.coffee index 2966afe9..1e02e85b 100644 --- a/app/coffee/modules/backlog/sortable.coffee +++ b/app/coffee/modules/backlog/sortable.coffee @@ -52,7 +52,6 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) -> $el.sortable({ connectWith: ".sprint-table" - handle: ".icon-drag-v", containment: ".wrapper" dropOnEmpty: true placeholder: "row us-item-row us-item-drag sortable-placeholder" @@ -75,6 +74,7 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) -> deleteElement(ui.item) $scope.$emit("sprint:us:move", itemUs, itemIndex, null) + ui.item.find('a').removeClass('noclick') $el.on "sortstop", (event, ui) -> # When parent not exists, do nothing @@ -84,6 +84,10 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) -> itemUs = ui.item.scope().us itemIndex = ui.item.index() $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", -> $el.off() @@ -109,6 +113,7 @@ BacklogEmptySortableDirective = ($repo, $rs, $rootscope) -> deleteElement(ui.item) $scope.$emit("sprint:us:move", itemUs, itemIndex, null) + ui.item.find('a').removeClass('noclick') $scope.$on "$destroy", -> $el.off() @@ -132,6 +137,7 @@ SprintSortableDirective = ($repo, $rs, $rootscope) -> deleteElement(ui.item) $scope.$emit("sprint:us:move", itemUs, itemIndex, $scope.sprint.id) + ui.item.find('a').removeClass('noclick') $el.on "sortstop", (event, ui) -> # When parent not exists, do nothing @@ -142,6 +148,7 @@ SprintSortableDirective = ($repo, $rs, $rootscope) -> itemIndex = ui.item.index() $scope.$emit("sprint:us:move", itemUs, itemIndex, $scope.sprint.id) + ui.item.find('a').removeClass('noclick') return {link:link} diff --git a/app/coffee/modules/base/navurls.coffee b/app/coffee/modules/base/navurls.coffee index 9cef8768..ef0acecc 100644 --- a/app/coffee/modules/base/navurls.coffee +++ b/app/coffee/modules/base/navurls.coffee @@ -109,6 +109,9 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location) -> event.preventDefault() target = $(event.currentTarget) + if target.hasClass('noclick') + return + fullUrl = target.data("fullUrl") switch event.which diff --git a/app/coffee/modules/kanban/main.coffee b/app/coffee/modules/kanban/main.coffee index 41d16273..e5d2282b 100644 --- a/app/coffee/modules/kanban/main.coffee +++ b/app/coffee/modules/kanban/main.coffee @@ -74,9 +74,6 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi # Template actions - editUserStory: (us) -> - @rootscope.$broadcast("usform:edit", us) - addNewUs: (type, statusId) -> switch type when "standard" then @rootscope.$broadcast("usform:new", @scope.projectId, statusId, @scope.usStatusList) @@ -245,8 +242,14 @@ module.directive("tgKanbanRowSizeFixer", KanbanRowSizeFixer) ## Kaban User Story Directive ############################################################################# -KanbanUserstoryDirective = -> - link = ($scope, $el, $attrs) -> +KanbanUserstoryDirective = ($rootscope) -> + 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() 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.html(ctx.name) username_label.on "click", (event) -> + if $el.find('a').hasClass('noclick') + return + us = $model.$modelValue $ctrl = $el.controller() $ctrl.changeUsAssignedTo(us) @@ -330,6 +336,9 @@ KanbanUserDirective = ($log) -> if project.my_permissions.indexOf("modify_us") > -1 clickable = true $el.on "click", (event) => + if $el.find('a').hasClass('noclick') + return + us = $model.$modelValue $ctrl = $el.controller() $ctrl.changeUsAssignedTo(us) diff --git a/app/coffee/modules/kanban/sortable.coffee b/app/coffee/modules/kanban/sortable.coffee index 1d99ff45..ce203683 100644 --- a/app/coffee/modules/kanban/sortable.coffee +++ b/app/coffee/modules/kanban/sortable.coffee @@ -58,7 +58,7 @@ KanbanSortableDirective = ($repo, $rs, $rootscope) -> itemEl.remove() tdom.sortable({ - handle: ".icon-drag-h" + handle: ".kanban-task-inner" dropOnEmpty: true connectWith: ".kanban-uses-box" revert: 400 @@ -80,8 +80,11 @@ KanbanSortableDirective = ($repo, $rs, $rootscope) -> $scope.$apply -> $rootscope.$broadcast("kanban:us:move", itemUs, newStatusId, itemIndex) + ui.item.find('a').removeClass('noclick') + tdom.on "sortstart", (event, ui) -> oldParentScope = ui.item.parent().scope() + ui.item.find('a').addClass('noclick') $scope.$on "$destroy", -> $el.off() diff --git a/app/coffee/modules/taskboard/main.coffee b/app/coffee/modules/taskboard/main.coffee index fd252b27..71bf055e 100644 --- a/app/coffee/modules/taskboard/main.coffee +++ b/app/coffee/modules/taskboard/main.coffee @@ -181,9 +181,6 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin) when "standard" then @rootscope.$broadcast("taskform:new", @scope.sprintId, us?.id) when "bulk" then @rootscope.$broadcast("taskform:bulk", @scope.sprintId, us?.id) - editTask: (task) -> - @rootscope.$broadcast("taskform:edit", task) - editTaskAssignedTo: (task) -> @rootscope.$broadcast("assigned-to:add", task) @@ -222,15 +219,21 @@ module.directive("tgTaskboard", ["$rootScope", TaskboardDirective]) ## Taskboard Task Directive ############################################################################# -TaskboardTaskDirective = -> - link = ($scope, $el, $attrs) -> +TaskboardTaskDirective = ($rootscope) -> + link = ($scope, $el, $attrs, $model) -> 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() return {link:link} -module.directive("tgTaskboardTask", TaskboardTaskDirective) +module.directive("tgTaskboardTask", ["$rootScope", TaskboardTaskDirective]) ############################################################################# @@ -283,13 +286,23 @@ TaskboardUserDirective = ($log) -> html = template(ctx) $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) -> if project.my_permissions.indexOf("modify_task") > -1 clickable = true $el.on "click", (event) => + if $el.find('a').hasClass('noclick') + return + us = $model.$modelValue $ctrl = $el.controller() $ctrl.editTaskAssignedTo(us) diff --git a/app/coffee/modules/taskboard/sortable.coffee b/app/coffee/modules/taskboard/sortable.coffee index 6a075142..16aa5020 100644 --- a/app/coffee/modules/taskboard/sortable.coffee +++ b/app/coffee/modules/taskboard/sortable.coffee @@ -48,7 +48,7 @@ TaskboardSortableDirective = ($repo, $rs, $rootscope) -> itemEl.remove() tdom.sortable({ - handle: ".icon-drag-h", + handle: ".taskboard-task-inner", dropOnEmpty: true connectWith: ".taskboard-tasks-box" revert: 400 @@ -72,8 +72,11 @@ TaskboardSortableDirective = ($repo, $rs, $rootscope) -> $scope.$apply -> $rootscope.$broadcast("taskboard:task:move", itemTask, newUsId, newStatusId, itemIndex) + ui.item.find('a').removeClass('noclick') + tdom.on "sortstart", (event, ui) -> oldParentScope = ui.item.parent().scope() + ui.item.find('a').addClass('noclick') $scope.$on "$destroy", -> $el.off() diff --git a/app/partials/views/components/kanban-task.jade b/app/partials/views/components/kanban-task.jade index cde12737..96f12972 100644 --- a/app/partials/views/components/kanban-task.jade +++ b/app/partials/views/components/kanban-task.jade @@ -9,5 +9,5 @@ div.kanban-task-inner p.task-points span(tg-bind-html="us.total_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") diff --git a/app/partials/views/components/taskboard-task.jade b/app/partials/views/components/taskboard-task.jade index cca75a14..10662fa9 100644 --- a/app/partials/views/components/taskboard-task.jade +++ b/app/partials/views/components/taskboard-task.jade @@ -1,16 +1,15 @@ div.taskboard-tagline(tg-colorize-tags="task.tags", tg-colorize-tags-type="taskboard") div.taskboard-task-inner div.taskboard-user-avatar(tg-taskboard-user-avatar="task.assigned_to", ng-model="task", - click="ctrl.editTaskAssignedTo(task)", ng-class="{iocaine: task.is_iocaine}") span.icon.icon-iocaine(ng-if="task.is_iocaine") 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") a.task-name(href="", title="See task details", tg-bind-html="task.subject", tg-nav="project-tasks-detail:project=project.slug,ref=task.ref") 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", href="", title="Drag&Drop") diff --git a/app/styles/components/kanban-task.scss b/app/styles/components/kanban-task.scss index c5d66cc9..e3282cca 100644 --- a/app/styles/components/kanban-task.scss +++ b/app/styles/components/kanban-task.scss @@ -1,5 +1,6 @@ .kanban-task { background: $postit; + cursor: move; position: relative; &:last-child { margin: 0; diff --git a/app/styles/components/taskboard-task.scss b/app/styles/components/taskboard-task.scss index 5e0ea38f..03e2b6e0 100644 --- a/app/styles/components/taskboard-task.scss +++ b/app/styles/components/taskboard-task.scss @@ -2,6 +2,7 @@ @include transition (box-shadow .4s linear); background: $postit; box-shadow: none; + cursor: move; min-height: 7rem; position: relative; &:hover { diff --git a/app/styles/modules/backlog/backlog-table.scss b/app/styles/modules/backlog/backlog-table.scss index 465b9b96..a84eb509 100644 --- a/app/styles/modules/backlog/backlog-table.scss +++ b/app/styles/modules/backlog/backlog-table.scss @@ -108,6 +108,7 @@ .backlog-table-body { .row { + cursor: move; position: relative; &:hover { @include transition (background .2s ease-in);