diff --git a/app/coffee/modules/user-settings/notifications.coffee b/app/coffee/modules/user-settings/notifications.coffee index 97d61235..4ff48f42 100644 --- a/app/coffee/modules/user-settings/notifications.coffee +++ b/app/coffee/modules/user-settings/notifications.coffee @@ -16,11 +16,10 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -# File: modules/user-settings/main.coffee +# File: modules/user-settings/notifications.coffee ### taiga = @.taiga - mixOf = @.taiga.mixOf bindOnce = @.taiga.bindOnce @@ -74,13 +73,13 @@ class UserNotificationsController extends mixOf(taiga.Controller, taiga.PageMixi module.controller("UserNotificationsController", UserNotificationsController) + ############################################################################# ## User Notifications Directive ############################################################################# UserNotificationsDirective = () -> link = ($scope, $el, $attrs) -> - $scope.$on "$destroy", -> $el.off() @@ -88,6 +87,7 @@ UserNotificationsDirective = () -> module.directive("tgUserNotifications", UserNotificationsDirective) + ############################################################################# ## User Notifications List Directive ############################################################################# @@ -124,11 +124,12 @@ UserNotificationsListDirective = ($repo, $confirm) -> <% }) %> """) - link = ($scope, $el, $attrs) -> + link = ($scope, $el, $attrs) -> render = -> $el.off() $el.html(template({notifyPolicies: $scope.notifyPolicies})) + $el.on "change", "input[type=radio]", (event) -> target = angular.element(event.currentTarget) policyIndex = target.parents(".policy-table-row").data('index') @@ -145,7 +146,6 @@ UserNotificationsListDirective = ($repo, $confirm) -> $scope.$on "$destroy", -> $el.off() - bindOnce($scope, $attrs.ngModel, render) return {link:link}