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>
<script type='text/x-tmpl-mustache' id='new-group-form'> <script type='text/x-tmpl-mustache' id='new-group-form'>
<form class='send group'> <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'> <input name='numbers' class='numbers' data-role=tagsinput placeholder='Add Recipient'>
<div class='send-message-area'> <div class='send-message-area'>
<div class='message-composer'> <div class='message-composer'>

View file

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