From 18d9376812853955d853f3978a840b6982c6fd8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Mon, 27 Apr 2015 16:44:36 +0200 Subject: [PATCH] [i18n] Fix page user settings > notifications --- .../user-settings/notifications.coffee | 26 +++++++++++++------ app/locales/locale-en.json | 5 +++- app/locales/locale-es.json | 5 +++- app/locales/locale-fr.json | 5 +++- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/coffee/modules/user-settings/notifications.coffee b/app/coffee/modules/user-settings/notifications.coffee index d81814ff..ca299c71 100644 --- a/app/coffee/modules/user-settings/notifications.coffee +++ b/app/coffee/modules/user-settings/notifications.coffee @@ -94,7 +94,7 @@ module.directive("tgUserNotifications", UserNotificationsDirective) ## User Notifications List Directive ############################################################################# -UserNotificationsListDirective = ($repo, $confirm) -> +UserNotificationsListDirective = ($repo, $confirm, $compile) -> template = _.template(""" <% _.each(notifyPolicies, function (notifyPolicy, index) { %>
@@ -104,7 +104,8 @@ UserNotificationsListDirective = ($repo, $confirm) -> checked="checked"<% } %>/> - +
@@ -112,7 +113,8 @@ UserNotificationsListDirective = ($repo, $confirm) -> checked="checked"<% } %> /> - +
@@ -120,7 +122,8 @@ UserNotificationsListDirective = ($repo, $confirm) -> checked="checked"<% } %> /> - +
@@ -130,13 +133,17 @@ UserNotificationsListDirective = ($repo, $confirm) -> link = ($scope, $el, $attrs) -> render = -> $el.off() - $el.html(template({notifyPolicies: $scope.notifyPolicies})) + + ctx = {notifyPolicies: $scope.notifyPolicies} + html = template(ctx) + + $el.html($compile(html)($scope)) $el.on "change", "input[type=radio]", (event) -> target = angular.element(event.currentTarget) + policyIndex = target.parents(".policy-table-row").data('index') policy = $scope.notifyPolicies[policyIndex] - prev_level = policy.notify_level policy.notify_level = parseInt(target.val(), 10) @@ -145,7 +152,9 @@ UserNotificationsListDirective = ($repo, $confirm) -> onError = -> $confirm.notify("error") - target.parents(".policy-table-row").find("input[value=#{prev_level}]").prop("checked", true) + target.parents(".policy-table-row") + .find("input[value=#{prev_level}]") + .prop("checked", true) $repo.save(policy).then(onSuccess, onError) @@ -156,4 +165,5 @@ UserNotificationsListDirective = ($repo, $confirm) -> return {link:link} -module.directive("tgUserNotificationsList", ["$tgRepo", "$tgConfirm", UserNotificationsListDirective]) +module.directive("tgUserNotificationsList", ["$tgRepo", "$tgConfirm", "$compile", + UserNotificationsListDirective]) diff --git a/app/locales/locale-en.json b/app/locales/locale-en.json index 431783c1..739350ec 100644 --- a/app/locales/locale-en.json +++ b/app/locales/locale-en.json @@ -859,7 +859,10 @@ "COLUMN_PROJECT": "Project", "COLUMN_RECEIVE_ALL": "Receive All", "COLUMN_ONLY_INVOLVED": "Only Involved", - "COLUMN_NO_NOTIFICATIONS": "No notifications" + "COLUMN_NO_NOTIFICATIONS": "No notifications", + "OPTION_ALL": "All", + "OPTION_INVOLVED": "Involved", + "OPTION_NONE": "None" }, "POPOVER": { "USER_PROFILE": "User Profile", diff --git a/app/locales/locale-es.json b/app/locales/locale-es.json index 142f22ef..41d234ba 100644 --- a/app/locales/locale-es.json +++ b/app/locales/locale-es.json @@ -856,7 +856,10 @@ "COLUMN_PROJECT": "Proyecto", "COLUMN_RECEIVE_ALL": "Recibir Todo", "COLUMN_ONLY_INVOLVED": "Estoy involucrado", - "COLUMN_NO_NOTIFICATIONS": "Sin notificaciones" + "COLUMN_NO_NOTIFICATIONS": "Sin notificaciones", + "OPTION_ALL": "Todas", + "OPTION_INVOLVED": "Involucrado", + "OPTION_NONE": "Ninguna" }, "POPOVER": { "USER_PROFILE": "Perfil de Usuario", diff --git a/app/locales/locale-fr.json b/app/locales/locale-fr.json index 9cc3baf9..43b510aa 100644 --- a/app/locales/locale-fr.json +++ b/app/locales/locale-fr.json @@ -856,7 +856,10 @@ "COLUMN_PROJECT": "Projet", "COLUMN_RECEIVE_ALL": "Tout recevoir", "COLUMN_ONLY_INVOLVED": "Uniquement si impliqué", - "COLUMN_NO_NOTIFICATIONS": "Aucune notification" + "COLUMN_NO_NOTIFICATIONS": "Aucune notification", + "OPTION_ALL": "Toutes", + "OPTION_INVOLVED": "Impliqué", + "OPTION_NONE": "Aucune" }, "POPOVER": { "USER_PROFILE": "Profil utilisateur",