[i18n] Fix page user settings > notifications

stable
David Barragán Merino 2015-04-27 16:44:36 +02:00
parent 06a6ee8c83
commit 18d9376812
4 changed files with 30 additions and 11 deletions

View File

@ -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) { %>
<div class="policy-table-row" data-index="<%- index %>">
@ -104,7 +104,8 @@ UserNotificationsListDirective = ($repo, $confirm) ->
<input type="radio"
name="policy-<%- notifyPolicy.id %>" id="policy-all-<%- notifyPolicy.id %>"
value="2" <% if (notifyPolicy.notify_level == 2) { %>checked="checked"<% } %>/>
<label for="policy-all-<%- notifyPolicy.id %>">All</label>
<label for="policy-all-<%- notifyPolicy.id %>"
translate="USER_SETTINGS.NOTIFICATIONS.OPTION_ALL"></label>
</fieldset>
</div>
<div class="policy-table-involved">
@ -112,7 +113,8 @@ UserNotificationsListDirective = ($repo, $confirm) ->
<input type="radio"
name="policy-<%- notifyPolicy.id %>" id="policy-involved-<%- notifyPolicy.id %>"
value="1" <% if (notifyPolicy.notify_level == 1) { %>checked="checked"<% } %> />
<label for="policy-involved-<%- notifyPolicy.id %>">Involved</label>
<label for="policy-involved-<%- notifyPolicy.id %>"
translate="USER_SETTINGS.NOTIFICATIONS.OPTION_INVOLVED"></label>
</fieldset>
</div>
<div class="policy-table-none">
@ -120,7 +122,8 @@ UserNotificationsListDirective = ($repo, $confirm) ->
<input type="radio"
name="policy-<%- notifyPolicy.id %>" id="policy-none-<%- notifyPolicy.id %>"
value="3" <% if (notifyPolicy.notify_level == 3) { %>checked="checked"<% } %> />
<label for="policy-none-<%- notifyPolicy.id %>">None</label>
<label for="policy-none-<%- notifyPolicy.id %>"
translate="USER_SETTINGS.NOTIFICATIONS.OPTION_NONE"></label>
</fieldset>
</div>
</div>
@ -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])

View File

@ -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",

View File

@ -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",

View File

@ -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",