Update route filters on poem (de)activation

This commit is contained in:
Vit Brunner
2014-12-22 18:31:13 +01:00
parent c3b6f377e3
commit 53190cb313
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -3,8 +3,8 @@ angular.module("sideBySide.controllers", [])
() -> null
]
.controller "ComparisonController", [
'$document', '$rootScope', '$scope', 'load', 'poems', 'route', 'transformer'
($document, $rootScope, $scope, load, poems, route, transformer) ->
'$document', '$rootScope', '$scope', 'filter', 'load', 'poems', 'route', 'transformer'
($document, $rootScope, $scope, filter, load, poems, route, transformer) ->
min = 1
max = 5
@@ -42,6 +42,7 @@ angular.module("sideBySide.controllers", [])
active = poem.meta.Active
if ((length > min or not active) and (length < max or active))
poem.meta.Active = not poem.meta.Active
route.update('display', filter.getFilter())
# TODO else notification
$scope.flipPick = () ->
+2 -1
View File
@@ -1,4 +1,4 @@
angular.module("sideBySide").factory "load", ['fetch', 'poems', (fetch, poems) ->
angular.module("sideBySide").factory "load", ['filter', 'fetch', 'poems', (filter, fetch, poems) ->
# Load poems
#
# @param base [String] Path to config file directory
@@ -22,4 +22,5 @@ angular.module("sideBySide").factory "load", ['fetch', 'poems', (fetch, poems) -
disp = display or config.data.display
poems.all = (activize(poem, disp) for poem in poemList)
poems.heading = config.data.heading
filter.update()
]