From da87990bd6e23380cdd5b46809fb80fb619f988c Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Mon, 27 Oct 2014 16:28:33 +0000 Subject: [PATCH] Implement SYWEB-121 : Display JSON when clicking messages. JSON is displayed as a modal dialog via AngularJS' bootstrap module, "ui.bootstrap". --- webclient/app.js | 3 ++- webclient/index.html | 2 ++ webclient/room/room-controller.js | 11 +++++++++-- webclient/room/room.html | 20 +++++++++++--------- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/webclient/app.js b/webclient/app.js index 31118304c..099e2170a 100644 --- a/webclient/app.js +++ b/webclient/app.js @@ -30,7 +30,8 @@ var matrixWebClient = angular.module('matrixWebClient', [ 'MatrixCall', 'eventStreamService', 'eventHandlerService', - 'infinite-scroll' + 'infinite-scroll', + 'ui.bootstrap' ]); matrixWebClient.config(['$routeProvider', '$provide', '$httpProvider', diff --git a/webclient/index.html b/webclient/index.html index f233919e3..35c805129 100644 --- a/webclient/index.html +++ b/webclient/index.html @@ -5,6 +5,7 @@ + @@ -16,6 +17,7 @@ + diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index a1d2e8703..e6149989e 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -15,8 +15,8 @@ limitations under the License. */ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput']) -.controller('RoomController', ['$filter', '$scope', '$timeout', '$routeParams', '$location', '$rootScope', 'matrixService', 'mPresence', 'eventHandlerService', 'mFileUpload', 'matrixPhoneService', 'MatrixCall', - function($filter, $scope, $timeout, $routeParams, $location, $rootScope, matrixService, mPresence, eventHandlerService, mFileUpload, matrixPhoneService, MatrixCall) { +.controller('RoomController', ['$modal', '$filter', '$scope', '$timeout', '$routeParams', '$location', '$rootScope', 'matrixService', 'mPresence', 'eventHandlerService', 'mFileUpload', 'matrixPhoneService', 'MatrixCall', + function($modal, $filter, $scope, $timeout, $routeParams, $location, $rootScope, matrixService, mPresence, eventHandlerService, mFileUpload, matrixPhoneService, MatrixCall) { 'use strict'; var MESSAGES_PER_PAGINATION = 30; var THUMBNAIL_SIZE = 320; @@ -982,4 +982,11 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput']) } }; + $scope.openJson = function(content) { + console.log("Displaying modal dialog for " + JSON.stringify(content)); + var modalInstance = $modal.open({ + template: "
" + angular.toJson(content, true) + "
" + }); + }; + }]); diff --git a/webclient/room/room.html b/webclient/room/room.html index ce2c58190..e753b037f 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -84,10 +84,10 @@
- + {{ members[msg.state_key].displayname || msg.state_key }} joined - + {{ members[msg.state_key].displayname || msg.state_key }} left @@ -101,7 +101,7 @@ + 'ban' === msg.content.membership && msg.changedKey === 'membership'" ng-click="openJson(msg)"> {{ members[msg.user_id].displayname || msg.user_id }} {{ {"invite": "invited", "ban": "banned"}[msg.content.membership] }} {{ members[msg.state_key].displayname || msg.state_key }} @@ -109,23 +109,25 @@ : {{ msg.content.reason }} - + {{ msg.user_id }} changed their display name from {{ msg.prev_content.displayname }} to {{ msg.content.displayname }} + ng-bind-html="'* ' + (members[msg.user_id].displayname || msg.user_id) + ' ' + msg.content.body | linky:'_blank'" + ng-click="openJson(msg)"/> - Outgoing Call{{ isWebRTCSupported ? '' : ' (But your browser does not support VoIP)' }} - Incoming Call{{ isWebRTCSupported ? '' : ' (But your browser does not support VoIP)' }} + Outgoing Call{{ isWebRTCSupported ? '' : ' (But your browser does not support VoIP)' }} + Incoming Call{{ isWebRTCSupported ? '' : ' (But your browser does not support VoIP)' }}
@@ -137,11 +139,11 @@
- + {{ members[msg.user_id].displayname || msg.user_id }} changed the topic to: {{ msg.content.topic }} - + {{ members[msg.user_id].displayname || msg.user_id }} changed the room name to: {{ msg.content.name }}