From b1352f97acfd0a588eebd105b4ce757b97baef53 Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Wed, 27 Aug 2014 14:31:20 +0200 Subject: [PATCH] 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(-) 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