Fixed bug #362: Allowing drop user stories on empty backlog

stable
Jesús Espino 2014-08-13 14:29:46 +02:00
parent f4ebad4be4
commit e7adab89cc
2 changed files with 34 additions and 2 deletions

View File

@ -90,6 +90,31 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) ->
return {link: link}
BacklogEmptySortableDirective = ($repo, $rs, $rootscope) ->
# Notes about jquery bug:
# http://stackoverflow.com/questions/5791886/jquery-draggable-shows-
# helper-in-wrong-place-when-scrolled-down-page
link = ($scope, $el, $attrs) ->
bindOnce $scope, "project", (project) ->
# If the user has not enough permissions we don't enable the sortable
if project.my_permissions.indexOf("modify_us") > -1
$el.sortable({
dropOnEmpty: true
})
$el.on "sortreceive", (event, ui) ->
itemUs = ui.item.scope().us
itemIndex = ui.item.index()
deleteElement(ui.item)
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
$scope.$on "$destroy", ->
$el.off()
return {link: link}
SprintSortableDirective = ($repo, $rs, $rootscope) ->
link = ($scope, $el, $attrs) ->
@ -98,7 +123,7 @@ SprintSortableDirective = ($repo, $rs, $rootscope) ->
if project.my_permissions.indexOf("modify_us") > -1
$el.sortable({
dropOnEmpty: true
connectWith: ".sprint-table,.backlog-table-body"
connectWith: ".sprint-table,.backlog-table-body,.empty-backlog"
})
$el.on "sortreceive", (event, ui) ->
@ -128,6 +153,13 @@ module.directive("tgBacklogSortable", [
BacklogSortableDirective
])
module.directive("tgBacklogEmptySortable", [
"$tgRepo",
"$tgResources",
"$rootScope",
BacklogEmptySortableDirective
])
module.directive("tgSprintSortable", [
"$tgRepo",
"$tgResources",

View File

@ -28,7 +28,7 @@ block content
include views/components/addnewus
section.backlog-table(ng-class="{'hidden': !visibleUserstories.length}")
include views/modules/backlog-table
div.empty.empty-backlog(ng-class="{'hidden': visibleUserstories.length}")
div.empty.empty-backlog(ng-class="{'hidden': visibleUserstories.length}", tg-backlog-empty-sortable)
span.icon.icon-backlog
span.title Your backlog is empty!
a(href="", title+"Create a new US", ng-click="ctrl.addNewUs('standard')", tg-check-permission="tg-check-permission", permission="add_us") You may want to create a new user story