summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-08-27 17:20:41 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-08-27 17:20:53 +0200
commitd9155b6a25d706edb85706a1c0cff6dacbdc1640 (patch)
treeb1b0119000e2c5ab0a3ca5866040764700a003c6
parentAdded the recents component at the left hand side of the room page (diff)
downloadsynapse-d9155b6a25d706edb85706a1c0cff6dacbdc1640.tar.xz
Highlight the current room in the recents list
-rw-r--r--webclient/app.css4
-rw-r--r--webclient/recents/recents-controller.js6
-rw-r--r--webclient/recents/recents.html5
-rw-r--r--webclient/room/room-controller.js3
4 files changed, 16 insertions, 2 deletions
diff --git a/webclient/app.css b/webclient/app.css
index e2526dcbaa..8abdd1cb44 100644
--- a/webclient/app.css
+++ b/webclient/app.css
@@ -368,6 +368,10 @@ h1 {
     background-color: #f8f8ff;
 }
 
+.recentsRoomSelected {
+    background-color: #eee;
+}
+
 .recentsRoomName {
     font-size: 16px;
     padding-top: 7px;
diff --git a/webclient/recents/recents-controller.js b/webclient/recents/recents-controller.js
index a9805fc38a..8f8b08d5bd 100644
--- a/webclient/recents/recents-controller.js
+++ b/webclient/recents/recents-controller.js
@@ -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") {
diff --git a/webclient/recents/recents.html b/webclient/recents/recents.html
index 6d2864ac97..6fda6c5c6b 100644
--- a/webclient/recents/recents.html
+++ b/webclient/recents/recents.html
@@ -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 }}
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index f49deaa489..641ccddce7 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -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() {