Skip to content
Snippets Groups Projects
Commit c87e1f64 authored by Emmanuel ROHEE's avatar Emmanuel ROHEE
Browse files

Room: Added a text input to type an image URL in order to send an image message

parent 30efb040
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ h1 { ...@@ -43,7 +43,7 @@ h1 {
} }
.inputBarTable tr td { .inputBarTable tr td {
padding: 4px; padding: 1px 4px;
} }
.mainInput { .mainInput {
...@@ -118,7 +118,7 @@ h1 { ...@@ -118,7 +118,7 @@ h1 {
overflow separetely. overflow separetely.
*/ */
.room .page { .room .page {
height: calc(100vh - 198px); height: calc(100vh - 220px);
} }
/*** Message table ***/ /*** Message table ***/
......
...@@ -197,6 +197,17 @@ angular.module('matrixService', []) ...@@ -197,6 +197,17 @@ angular.module('matrixService', [])
return this.sendMessage(room_id, msg_id, content); return this.sendMessage(room_id, msg_id, content);
}, },
// Send an image message
sendImageMessage: function(room_id, image_url, image_alt, msg_id) {
var content = {
msgtype: "m.image",
url: image_url,
body: image_alt
};
return this.sendMessage(room_id, msg_id, content);
},
// Send an emote message // Send an emote message
sendEmoteMessage: function(room_id, body, msg_id) { sendEmoteMessage: function(room_id, body, msg_id) {
var content = { var content = {
......
...@@ -27,7 +27,8 @@ angular.module('RoomController', []) ...@@ -27,7 +27,8 @@ angular.module('RoomController', [])
$scope.messages = []; $scope.messages = [];
$scope.members = {}; $scope.members = {};
$scope.stopPoll = false; $scope.stopPoll = false;
$scope.imageURLToSend = "";
$scope.userIDToInvite = ""; $scope.userIDToInvite = "";
var shortPoll = function() { var shortPoll = function() {
...@@ -224,6 +225,16 @@ angular.module('RoomController', []) ...@@ -224,6 +225,16 @@ angular.module('RoomController', [])
}); });
}; };
$scope.sendImage = function(url) {
matrixService.sendImageMessage($scope.room_id, url).then(
function() {
console.log("Image sent");
},
function(reason) {
$scope.feedback = "Failed to send image: " + reason;
});
};
$scope.$on('$destroy', function(e) { $scope.$on('$destroy', function(e) {
console.log("onDestroyed: Stopping poll."); console.log("onDestroyed: Stopping poll.");
$scope.stopPoll = true; $scope.stopPoll = true;
......
...@@ -63,6 +63,18 @@ ...@@ -63,6 +63,18 @@
{{ feedback }} {{ feedback }}
</td> </td>
</tr> </tr>
<tr>
<td>
</td>
<td>
<input class="mainInput" ng-model="imageURLToSend" ng-enter="sendImage()" placeholder="Image URL"/>
</td>
<td width="100px">
<button ng-click="sendImage(imageURLToSend)">Send Image</button>
</td>
<td>
</td>
</tr>
</table> </table>
<span> <span>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment