Refactor conversation list view
Pull apart UI classes for displaying and creating threads. Also get rid of ugly alert popup in favor of Whisper.notify.pull/749/head
parent
1ec6b0aed6
commit
ce3c5eb909
@ -0,0 +1,45 @@
|
|||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Whisper.ConversationComposeView = Backbone.View.extend({
|
||||||
|
events : {
|
||||||
|
'click #send_link' : 'show_send',
|
||||||
|
'click #send' : 'focus_send',
|
||||||
|
'click #compose-cancel' : 'hide_send',
|
||||||
|
'submit #send' : 'submit_send'
|
||||||
|
},
|
||||||
|
show_send: function(e) {
|
||||||
|
$('#send').fadeIn().find('input[type=text]').focus();
|
||||||
|
},
|
||||||
|
focus_send: function(e) {
|
||||||
|
$('#send input[type=text]').focus();
|
||||||
|
},
|
||||||
|
hide_send: function(e) {
|
||||||
|
$('#send').hide();
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
submit_send: function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var numbers = [];
|
||||||
|
var splitString = $("#send_numbers").val().split(",");
|
||||||
|
for (var i = 0; i < splitString.length; i++) {
|
||||||
|
try {
|
||||||
|
numbers.push(textsecure.utils.verifyNumber(splitString[i]));
|
||||||
|
} catch (numberError) {
|
||||||
|
if (!numberError.countryCodeValid) {
|
||||||
|
Whisper.notify('Invalid country code');
|
||||||
|
}
|
||||||
|
if (!numberError.numberValid) {
|
||||||
|
Whisper.notify('Invalid number');
|
||||||
|
}
|
||||||
|
$('#send input[type=text]').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$("#send_numbers").val('');
|
||||||
|
$('#send').hide();
|
||||||
|
Whisper.Threads.findOrCreateForRecipient(numbers).trigger('select');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
Loading…
Reference in New Issue