Merge branch 'master' of git+ssh://github.com/matrix-org/synapse

This commit is contained in:
Matthew Hodgson 2014-08-13 16:14:30 +01:00
commit 2ec5f6c2f2
116 changed files with 937 additions and 185 deletions

View file

@ -1,3 +1,19 @@
/*
Copyright 2014 matrix.org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
* Main controller
*/

View file

@ -43,7 +43,7 @@ h1 {
}
.inputBarTable tr td {
padding: 4px;
padding: 1px 4px;
}
.mainInput {
@ -106,7 +106,7 @@ h1 {
background-color: #38AF00;
}
.away {
.unavailable {
background-color: #FFCC00;
}
@ -118,7 +118,7 @@ h1 {
overflow separetely.
*/
.room .page {
height: calc(100vh - 198px);
height: calc(100vh - 220px);
}
/*** Message table ***/
@ -187,6 +187,14 @@ h1 {
border: 0px ! important;
}
.image {
display: block;
max-width:320px;
max-height:320px;
width: auto;
height: auto;
}
.bubble {
padding: 6px;
padding-left: 1em;

View file

@ -1,3 +1,19 @@
/*
Copyright 2014 matrix.org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var matrixWebClient = angular.module('matrixWebClient', [
'ngRoute',
'MatrixWebClientController',

View file

@ -1,3 +1,19 @@
/*
Copyright 2014 matrix.org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
'use strict';
angular.module('matrixService', [])
@ -181,6 +197,17 @@ angular.module('matrixService', [])
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
sendEmoteMessage: function(room_id, body, msg_id) {
var content = {

View file

@ -1,3 +1,19 @@
/*
Copyright 2014 matrix.org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
angular.module('RoomController', [])
.controller('RoomController', ['$scope', '$http', '$timeout', '$routeParams', '$location', 'matrixService',
function($scope, $http, $timeout, $routeParams, $location, matrixService) {
@ -11,7 +27,8 @@ angular.module('RoomController', [])
$scope.messages = [];
$scope.members = {};
$scope.stopPoll = false;
$scope.imageURLToSend = "";
$scope.userIDToInvite = "";
var shortPoll = function() {
@ -106,17 +123,14 @@ angular.module('RoomController', [])
var member = $scope.members[chunk.content.user_id];
if ("state" in chunk.content) {
var ONLINE = 2;
var AWAY = 1;
var OFFLINE = 0;
if (chunk.content.state === ONLINE) {
if (chunk.content.state === "online") {
member.presenceState = "online";
}
else if (chunk.content.state === OFFLINE) {
else if (chunk.content.state === "offline") {
member.presenceState = "offline";
}
else if (chunk.content.state === AWAY) {
member.presenceState = "away";
else if (chunk.content.state === "unavailable") {
member.presenceState = "unavailable";
}
}
@ -208,6 +222,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) {
console.log("onDestroyed: Stopping poll.");
$scope.stopPoll = true;

View file

@ -14,7 +14,7 @@
<img class="userAvatarGradient" src="img/gradient.png" width="80" height="24"/>
<div class="userName">{{ info.displayname || name }}</div>
</td>
<td class="userPresence" ng-class="info.presenceState === 'online' ? 'online' : (info.presenceState === 'away' ? 'away' : '')" />
<td class="userPresence" ng-class="info.presenceState === 'online' ? 'online' : (info.presenceState === 'unavailable' ? 'unavailable' : '')" />
</table>
</div>
@ -32,7 +32,8 @@
<td ng-class="!msg.content.membership_target ? (msg.content.msgtype === 'm.emote' ? 'emote text' : 'text') : ''">
<div class="bubble">
{{ msg.content.msgtype === "m.emote" ? ("* " + (members[msg.user_id].displayname || msg.user_id) + " ") : "" }}
{{ msg.content.body }}
{{ msg.content.msgtype === "m.text" ? msg.content.body : "" }}
<img class="image" ng-hide='msg.content.msgtype !== "m.image"' src="{{ msg.content.url }}" alt="{{ msg.content.body }}"/>
</div>
</td>
<td class="rightBlock">
@ -62,6 +63,18 @@
{{ feedback }}
</td>
</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>
<span>

View file

@ -1,3 +1,19 @@
/*
Copyright 2014 matrix.org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
'use strict';
angular.module('RoomsController', ['matrixService'])