More frontend groups fixes

This commit is contained in:
lilia 2014-10-14 17:01:09 -07:00
parent e89e691957
commit 01f9fc1f17
2 changed files with 5 additions and 3 deletions

View file

@ -96,7 +96,7 @@
</script>
<script type='text/x-tmpl-mustache' id='new-group-form'>
<form class='send group'>
<input name='name' placeholder='New Group'>
<input name='name' class='name' placeholder='New Group'>
<input name='numbers' class='numbers' data-role=tagsinput placeholder='Add Recipient'>
<div class='send-message-area'>
<div class='message-composer'>

View file

@ -19,6 +19,7 @@ var Whisper = Whisper || {};
});
Whisper.NewGroupView = Backbone.View.extend({
className: 'conversation',
initialize: function() {
this.template = $('#new-group-form').html();
Mustache.parse(this.template);
@ -27,7 +28,8 @@ var Whisper = Whisper || {};
new Whisper.GroupRecipientsInputView({el: this.$el.find('input.numbers')}).$el.appendTo(this.$el);
},
events: {
'submit .send': 'send'
'submit .send': 'send',
'close': 'remove'
},
send: function(e) {
@ -35,7 +37,7 @@ var Whisper = Whisper || {};
var numbers = this.$el.find('input.numbers').val().split(',');
var name = this.$el.find('input.name').val();
var thread = Whisper.Threads.createGroup(numbers, name);
thread.sendMessage(this.input.val());
thread.sendMessage(this.$el.find('input.send-message').val());
// close this, select the new thread
},