Merge pull request #355 from taigaio/issue/2211/issue-click-does-not-work-with-filters

prevent location search if the url has the same parameters
stable
David Barragán Merino 2015-03-03 12:57:34 +01:00
commit 202ffeda79
2 changed files with 14 additions and 7 deletions

View File

@ -28,6 +28,10 @@ locationFactory = ($location, $route, $rootscope) ->
un()
return $location
$location.isInCurrentRouteParams = (name, value) ->
return $route.current.params[name] == value
return $location

View File

@ -62,7 +62,7 @@ taiga.PageMixin = PageMixin
#############################################################################
## Filters Mixin
#############################################################################
# This mixin requires @location ($tgLocation) and @scope
# This mixin requires @location ($tgLocation), and @scope
class FiltersMixin
selectFilter: (name, value, load=false) ->
@ -73,16 +73,19 @@ class FiltersMixin
existing = _.compact(existing)
value = joinStr(",", _.uniq(existing))
location = if load then @location else @location.noreload(@scope)
location.search(name, value)
if !@location.isInCurrentRouteParams(name, value)
location = if load then @location else @location.noreload(@scope)
location.search(name, value)
replaceFilter: (name, value, load=false) ->
location = if load then @location else @location.noreload(@scope)
location.search(name, value)
if !@location.isInCurrentRouteParams(name, value)
location = if load then @location else @location.noreload(@scope)
location.search(name, value)
replaceAllFilters: (filters, load=false) ->
location = if load then @location else @location.noreload(@scope)
location.search(filters)
if !@location.isInCurrentRouteParams(name, value)
location = if load then @location else @location.noreload(@scope)
location.search(filters)
unselectFilter: (name, value, load=false) ->
params = @location.search()