mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-23 18:08:05 +01:00
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:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user