Highlight the current room in the recents list
This commit is contained in:
parent
7ee5288849
commit
d9155b6a25
|
@ -368,6 +368,10 @@ h1 {
|
||||||
background-color: #f8f8ff;
|
background-color: #f8f8ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.recentsRoomSelected {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
.recentsRoomName {
|
.recentsRoomName {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding-top: 7px;
|
padding-top: 7px;
|
||||||
|
|
|
@ -20,7 +20,11 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService'])
|
||||||
.controller('RecentsController', ['$scope', 'matrixService', 'eventHandlerService', 'eventStreamService',
|
.controller('RecentsController', ['$scope', 'matrixService', 'eventHandlerService', 'eventStreamService',
|
||||||
function($scope, matrixService, eventHandlerService, eventStreamService) {
|
function($scope, matrixService, eventHandlerService, eventStreamService) {
|
||||||
$scope.rooms = {};
|
$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) {
|
$scope.$on(eventHandlerService.MEMBER_EVENT, function(ngEvent, event, isLive) {
|
||||||
var config = matrixService.config();
|
var config = matrixService.config();
|
||||||
if (event.state_key === config.user_id && event.content.membership === "invite") {
|
if (event.state_key === config.user_id && event.content.membership === "invite") {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
<div ng-controller="RecentsController" data-ng-init="onInit()">
|
<div ng-controller="RecentsController" data-ng-init="onInit()">
|
||||||
<table class="recentsTable">
|
<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>
|
<tr>
|
||||||
<td class="recentsRoomName">
|
<td class="recentsRoomName">
|
||||||
{{ room.room_display_name }}
|
{{ room.room_display_name }}
|
||||||
|
|
|
@ -327,6 +327,9 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
|
||||||
var onInit2 = function() {
|
var onInit2 = function() {
|
||||||
eventHandlerService.reInitRoom($scope.room_id);
|
eventHandlerService.reInitRoom($scope.room_id);
|
||||||
|
|
||||||
|
// Make recents highlight the current room
|
||||||
|
$scope.recentsSelectedRoomID = $scope.room_id;
|
||||||
|
|
||||||
// Join the room
|
// Join the room
|
||||||
matrixService.join($scope.room_id).then(
|
matrixService.join($scope.room_id).then(
|
||||||
function() {
|
function() {
|
||||||
|
|
Loading…
Reference in New Issue