Merge pull request #355 from taigaio/issue/2211/issue-click-does-not-work-with-filters
prevent location search if the url has the same parametersstable
commit
202ffeda79
|
@ -28,6 +28,10 @@ locationFactory = ($location, $route, $rootscope) ->
|
|||
un()
|
||||
|
||||
return $location
|
||||
|
||||
$location.isInCurrentRouteParams = (name, value) ->
|
||||
return $route.current.params[name] == value
|
||||
|
||||
return $location
|
||||
|
||||
|
||||
|
|
|
@ -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,14 +73,17 @@ class FiltersMixin
|
|||
existing = _.compact(existing)
|
||||
value = joinStr(",", _.uniq(existing))
|
||||
|
||||
if !@location.isInCurrentRouteParams(name, value)
|
||||
location = if load then @location else @location.noreload(@scope)
|
||||
location.search(name, value)
|
||||
|
||||
replaceFilter: (name, value, load=false) ->
|
||||
if !@location.isInCurrentRouteParams(name, value)
|
||||
location = if load then @location else @location.noreload(@scope)
|
||||
location.search(name, value)
|
||||
|
||||
replaceAllFilters: (filters, load=false) ->
|
||||
if !@location.isInCurrentRouteParams(name, value)
|
||||
location = if load then @location else @location.noreload(@scope)
|
||||
location.search(filters)
|
||||
|
||||
|
|
Loading…
Reference in New Issue