Skip to content

Commit

Permalink
(js) Localize mail, phone, url and address types
Browse files Browse the repository at this point in the history
Fixes #4030
  • Loading branch information
cgx committed Feb 14, 2017
1 parent 24da483 commit 5ceafa5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions UI/Templates/ContactsUI/UIxContactEditorTemplate.wox
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down
8 changes: 4 additions & 4 deletions UI/Templates/ContactsUI/UIxContactViewTemplate.wox
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down
6 changes: 6 additions & 0 deletions UI/WebServerResources/js/Contacts/Card.service.js
Expand Up @@ -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}];
Expand Down

0 comments on commit 5ceafa5

Please sign in to comment.