Fix filtering by unassigned and other related bugs on issues list.

stable
Andrey Antukh 2014-07-10 17:49:31 +02:00
parent 94750d8358
commit 3d13682071
2 changed files with 9 additions and 5 deletions

View File

@ -55,7 +55,7 @@ class FiltersMixin
selectFilter: (name, value, load=false) ->
params = @location.search()
if params[name] != undefined and name != "page"
existing = _.map(taiga.toString(params[name]).split(","), trim)
existing = _.map(taiga.toString(params[name]).split(","), (x) -> trim(x))
existing.push(taiga.toString(value))
existing = _.compact(existing)
value = joinStr(",", _.uniq(existing))
@ -76,7 +76,7 @@ class FiltersMixin
if value is undefined or value is null
delete params[name]
parsedValues = _.map(taiga.toString(params[name]).split(","), trim)
parsedValues = _.map(taiga.toString(params[name]).split(","), (x) -> trim(x))
newValues = _.reject(parsedValues, (x) -> x == taiga.toString(value))
newValues = _.compact(newValues)

View File

@ -386,6 +386,11 @@ IssuesFiltersDirective = ($log, $location) ->
filters = $scope.filters[type]
filter = _.find(filters, {id:id})
filter.selected = (not filter.selected)
# Convert id to null as string for properly
# put null value on url parameters
id = "null" if id is null
if filter.selected
selectedFilters.push(filter)
$scope.$apply ->
@ -433,7 +438,7 @@ IssuesFiltersDirective = ($log, $location) ->
event.preventDefault()
target = angular.element(event.currentTarget)
id = target.data("id")
id = target.data("id") or null
type = target.data("type")
toggleFilterSelection(type, id)
@ -442,11 +447,10 @@ IssuesFiltersDirective = ($log, $location) ->
target = angular.element(event.currentTarget)
if target.hasClass("active")
target.removeClass("active")
# target.css("background-color")
else
target.addClass("active")
id = target.data("id")
id = target.data("id") or null
type = target.data("type")
toggleFilterSelection(type, id)