Browse Source

Handle unnamed contacts with filter.

pull/103/head
Evan Theurer 12 years ago
parent
commit
4c39454615
  1. 11
      static/js/controllers/contactsmanagercontroller.js
  2. 4
      static/js/filters/displayname.js
  3. 3
      static/partials/contactsmanager.html
  4. 2
      static/partials/contactsmanageredit.html

11
static/js/controllers/contactsmanagercontroller.js

@ -31,12 +31,9 @@ define([], function() { @@ -31,12 +31,9 @@ define([], function() {
var tmp = {
displayName: data.contact ? data.contact.Status.displayName : null
};
var totalUnnamed = 0;
$scope.incrementUnnamedCount = function() {
return totalUnnamed += 1;
var setContactInfo = function(contact) {
contacts.update(contact.Userid, contact.Status);
};
var updateContacts = function(async) {
if (async) {
$scope.$apply(function(scope) {
@ -66,10 +63,6 @@ define([], function() { @@ -66,10 +63,6 @@ define([], function() {
}
}
var setContactInfo = function(contact) {
contacts.update(contact.Userid, contact.Status);
};
$scope.removeContact = function() {
contacts.remove($scope.contact.Userid);
updateContacts();

4
static/js/filters/displayname.js

@ -29,6 +29,7 @@ define([], function() { @@ -29,6 +29,7 @@ define([], function() {
var user_text = translation._("User");
var someone_text = translation._("Someone");
var me_text = translation._("Me");
var contact_text = translation._("Unnamed Contact");
return function(id, me_ok) {
if (id === group_chat_id) {
return "";
@ -38,6 +39,9 @@ define([], function() { @@ -38,6 +39,9 @@ define([], function() {
if (scope.display.displayName) {
return scope.display.displayName;
}
if(me_ok === "contactsmanager") {
return contact_text + " " + scope.buddyIndex;
}
return user_text + " " + scope.buddyIndex;
} else {
var data = appData.get();

3
static/partials/contactsmanager.html

@ -14,8 +14,7 @@ @@ -14,8 +14,7 @@
<div class="buddyPicture"><i class="fa fa-user"/><img ng-show="contact.Status.buddyPicture" alt ng-src="{{contact.Status.buddyPicture}}"/></div>
</td>
<td class="name">
<span ng-if="contact.Status.displayName">{{contact.Status.displayName}}</span>
<span ng-if="!contact.Status.displayName" ng-init="i = incrementUnnamedCount()">Unnamed Contact {{i}}</span>
<span>{{contact.Userid|displayName:'contactsmanager'}}</span>
</td>
<td class="action">
<button class="btn btn-primary" ng-click="edit($index)">{{_('Edit')}}</button>

2
static/partials/contactsmanageredit.html

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
<div class="form-group">
<label class="col-xs-4 control-label">{{_('Name')}}</label>
<div class="col-xs-6">
<input type="text" class="form-control" ng-model="contact.Status.displayName">
<input placeholder="{{_('Unnamed')}}" type="text" class="form-control" ng-model="contact.Status.displayName">
</div>
</div>
<div class="form-group" ng-if="session.Type">

Loading…
Cancel
Save