Files
openfoodnetwork/app/assets/javascripts/darkswarm/controllers/pageset_ctrl.js.coffee
Maikel Linke ea80ae3832 Enable page navigation via URL fragment
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.
2020-03-19 15:37:13 +11:00

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