Highlight the current room in the recents list

paul/schema_breaking_changes
Emmanuel ROHEE 2014-08-27 17:20:41 +02:00
parent 7ee5288849
commit d9155b6a25
4 changed files with 16 additions and 2 deletions

View File

@ -368,6 +368,10 @@ h1 {
background-color: #f8f8ff;
}
.recentsRoomSelected {
background-color: #eee;
}
.recentsRoomName {
font-size: 16px;
padding-top: 7px;

View File

@ -21,6 +21,10 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService'])
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") {

View File

@ -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 }}

View File

@ -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() {