From a477c8be4c182fee22620c7947b54039928ff7ad Mon Sep 17 00:00:00 2001 From: David Baker Date: Sun, 19 Jul 2015 20:47:50 -0400 Subject: [PATCH] Mostly wire up the send file button, except I can't figure out the js magic to make a file input open the prompt. --- skins/base/css/molecules/MessageComposer.css | 1 + skins/base/views/molecules/MessageComposer.js | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/skins/base/css/molecules/MessageComposer.css b/skins/base/css/molecules/MessageComposer.css index 167860ffa3..af4934ee2a 100644 --- a/skins/base/css/molecules/MessageComposer.css +++ b/skins/base/css/molecules/MessageComposer.css @@ -76,6 +76,7 @@ limitations under the License. display: table-cell; vertical-align: middle; padding-right: 15px; + cursor: pointer; } .mx_MessageComposer_upload img { diff --git a/skins/base/views/molecules/MessageComposer.js b/skins/base/views/molecules/MessageComposer.js index 3279fe7a12..2f764b4197 100644 --- a/skins/base/views/molecules/MessageComposer.js +++ b/skins/base/views/molecules/MessageComposer.js @@ -20,13 +20,31 @@ var React = require('react'); var MatrixClientPeg = require("../../../../src/MatrixClientPeg"); var MessageComposerController = require("../../../../src/controllers/molecules/MessageComposer"); +var ContentMessages = require("../../../../src/ContentMessages"); module.exports = React.createClass({ displayName: 'MessageComposer', mixins: [MessageComposerController], + onUploadClick(ev) { + //this.refs.uploadInput.getDOMNode. + }, + + onUploadFileSelected: function(ev) { + var files = ev.target.files; + + ContentMessages.sendContentToRoom( + files[0], this.props.room.roomId, MatrixClientPeg.get() + ).progress(function(ev) { + //console.log("Upload: "+ev.loaded+" / "+ev.total); + }).done(undefined, function() { + // display error message + }); + }, + render: function() { var me = this.props.room.getMember(MatrixClientPeg.get().credentials.userId); + var uploadInputStyle = {display: 'block'}; return (
@@ -37,8 +55,9 @@ module.exports = React.createClass({