Restyled country dropdown

Added jquery plugin that allows for flags and country codes to be
displayed in a user-friendly way, on top of the existing phone view
This commit is contained in:
Emily Chao
2015-01-15 11:11:45 -10:00
committed by lilia
parent 5d3020b9ed
commit e74cba8a92
11 changed files with 2043 additions and 54 deletions

View File

@@ -17,36 +17,6 @@ var Whisper = Whisper || {};
(function () {
'use strict';
var MessageRecipientInputView = Backbone.View.extend({
events: {
'change': 'verifyNumber',
'focus' : 'removeError'
},
removeError: function() {
this.$el.removeClass('error');
},
verifyNumber: function() {
try {
var val = this.$el.val();
if (val[0] === '+') {
// assume that the country code is specified
var number = libphonenumber.util.verifyNumber(val);
} else {
// assume that the country code should match our own
var me = textsecure.utils.unencodeNumber(textsecure.storage.getUnencrypted("number_id"))[0];
var myRegionCode = libphonenumber.util.getRegionCodeForNumber(me);
var number = libphonenumber.util.verifyNumber(val, myRegionCode);
}
this.removeError();
return number;
} catch(ex) {
this.$el.addClass('error');
console.log(ex);
}
}
});
Whisper.NewConversationView = Backbone.View.extend({
className: 'conversation',
@@ -56,7 +26,7 @@ var Whisper = Whisper || {};
this.$el.html($(Mustache.render(this.template)));
this.input = new Whisper.PhoneInputView({el: this.$el.find('div.phone-number-input')});
this.fileInput = new Whisper.FileInputView({el: this.$el.find('.attachments')});
this.$el.find('#phone-number-input').append(this.input.render().el);
this.$el.find('div.phone-number-input').append(this.input.render().el);
},
events: {