From 6f3f631fd11f744afa57396e8dd18e064ce90e8f Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 30 Oct 2014 13:24:40 +0000 Subject: SYWEB-12: More formatting. --- webclient/room/room-controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'webclient/room/room-controller.js') diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index 37f51c4e91..fcbcd75364 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -1039,9 +1039,9 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput']) .controller('RoomInfoController', function($scope, $modalInstance, $filter) { console.log("Displaying room info."); - $scope.submitState = function(eventType, content) { - console.log("Submitting " + eventType + " with " + content); - } + $scope.submit = function(event) { + console.error("submit >>> " + JSON.stringify(event)); + }; $scope.dismiss = $modalInstance.dismiss; -- cgit 1.5.1 From 9de9661baaa232da170e45534a7d335bf96ef606 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 30 Oct 2014 16:21:27 +0000 Subject: SYWEB-12: More formatting and tweaking of state event JSON. Use a proper elastic directive to make the + -- cgit 1.5.1 From 0985bfb77584ea77c60c4bf8b3e95c104e2fa3f5 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 30 Oct 2014 16:31:47 +0000 Subject: SYWEB-12: Allow edited state events to be submitted. --- webclient/room/room-controller.js | 11 +++++++++-- webclient/room/room.html | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'webclient/room/room-controller.js') diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index ce513990f2..df93ccf5b8 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -1043,12 +1043,19 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput']) $modalInstance.close("redact"); }; }) -.controller('RoomInfoController', function($scope, $modalInstance, $filter) { +.controller('RoomInfoController', function($scope, $modalInstance, $filter, matrixService) { console.log("Displaying room info."); $scope.submit = function(event) { if (event.content) { - console.error("submit >>> " + JSON.stringify(event)); + console.log("submit >>> " + JSON.stringify(event.content)); + matrixService.sendStateEvent($scope.room_id, event.type, + event.content, event.state_key).then(function(response) { + $modalInstance.dismiss(); + }, function(err) { + $scope.feedback = err.data.error; + } + ); } }; diff --git a/webclient/room/room.html b/webclient/room/room.html index 627918223a..16c35c032c 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -24,7 +24,7 @@
Set by: {{ event.user_id }}
- -- cgit 1.5.1 From f618f99ecea1c200b10e11de7b6fc64fcd1b7e78 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 30 Oct 2014 17:01:17 +0000 Subject: 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(-) (limited to 'webclient/room/room-controller.js') diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index df93ccf5b8..59274baccb 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 16c35c032c..6c0db6d7d3 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -16,7 +16,7 @@