Files
openfoodnetwork/app/assets/javascripts/darkswarm/directives/auth.js.coffee
2022-01-19 13:14:10 +00:00

12 lines
373 B
CoffeeScript

angular.module('Darkswarm').directive 'auth', (AuthenticationService) ->
restrict: 'A'
link: (scope, elem, attrs) ->
elem.bind "click", ->
AuthenticationService.open '/' + attrs.auth
window.addEventListener "login:modal:open", ->
AuthenticationService.open '/login'
scope.$on "$destroy", ->
window.removeEventListener "login:modal:open"