[i18n] Fix page user settings > notifications
parent
06a6ee8c83
commit
18d9376812
|
@ -94,7 +94,7 @@ module.directive("tgUserNotifications", UserNotificationsDirective)
|
||||||
## User Notifications List Directive
|
## User Notifications List Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
UserNotificationsListDirective = ($repo, $confirm) ->
|
UserNotificationsListDirective = ($repo, $confirm, $compile) ->
|
||||||
template = _.template("""
|
template = _.template("""
|
||||||
<% _.each(notifyPolicies, function (notifyPolicy, index) { %>
|
<% _.each(notifyPolicies, function (notifyPolicy, index) { %>
|
||||||
<div class="policy-table-row" data-index="<%- index %>">
|
<div class="policy-table-row" data-index="<%- index %>">
|
||||||
|
@ -104,7 +104,8 @@ UserNotificationsListDirective = ($repo, $confirm) ->
|
||||||
<input type="radio"
|
<input type="radio"
|
||||||
name="policy-<%- notifyPolicy.id %>" id="policy-all-<%- notifyPolicy.id %>"
|
name="policy-<%- notifyPolicy.id %>" id="policy-all-<%- notifyPolicy.id %>"
|
||||||
value="2" <% if (notifyPolicy.notify_level == 2) { %>checked="checked"<% } %>/>
|
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>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
<div class="policy-table-involved">
|
<div class="policy-table-involved">
|
||||||
|
@ -112,7 +113,8 @@ UserNotificationsListDirective = ($repo, $confirm) ->
|
||||||
<input type="radio"
|
<input type="radio"
|
||||||
name="policy-<%- notifyPolicy.id %>" id="policy-involved-<%- notifyPolicy.id %>"
|
name="policy-<%- notifyPolicy.id %>" id="policy-involved-<%- notifyPolicy.id %>"
|
||||||
value="1" <% if (notifyPolicy.notify_level == 1) { %>checked="checked"<% } %> />
|
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>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
<div class="policy-table-none">
|
<div class="policy-table-none">
|
||||||
|
@ -120,7 +122,8 @@ UserNotificationsListDirective = ($repo, $confirm) ->
|
||||||
<input type="radio"
|
<input type="radio"
|
||||||
name="policy-<%- notifyPolicy.id %>" id="policy-none-<%- notifyPolicy.id %>"
|
name="policy-<%- notifyPolicy.id %>" id="policy-none-<%- notifyPolicy.id %>"
|
||||||
value="3" <% if (notifyPolicy.notify_level == 3) { %>checked="checked"<% } %> />
|
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>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -130,13 +133,17 @@ UserNotificationsListDirective = ($repo, $confirm) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
render = ->
|
render = ->
|
||||||
$el.off()
|
$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) ->
|
$el.on "change", "input[type=radio]", (event) ->
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
|
|
||||||
policyIndex = target.parents(".policy-table-row").data('index')
|
policyIndex = target.parents(".policy-table-row").data('index')
|
||||||
policy = $scope.notifyPolicies[policyIndex]
|
policy = $scope.notifyPolicies[policyIndex]
|
||||||
|
|
||||||
prev_level = policy.notify_level
|
prev_level = policy.notify_level
|
||||||
policy.notify_level = parseInt(target.val(), 10)
|
policy.notify_level = parseInt(target.val(), 10)
|
||||||
|
|
||||||
|
@ -145,7 +152,9 @@ UserNotificationsListDirective = ($repo, $confirm) ->
|
||||||
|
|
||||||
onError = ->
|
onError = ->
|
||||||
$confirm.notify("error")
|
$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)
|
$repo.save(policy).then(onSuccess, onError)
|
||||||
|
|
||||||
|
@ -156,4 +165,5 @@ UserNotificationsListDirective = ($repo, $confirm) ->
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgUserNotificationsList", ["$tgRepo", "$tgConfirm", UserNotificationsListDirective])
|
module.directive("tgUserNotificationsList", ["$tgRepo", "$tgConfirm", "$compile",
|
||||||
|
UserNotificationsListDirective])
|
||||||
|
|
|
@ -859,7 +859,10 @@
|
||||||
"COLUMN_PROJECT": "Project",
|
"COLUMN_PROJECT": "Project",
|
||||||
"COLUMN_RECEIVE_ALL": "Receive All",
|
"COLUMN_RECEIVE_ALL": "Receive All",
|
||||||
"COLUMN_ONLY_INVOLVED": "Only Involved",
|
"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": {
|
"POPOVER": {
|
||||||
"USER_PROFILE": "User Profile",
|
"USER_PROFILE": "User Profile",
|
||||||
|
|
|
@ -856,7 +856,10 @@
|
||||||
"COLUMN_PROJECT": "Proyecto",
|
"COLUMN_PROJECT": "Proyecto",
|
||||||
"COLUMN_RECEIVE_ALL": "Recibir Todo",
|
"COLUMN_RECEIVE_ALL": "Recibir Todo",
|
||||||
"COLUMN_ONLY_INVOLVED": "Estoy involucrado",
|
"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": {
|
"POPOVER": {
|
||||||
"USER_PROFILE": "Perfil de Usuario",
|
"USER_PROFILE": "Perfil de Usuario",
|
||||||
|
|
|
@ -856,7 +856,10 @@
|
||||||
"COLUMN_PROJECT": "Projet",
|
"COLUMN_PROJECT": "Projet",
|
||||||
"COLUMN_RECEIVE_ALL": "Tout recevoir",
|
"COLUMN_RECEIVE_ALL": "Tout recevoir",
|
||||||
"COLUMN_ONLY_INVOLVED": "Uniquement si impliqué",
|
"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": {
|
"POPOVER": {
|
||||||
"USER_PROFILE": "Profil utilisateur",
|
"USER_PROFILE": "Profil utilisateur",
|
||||||
|
|
Loading…
Reference in New Issue