mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-01 21:47:16 +00:00
The broadcasting of notifications didn't update properly and I couldn't find a way to listen to $location updates. I replaced the three intertwined directives with one controller and a bit more HTML code. Now we have only one scope that listens to $location and all browser actions like the back button is reflected in the page. As nice side-effect, the menu links have now the right destination so that you can copy the link and paste it into another browser window. 40 lines less code.
11 lines
270 B
CoffeeScript
11 lines
270 B
CoffeeScript
Darkswarm.controller "PagesetCtrl", ($scope, $location) ->
|
|
$scope.selected = ->
|
|
path = $location.path()?.match(/^\/\w+$/)?[0]
|
|
if path
|
|
path[1..]
|
|
else
|
|
$scope.defaultPage
|
|
|
|
$scope.selectDefault = (selection) ->
|
|
$scope.defaultPage = selection
|