diff --git a/webclient/app-directive.js b/webclient/app-directive.js index 75283598ab833a9c310120f59a6f4c31ee45d601..d788475f461e91808df0c230e6e9d42f73d8e35d 100644 --- a/webclient/app-directive.js +++ b/webclient/app-directive.js @@ -40,4 +40,19 @@ angular.module('matrixWebClient') } } }; -}]); \ No newline at end of file +}]) +.directive('elastic', [ // http://stackoverflow.com/questions/17772260/textarea-auto-height + '$timeout', + function($timeout) { + return { + restrict: 'A', + link: function($scope, element) { + var resize = function() { + return element[0].style.height = "" + element[0].scrollHeight + "px"; + }; + element.on("blur keyup change", resize); + $timeout(resize, 10); + } + }; + } +]);; diff --git a/webclient/app.css b/webclient/app.css index 2dc6e8caeda548d2346ce531a027a7a88a2afb0c..5ab8e2b8fd4a8c24ec415fdcf789f7e27d78c6a2 100755 --- a/webclient/app.css +++ b/webclient/app.css @@ -443,6 +443,12 @@ textarea, input { font-family: monospace; } +.room-info-textarea-content { + height: auto; + width: 100%; + resize: vertical; +} + /*** Participant list ***/ #usersTableWrapper { diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index 37f51c4e91a4d89250ba2a1d448f53cbf0b45ece..fcbcd75364beb23a79643e295adcb9211c797fd8 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; diff --git a/webclient/room/room.html b/webclient/room/room.html index 65b959fe94614c97484ccdc3a7755fae539a09cb..cc79d6b77814cb77b6adf0465bab9c77148913f5 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -17,15 +17,19 @@ <div class="modal-body"> <table class="room-info"> <tr ng-repeat="(key, event) in events.rooms[room_id] | stateEventsFilter" class="room-info-event"> - <td class="room-info-event-meta"> + <td class="room-info-event-meta" width="30%"> <span class="monospace">{{ key }}</span> <br/> {{ (event.origin_server_ts) | date:'MMM d HH:mm' }} <br/> Set by: <span class="monospace">{{ event.user_id }}</span> + <br/> + <button ng-click="submit(event)" type="button" class="btn btn-success"> + Submit + </button> </td> - <td class="room-info-event-content"> - <pre>{{ event.content | json }}</pre> + <td class="room-info-event-content" width="70%"> + <textarea class="room-info-textarea-content" elastic ng-model="event.content | json"></textarea> </td> </tr> </table>