fix #1505 - The user only can drop if the backlog filters are closed
parent
0597881e02
commit
b900118aff
|
@ -57,6 +57,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
||||||
|
|
||||||
@scope.sectionName = "Backlog"
|
@scope.sectionName = "Backlog"
|
||||||
@showTags = false
|
@showTags = false
|
||||||
|
@activeFilters = false
|
||||||
|
|
||||||
@.initializeEventHandlers()
|
@.initializeEventHandlers()
|
||||||
|
|
||||||
|
@ -122,6 +123,9 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
||||||
@showTags = !@showTags
|
@showTags = !@showTags
|
||||||
@rs.userstories.storeShowTags(@scope.projectId, @showTags)
|
@rs.userstories.storeShowTags(@scope.projectId, @showTags)
|
||||||
|
|
||||||
|
toggleActiveFilters: ->
|
||||||
|
@activeFilters = !@activeFilters
|
||||||
|
|
||||||
loadProjectStats: ->
|
loadProjectStats: ->
|
||||||
return @rs.projects.stats(@scope.projectId).then (stats) =>
|
return @rs.projects.stats(@scope.projectId).then (stats) =>
|
||||||
@scope.stats = stats
|
@scope.stats = stats
|
||||||
|
@ -150,7 +154,6 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
||||||
return sprints
|
return sprints
|
||||||
|
|
||||||
resetFilters: ->
|
resetFilters: ->
|
||||||
@scope.$apply =>
|
|
||||||
selectedTags = _.filter(@scope.filters.tags, "selected")
|
selectedTags = _.filter(@scope.filters.tags, "selected")
|
||||||
selectedStatuses = _.filter(@scope.filters.statuses, "selected")
|
selectedStatuses = _.filter(@scope.filters.statuses, "selected")
|
||||||
|
|
||||||
|
@ -623,12 +626,15 @@ BacklogDirective = ($repo, $rootscope) ->
|
||||||
if !sidebar.hasClass("active")
|
if !sidebar.hasClass("active")
|
||||||
$ctrl.resetFilters()
|
$ctrl.resetFilters()
|
||||||
|
|
||||||
|
$ctrl.toggleActiveFilters()
|
||||||
|
|
||||||
## Filters Link
|
## Filters Link
|
||||||
|
|
||||||
linkFilters = ($scope, $el, $attrs, $ctrl) ->
|
linkFilters = ($scope, $el, $attrs, $ctrl) ->
|
||||||
$scope.filtersSearch = {}
|
$scope.filtersSearch = {}
|
||||||
$el.on "click", "#show-filters-button", (event) ->
|
$el.on "click", "#show-filters-button", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
$scope.$apply ->
|
||||||
showHideFilter($scope, $el, $ctrl)
|
showHideFilter($scope, $el, $ctrl)
|
||||||
|
|
||||||
link = ($scope, $el, $attrs, $rootscope) ->
|
link = ($scope, $el, $attrs, $rootscope) ->
|
||||||
|
|
|
@ -39,7 +39,7 @@ deleteElement = (el) ->
|
||||||
el.off()
|
el.off()
|
||||||
el.remove()
|
el.remove()
|
||||||
|
|
||||||
BacklogSortableDirective = ($repo, $rs, $rootscope) ->
|
BacklogSortableDirective = ($repo, $rs, $rootscope, $tgConfirm) ->
|
||||||
# Notes about jquery bug:
|
# Notes about jquery bug:
|
||||||
# http://stackoverflow.com/questions/5791886/jquery-draggable-shows-
|
# http://stackoverflow.com/questions/5791886/jquery-draggable-shows-
|
||||||
# helper-in-wrong-place-when-scrolled-down-page
|
# helper-in-wrong-place-when-scrolled-down-page
|
||||||
|
@ -50,6 +50,9 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
if not (project.my_permissions.indexOf("modify_us") > -1)
|
if not (project.my_permissions.indexOf("modify_us") > -1)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
filterError = ->
|
||||||
|
$tgConfirm.notify("error", "You can't drop on backlog when filters are open") #TODO: i18n
|
||||||
|
|
||||||
$el.sortable({
|
$el.sortable({
|
||||||
connectWith: ".sprint-table"
|
connectWith: ".sprint-table"
|
||||||
containment: ".wrapper"
|
containment: ".wrapper"
|
||||||
|
@ -67,9 +70,19 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
# position for revert).
|
# position for revert).
|
||||||
revert: false
|
revert: false
|
||||||
cursorAt: {right: 15}
|
cursorAt: {right: 15}
|
||||||
|
stop: () ->
|
||||||
|
if $el.hasClass("active-filters")
|
||||||
|
$el.sortable("cancel")
|
||||||
|
filterError()
|
||||||
})
|
})
|
||||||
|
|
||||||
$el.on "multiplesortreceive", (event, ui) ->
|
$el.on "multiplesortreceive", (event, ui) ->
|
||||||
|
if $el.hasClass("active-filters")
|
||||||
|
ui.source.sortable("cancel")
|
||||||
|
filterError()
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
itemUs = ui.item.scope().us
|
itemUs = ui.item.scope().us
|
||||||
itemIndex = ui.item.index()
|
itemIndex = ui.item.index()
|
||||||
|
|
||||||
|
@ -179,6 +192,7 @@ module.directive("tgBacklogSortable", [
|
||||||
"$tgRepo",
|
"$tgRepo",
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
"$rootScope",
|
"$rootScope",
|
||||||
|
"$tgConfirm",
|
||||||
BacklogSortableDirective
|
BacklogSortableDirective
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,8 @@
|
||||||
|
|
||||||
$(this.currentContainer.element).trigger('multiplesortreceive', {
|
$(this.currentContainer.element).trigger('multiplesortreceive', {
|
||||||
'item': current,
|
'item': current,
|
||||||
'items': elms
|
'items': elms,
|
||||||
|
'source': this.element
|
||||||
});
|
});
|
||||||
} else if (current.hasClass(multipleSortableClass)) {
|
} else if (current.hasClass(multipleSortableClass)) {
|
||||||
// sort in the same list
|
// sort in the same list
|
||||||
|
|
|
@ -6,5 +6,5 @@ div.backlog-table-header
|
||||||
span.header-points Points
|
span.header-points Points
|
||||||
span.icon.icon-arrow-bottom
|
span.icon.icon-arrow-bottom
|
||||||
|
|
||||||
div.backlog-table-body(tg-backlog-sortable, ng-class="{'show-tags': ctrl.showTags}" )
|
div.backlog-table-body(tg-backlog-sortable, ng-class="{'show-tags': ctrl.showTags, 'active-filters': ctrl.activeFilters}" )
|
||||||
include ../components/backlog-row
|
include ../components/backlog-row
|
||||||
|
|
Loading…
Reference in New Issue