summary refs log tree commit diff
path: root/webclient/room
diff options
context:
space:
mode:
Diffstat (limited to 'webclient/room')
-rw-r--r--webclient/room/room-controller.js9
-rw-r--r--webclient/room/room.html22
2 files changed, 21 insertions, 10 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index 10ff12a96b..68845df7d1 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -51,7 +51,14 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
                 console.log("Warning: Already editing topic.");
                 return;
             }
-            $scope.topic.newTopicText = $rootScope.events.rooms[$scope.room_id]['m.room.topic'].content.topic;
+            var topicEvent = $rootScope.events.rooms[$scope.room_id]['m.room.topic'];
+            if (topicEvent) {
+                $scope.topic.newTopicText = topicEvent.content.topic;
+            }
+            else {
+                $scope.topic.newTopicText = "";
+            }
+            
             $scope.topic.isEditing = true;
         },
         updateTopic: function() {
diff --git a/webclient/room/room.html b/webclient/room/room.html
index 0fe45499e0..01f0c4ee33 100644
--- a/webclient/room/room.html
+++ b/webclient/room/room.html
@@ -6,16 +6,20 @@
             <div id="roomName">
                 {{ room_id  | mRoomName }}
             </div>
-            <div id="roomTopic" ng-show="events.rooms[room_id]['m.room.topic'].content.topic">
-                <div ng-hide="topic.isEditing" ng-dblclick="topic.editTopic()">
-                    {{ events.rooms[room_id]['m.room.topic'].content.topic | limitTo: 200}}
+            <div class="roomTopicSection">
+                <button ng-hide="events.rooms[room_id]['m.room.topic'].content.topic || topic.isEditing"
+                    ng-click="topic.editTopic()" class="roomTopicSetNew">
+                    Set Topic
+                </button>
+                <div ng-show="events.rooms[room_id]['m.room.topic'].content.topic || topic.isEditing">
+                    <div ng-hide="topic.isEditing" ng-dblclick="topic.editTopic()" id="roomTopic">
+                        {{ events.rooms[room_id]['m.room.topic'].content.topic | limitTo: 200}}
+                    </div>
+                    <form ng-submit="topic.updateTopic()" ng-show="topic.isEditing" class="roomTopicForm">
+                        <input ng-model="topic.newTopicText" ng-blur="topic.cancelEdit()" class="roomTopicInput" 
+                        autofocus />
+                    </form>
                 </div>
-                
-                <form ng-submit="topic.updateTopic()" ng-show="topic.isEditing" class="roomTopicForm">
-                    <input ng-model="topic.newTopicText" ng-blur="topic.cancelEdit()" class="roomTopicInput" 
-                    autofocus />
-                </form>
-                
             </div>
         </div>
     </div>