Refactor components for the main content section

Each conversation views now manages its own separate elements
rather than all binding to a shared #conversation element, and
similarly for message composition ui.

Also includes the beginnings of group creation UI (not working yet),
featuring bootstrap-tagsinput field for entering group recipients
This commit is contained in:
lilia 2014-08-10 23:34:29 -07:00
parent 28e16aaae8
commit c034ac8267
9 changed files with 216 additions and 44 deletions

View file

@ -21,7 +21,15 @@ var Whisper = Whisper || {};
},
sendMessage: function(message) {
var m = Whisper.Messages.addOutgoingMessage(message, this);
this.messages().add({ type: 'outgoing',
body: message,
threadId: this.id,
timestamp: new Date().getTime() }).save();
this.save({ timestamp: new Date().getTime(),
unreadCount: 0,
active: true});
if (this.get('type') == 'private') {
var promise = textsecure.messaging.sendMessageToNumber(this.get('id'), message, []);
}
@ -57,6 +65,18 @@ var Whisper = Whisper || {};
return thread;
},
createGroup: function(recipients, name) {
var group = textsecure.storage.groups.createNewGroup(numbers);
var attributes = {};
attributes = {
id : group.id,
name : name,
numbers : group.numbers,
type : 'group',
};
return this.findOrCreate(attributes);
},
findOrCreateForRecipient: function(recipient) {
var attributes = {};
attributes = {