From e40d82936359337cecdfc73a3b09cc089f75071b Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Wed, 27 Aug 2014 10:24:01 +0200 Subject: Support limit and feedback param of initialSync --- webclient/home/home-controller.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'webclient/home/home-controller.js') diff --git a/webclient/home/home-controller.js b/webclient/home/home-controller.js index 867ae522a6..3be7fca909 100644 --- a/webclient/home/home-controller.js +++ b/webclient/home/home-controller.js @@ -78,12 +78,15 @@ angular.module('HomeController', ['matrixService', 'mFileInput', 'mFileUpload', var refresh = function() { // List all rooms joined or been invited to - matrixService.rooms(1,true).then( + matrixService.rooms(1, false).then( function(response) { var data = assignRoomAliases(response.data.rooms); $scope.feedback = "Success"; for (var i=0; i Date: Wed, 27 Aug 2014 14:31:20 +0200 Subject: home/recents: show the last message of each message --- webclient/app.css | 45 +++++++++++++++++++++++++++++ webclient/home/home-controller.js | 4 ++- webclient/home/home.html | 61 ++++++++++++++++++++++++++++++++++----- 3 files changed, 102 insertions(+), 8 deletions(-) (limited to 'webclient/home/home-controller.js') diff --git a/webclient/app.css b/webclient/app.css index dfa17fae62..bc23f76f00 100644 --- a/webclient/app.css +++ b/webclient/app.css @@ -342,6 +342,51 @@ h1 { top: 0; } +/*** Recents ***/ +.recentsTable { + max-width: 480px; + width: 100%; + border-collapse: collapse; + table-layout: fixed; +} + +.recentsTable tr { + width: 100%; +} +.recentsTable td { + vertical-align: text-top; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.recentsRoom { + cursor: pointer; +} + +.recentsRoom:hover { + background-color: #f8f8ff; +} + +.recentsRoomName { + font-size: 16px; + padding-top: 7px; + width: auto; +} + +.recentsRoomSummaryTS { + color: #888; + font-size: 12px; + width: 7em; + text-align: right; +} + +.recentsRoomSummary { + color: #888; + font-size: 12px; + padding-bottom: 5px; +} + /*** Profile ***/ .profile-avatar { diff --git a/webclient/home/home-controller.js b/webclient/home/home-controller.js index 3be7fca909..f0c2ccea2f 100644 --- a/webclient/home/home-controller.js +++ b/webclient/home/home-controller.js @@ -86,7 +86,9 @@ angular.module('HomeController', ['matrixService', 'mFileInput', 'mFileUpload', $scope.rooms[data[i].room_id] = data[i]; // Create a shortcut for the last message of this room - $scope.rooms[data[i].room_id].lastMsg = data[i].messages.chunk[0]; + if (data[i].messages && data[i].messages.chunk && data[i].messages.chunk[0]) { + $scope.rooms[data[i].room_id].lastMsg = data[i].messages.chunk[0]; + } } var presence = response.data.presence; diff --git a/webclient/home/home.html b/webclient/home/home.html index 4084f4c388..49eb56a602 100644 --- a/webclient/home/home.html +++ b/webclient/home/home.html @@ -23,13 +23,60 @@ -

My rooms

- -
-
- {{ room.room_display_name }} {{room.membership === 'invite' ? ' (invited)' : ''}} -
-
+

Recents

+ +
+ + + + + + + + + + + +
+ {{ room.room_display_name }} + + {{ (room.lastMsg.ts) | date:'MMM d HH:mm' }} +
+ +
+ {{ room.inviter }} invited you +
+ +
+
+ {{ room.lastMsg.user_id }} + {{ {"join": "joined", "leave": "left", "invite": "invited"}[room.lastMsg.content.membership] }} + {{ room.lastMsg.content.membership === "invite" ? (room.lastMsg.state_key || '') : '' }} +
+ +
+
+
+ {{ room.lastMsg.user_id }} : + + +
+ +
+ {{ room.lastMsg.user_id }} sent an image +
+ +
+ {{ room.lastMsg.content }} +
+
+
+ +
+ {{ room.lastMsg }} +
+
+

Public rooms

-- cgit 1.5.1 From 43242a0657384ffb4171f6b677fef34988f72772 Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Wed, 27 Aug 2014 14:35:40 +0200 Subject: Cleaned ng dependencies --- webclient/home/home-controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'webclient/home/home-controller.js') diff --git a/webclient/home/home-controller.js b/webclient/home/home-controller.js index f0c2ccea2f..f882801e76 100644 --- a/webclient/home/home-controller.js +++ b/webclient/home/home-controller.js @@ -16,9 +16,9 @@ limitations under the License. 'use strict'; -angular.module('HomeController', ['matrixService', 'mFileInput', 'mFileUpload', 'eventHandlerService']) -.controller('HomeController', ['$scope', '$location', 'matrixService', 'mFileUpload', 'eventHandlerService', 'eventStreamService', - function($scope, $location, matrixService, mFileUpload, eventHandlerService, eventStreamService) { +angular.module('HomeController', ['matrixService', 'eventHandlerService']) +.controller('HomeController', ['$scope', '$location', 'matrixService', 'eventHandlerService', 'eventStreamService', + function($scope, $location, matrixService, eventHandlerService, eventStreamService) { $scope.config = matrixService.config(); $scope.rooms = {}; -- cgit 1.5.1 From 308c9273fadefd072f157620225515eb7395633d Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Wed, 27 Aug 2014 15:09:16 +0200 Subject: Moved recents things into a separate (and reusable) controler --- webclient/app.js | 1 + webclient/home/home-controller.js | 68 ++------------------------------- webclient/home/home.html | 54 +------------------------- webclient/index.html | 1 + webclient/recents/recents-controller.js | 66 ++++++++++++++++++++++++++++++++ webclient/recents/recents.html | 53 +++++++++++++++++++++++++ 6 files changed, 126 insertions(+), 117 deletions(-) create mode 100644 webclient/recents/recents-controller.js create mode 100644 webclient/recents/recents.html (limited to 'webclient/home/home-controller.js') diff --git a/webclient/app.js b/webclient/app.js index 6cd50c5e54..1d5503ebc0 100644 --- a/webclient/app.js +++ b/webclient/app.js @@ -20,6 +20,7 @@ var matrixWebClient = angular.module('matrixWebClient', [ 'LoginController', 'RoomController', 'HomeController', + 'RecentsController', 'SettingsController', 'UserController', 'matrixService', diff --git a/webclient/home/home-controller.js b/webclient/home/home-controller.js index f882801e76..e8e91eede7 100644 --- a/webclient/home/home-controller.js +++ b/webclient/home/home-controller.js @@ -16,12 +16,11 @@ limitations under the License. 'use strict'; -angular.module('HomeController', ['matrixService', 'eventHandlerService']) +angular.module('HomeController', ['matrixService', 'eventHandlerService', 'RecentsController']) .controller('HomeController', ['$scope', '$location', 'matrixService', 'eventHandlerService', 'eventStreamService', function($scope, $location, matrixService, eventHandlerService, eventStreamService) { $scope.config = matrixService.config(); - $scope.rooms = {}; $scope.public_rooms = []; $scope.newRoomId = ""; $scope.feedback = ""; @@ -32,77 +31,18 @@ angular.module('HomeController', ['matrixService', 'eventHandlerService']) }; $scope.goToRoom = { - room_id: "", + room_id: "" }; $scope.joinAlias = { - room_alias: "", - }; - - $scope.$on(eventHandlerService.MEMBER_EVENT, function(ngEvent, event, isLive) { - var config = matrixService.config(); - if (event.state_key === config.user_id && event.content.membership === "invite") { - console.log("Invited to room " + event.room_id); - // FIXME push membership to top level key to match /im/sync - event.membership = event.content.membership; - // FIXME bodge a nicer name than the room ID for this invite. - event.room_display_name = event.user_id + "'s room"; - $scope.rooms[event.room_id] = event; - } - }); - - var assignRoomAliases = function(data) { - for (var i=0; i

Recents

- -
- - - - - - - - - - - -
- {{ room.room_display_name }} - - {{ (room.lastMsg.ts) | date:'MMM d HH:mm' }} -
- -
- {{ room.inviter }} invited you -
- -
-
- {{ room.lastMsg.user_id }} - {{ {"join": "joined", "leave": "left", "invite": "invited"}[room.lastMsg.content.membership] }} - {{ room.lastMsg.content.membership === "invite" ? (room.lastMsg.state_key || '') : '' }} -
- -
-
-
- {{ room.lastMsg.user_id }} : - - -
- -
- {{ room.lastMsg.user_id }} sent an image -
- -
- {{ room.lastMsg.content }} -
-
-
- -
- {{ room.lastMsg }} -
-
-
+

Public rooms

diff --git a/webclient/index.html b/webclient/index.html index 86dbb65e1e..f6d3744419 100644 --- a/webclient/index.html +++ b/webclient/index.html @@ -19,6 +19,7 @@ + diff --git a/webclient/recents/recents-controller.js b/webclient/recents/recents-controller.js new file mode 100644 index 0000000000..a9805fc38a --- /dev/null +++ b/webclient/recents/recents-controller.js @@ -0,0 +1,66 @@ +/* + 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('RecentsController', ['matrixService', 'eventHandlerService']) +.controller('RecentsController', ['$scope', 'matrixService', 'eventHandlerService', 'eventStreamService', + function($scope, matrixService, eventHandlerService, eventStreamService) { + $scope.rooms = {}; + + $scope.$on(eventHandlerService.MEMBER_EVENT, function(ngEvent, event, isLive) { + var config = matrixService.config(); + if (event.state_key === config.user_id && event.content.membership === "invite") { + console.log("Invited to room " + event.room_id); + // FIXME push membership to top level key to match /im/sync + event.membership = event.content.membership; + // FIXME bodge a nicer name than the room ID for this invite. + event.room_display_name = event.user_id + "'s room"; + $scope.rooms[event.room_id] = event; + } + }); + + var refresh = function() { + // List all rooms joined or been invited to + matrixService.rooms(1, false).then( + function(response) { + var data = matrixService.assignRoomAliases(response.data.rooms); + for (var i=0; i + + + + + + + + + + + +
+ {{ room.room_display_name }} + + {{ (room.lastMsg.ts) | date:'MMM d HH:mm' }} +
+ +
+ {{ room.inviter }} invited you +
+ +
+
+ {{ room.lastMsg.user_id }} + {{ {"join": "joined", "leave": "left", "invite": "invited"}[room.lastMsg.content.membership] }} + {{ room.lastMsg.content.membership === "invite" ? (room.lastMsg.state_key || '') : '' }} +
+ +
+
+
+ {{ room.lastMsg.user_id }} : + + +
+ +
+ {{ room.lastMsg.user_id }} sent an image +
+ +
+ {{ room.lastMsg.content }} +
+
+
+ +
+ {{ room.lastMsg }} +
+
+
+
-- cgit 1.5.1