From f618f99ecea1c200b10e11de7b6fc64fcd1b7e78 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 30 Oct 2014 17:01:17 +0000 Subject: [PATCH] SYWEB-12: Add ability to add new state events. --- webclient/room/room-controller.js | 9 ++++++++- webclient/room/room.html | 14 +++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index df93ccf5b..59274bacc 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -1018,13 +1018,20 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput']) }; $scope.openRoomInfo = function() { + $scope.roomInfo = {}; + $scope.roomInfo.newEvent = { + content: {}, + type: "", + state_key: "" + }; + var stateFilter = $filter("stateEventsFilter"); var stateEvents = stateFilter($scope.events.rooms[$scope.room_id]); // The modal dialog will 2-way bind this field, so we MUST make a deep // copy of the state events else we will be *actually adjusing our view // of the world* when fiddling with the JSON!! Apparently parse/stringify // is faster than jQuery's extend when doing deep copies. - $scope.roomInfoStateEvents = JSON.parse(JSON.stringify(stateEvents)); + $scope.roomInfo.stateEvents = JSON.parse(JSON.stringify(stateEvents)); var modalInstance = $modal.open({ templateUrl: 'roomInfoTemplate.html', controller: 'RoomInfoController', diff --git a/webclient/room/room.html b/webclient/room/room.html index 16c35c032..6c0db6d7d 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -16,7 +16,7 @@