diff --git a/index.html b/index.html index 3606fe8b..98488b08 100644 --- a/index.html +++ b/index.html @@ -87,7 +87,9 @@
-
Add Files
+
+ +
diff --git a/js/views/new_conversation_view.js b/js/views/new_conversation_view.js index d7cc1adc..1ffa789c 100644 --- a/js/views/new_conversation_view.js +++ b/js/views/new_conversation_view.js @@ -40,6 +40,7 @@ var Whisper = Whisper || {}; Mustache.parse(this.template); this.render(); this.input = new MessageRecipientInputView({el: this.$el.find('input.number')}); + this.fileInput = new Whisper.FileInputView({el: this.$el.find('.attachments')}); }, events: { @@ -53,7 +54,13 @@ var Whisper = Whisper || {}; if (number) { var thread = Whisper.Threads.findOrCreateForRecipient(number); var message_input = this.$el.find('input.send-message'); - thread.sendMessage(message_input.val()); + var message = message_input.val(); + if (message.length > 0 || this.fileInput.hasFiles()) { + this.fileInput.getFiles().then(function(attachments) { + thread.sendMessage(message, attachments); + }); + message_input.val(""); + } this.remove(); thread.trigger('render'); }