forked from MirrorHub/synapse
home/recents: show the last message of each message
This commit is contained in:
parent
6691ca6f8d
commit
b1352f97ac
3 changed files with 102 additions and 8 deletions
|
@ -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 {
|
||||
|
|
|
@ -86,8 +86,10 @@ angular.module('HomeController', ['matrixService', 'mFileInput', 'mFileUpload',
|
|||
$scope.rooms[data[i].room_id] = data[i];
|
||||
|
||||
// Create a shortcut for the last message of this room
|
||||
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;
|
||||
for (var i = 0; i < presence.length; ++i) {
|
||||
|
|
|
@ -23,13 +23,60 @@
|
|||
</form>
|
||||
</div>
|
||||
|
||||
<h3>My rooms</h3>
|
||||
<h3>Recents</h3>
|
||||
|
||||
<div class="rooms" ng-repeat="(rm_id, room) in rooms">
|
||||
<div>
|
||||
<a href="#/room/{{ room.room_alias ? room.room_alias : rm_id }}" >{{ room.room_display_name }}</a> {{room.membership === 'invite' ? ' (invited)' : ''}}
|
||||
<div class="recentsTableWrapper">
|
||||
<table class="recentsTable">
|
||||
<tbody ng-repeat="(rm_id, room) in rooms" ng-click="goToPage('room/' + (room.room_alias ? room.room_alias : rm_id) )" class ="recentsRoom" >
|
||||
<tr>
|
||||
<td class="recentsRoomName">
|
||||
{{ room.room_display_name }}
|
||||
</td>
|
||||
<td class="recentsRoomSummaryTS">
|
||||
{{ (room.lastMsg.ts) | date:'MMM d HH:mm' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" class="recentsRoomSummary">
|
||||
|
||||
<div ng-show="room.membership === 'invite'" >
|
||||
{{ room.inviter }} invited you
|
||||
</div>
|
||||
|
||||
<div ng-hide="room.membership === 'invite'" ng-switch="room.lastMsg.type" >
|
||||
<div ng-switch-when="m.room.member">
|
||||
{{ room.lastMsg.user_id }}
|
||||
{{ {"join": "joined", "leave": "left", "invite": "invited"}[room.lastMsg.content.membership] }}
|
||||
{{ room.lastMsg.content.membership === "invite" ? (room.lastMsg.state_key || '') : '' }}
|
||||
</div>
|
||||
|
||||
<div ng-switch-when="m.room.message">
|
||||
<div ng-switch="room.lastMsg.content.msgtype">
|
||||
<div ng-switch-when="m.text">
|
||||
{{ room.lastMsg.user_id }} :
|
||||
<span ng-bind-html="(room.lastMsg.content.body) | linky:'_blank'">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div ng-switch-when="m.image">
|
||||
{{ room.lastMsg.user_id }} sent an image
|
||||
</div>
|
||||
|
||||
<div ng-switch-default>
|
||||
{{ room.lastMsg.content }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-switch-default>
|
||||
{{ room.lastMsg }}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
<h3>Public rooms</h3>
|
||||
|
|
Loading…
Reference in a new issue