mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 21:13:54 +01:00
Highlight the current room in the recents list
This commit is contained in:
parent
7ee5288849
commit
d9155b6a25
4 changed files with 16 additions and 2 deletions
|
@ -368,6 +368,10 @@ h1 {
|
|||
background-color: #f8f8ff;
|
||||
}
|
||||
|
||||
.recentsRoomSelected {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.recentsRoomName {
|
||||
font-size: 16px;
|
||||
padding-top: 7px;
|
||||
|
|
|
@ -20,7 +20,11 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService'])
|
|||
.controller('RecentsController', ['$scope', 'matrixService', 'eventHandlerService', 'eventStreamService',
|
||||
function($scope, matrixService, eventHandlerService, eventStreamService) {
|
||||
$scope.rooms = {};
|
||||
|
||||
|
||||
// $scope of the parent where the recents component is included can override this value
|
||||
// in order to highlight a specific room in the list
|
||||
$scope.recentsSelectedRoomID;
|
||||
|
||||
$scope.$on(eventHandlerService.MEMBER_EVENT, function(ngEvent, event, isLive) {
|
||||
var config = matrixService.config();
|
||||
if (event.state_key === config.user_id && event.content.membership === "invite") {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<div ng-controller="RecentsController" data-ng-init="onInit()">
|
||||
<table class="recentsTable">
|
||||
<tbody ng-repeat="(rm_id, room) in rooms | orderRecents" ng-click="goToPage('room/' + (room.room_alias ? room.room_alias : room.room_id) )" class ="recentsRoom" >
|
||||
<tbody ng-repeat="(rm_id, room) in rooms | orderRecents"
|
||||
ng-click="goToPage('room/' + (room.room_alias ? room.room_alias : room.room_id) )"
|
||||
class ="recentsRoom"
|
||||
ng-class="{'recentsRoomSelected': (room.room_id === recentsSelectedRoomID)}">
|
||||
<tr>
|
||||
<td class="recentsRoomName">
|
||||
{{ room.room_display_name }}
|
||||
|
|
|
@ -327,6 +327,9 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
|
|||
var onInit2 = function() {
|
||||
eventHandlerService.reInitRoom($scope.room_id);
|
||||
|
||||
// Make recents highlight the current room
|
||||
$scope.recentsSelectedRoomID = $scope.room_id;
|
||||
|
||||
// Join the room
|
||||
matrixService.join($scope.room_id).then(
|
||||
function() {
|
||||
|
|
Loading…
Reference in a new issue