(js) Localize mail, phone, url and address types

Fixes #4030
pull/234/head
Francis Lachapelle 2017-02-13 22:52:03 -05:00
parent 24da483e2a
commit 5ceafa5005
4 changed files with 15 additions and 8 deletions

1
NEWS
View File

@ -13,6 +13,7 @@ Bug fixes
- [web] ignore mouse events in scrollbars of Month view (#3990)
- [web] fixed public URL with special characters (#3993)
- [web] keep the fab button visible when the center list is hidden
- [web] localized mail, phone, url and address types (#4030)
- [eas] improved EAS parameters parsing (#4003)
- [eas] properly handle canceled appointments

View File

@ -141,7 +141,7 @@
</md-button>
<md-input-container flex="20">
<md-select ng-model="email.type" label:placeholder="Type">
<md-option ng-repeat="type in ::editor.allEmailTypes" ng-value="type">{{ type }}</md-option>
<md-option ng-repeat="type in ::editor.allEmailTypes" ng-value="type">{{ type.capitalize() | loc }}</md-option>
</md-select>
</md-input-container>
<md-input-container class="md-flex">
@ -219,7 +219,7 @@
</md-button>
<md-input-container flex="20">
<md-select ng-model="phone.type" label:placeholder="Type">
<md-option ng-repeat="type in ::editor.allTelTypes" ng-value="type">{{ type }}</md-option>
<md-option ng-repeat="type in ::editor.allTelTypes" ng-value="type">{{ type.capitalize() | loc }}</md-option>
</md-select>
</md-input-container>
<md-input-container class="md-flex">
@ -250,7 +250,7 @@
</md-button>
<md-input-container flex="20">
<md-select ng-model="url.type" label:placeholder="Type">
<md-option ng-repeat="type in ::editor.allUrlTypes" ng-value="type">{{ type }}</md-option>
<md-option ng-repeat="type in ::editor.allUrlTypes" ng-value="type">{{ type.capitalize() | loc }}</md-option>
</md-select>
</md-input-container>
<md-input-container class="md-flex">
@ -282,7 +282,7 @@
<div layout="row">
<md-input-container flex="20">
<md-select ng-model="address.type" label:placeholder="Type">
<md-option ng-repeat="type in ::editor.allAddressTypes" ng-value="type">{{ type }}</md-option>
<md-option ng-repeat="type in ::editor.allAddressTypes" ng-value="type">{{ type.capitalize() | loc }}</md-option>
</md-select>
</md-input-container>
<md-input-container class="md-flex">

View File

@ -104,7 +104,7 @@
<div class="section" ng-show="editor.card.emails.length > 0">
<div class="pseudo-input-container" ng-repeat="email in editor.card.emails">
<label class="pseudo-input-label"><var:entity const:name="nbsp"/>{{email.type}}</label>
<label class="pseudo-input-label"><var:entity const:name="nbsp"/>{{email.type.capitalize() | loc}}</label>
<div class="pseudo-input-field">
<a href="#" ng-bind="email.value"
ng-click="addressbook.newMessageWithRecipient($event, email.value, editor.card.$fullname())"><!-- recipient --></a>
@ -121,7 +121,7 @@
<div class="section" ng-show="editor.card.phones.length > 0">
<div class="pseudo-input-container" ng-repeat="phone in editor.card.phones">
<label class="pseudo-input-label">{{phone.type}}</label>
<label class="pseudo-input-label">{{phone.type.capitalize() | loc}}</label>
<div class="pseudo-input-field">
<a href="tel:{{phone.value}}">{{phone.value}}</a>
</div>
@ -130,7 +130,7 @@
<div class="section" ng-show="editor.card.urls">
<div class="pseudo-input-container" ng-repeat="url in editor.card.urls">
<label class="pseudo-input-label"><var:entity const:name="nbsp"/>{{url.type}}</label>
<label class="pseudo-input-label"><var:entity const:name="nbsp"/>{{url.type.capitalize() | loc}}</label>
<div class="pseudo-input-field">
<a href="#" target="_new" ng-href="{{url.value}}">{{url.value}}</a>
</div>
@ -139,7 +139,7 @@
<div class="section" ng-show="editor.card.addresses">
<div class="pseudo-input-container" ng-repeat="address in editor.card.addresses">
<label class="pseudo-input-label">{{address.type}}</label>
<label class="pseudo-input-label">{{address.type.capitalize() | loc}}</label>
<div class="pseudo-input-field">
<div sg-address="address"><!-- address --></div>
</div>

View File

@ -161,6 +161,12 @@
this.notes = _.map(data.notes, function(note) { return { 'value': note }; });
else if (!this.notes || !this.notes.length)
this.notes = [ { value: '' } ];
// Lowercase the type of specific fields
angular.forEach(['addresses', 'phones', 'urls'], function(key) {
angular.forEach(_this[key], function(o) {
if (o.type) o.type = o.type.toLowerCase();
});
});
// Instanciate Card objects for list members
angular.forEach(this.refs, function(o, i) {
if (o.email) o.emails = [{value: o.email}];