SYWEB-12: More formatting.

This commit is contained in:
Kegan Dougal 2014-10-30 13:24:40 +00:00
parent 40342af459
commit 6f3f631fd1
4 changed files with 32 additions and 7 deletions

View File

@ -40,4 +40,19 @@ angular.module('matrixWebClient')
} }
} }
}; };
}]); }])
.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);
}
};
}
]);;

View File

@ -443,6 +443,12 @@ textarea, input {
font-family: monospace; font-family: monospace;
} }
.room-info-textarea-content {
height: auto;
width: 100%;
resize: vertical;
}
/*** Participant list ***/ /*** Participant list ***/
#usersTableWrapper { #usersTableWrapper {

View File

@ -1039,9 +1039,9 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
.controller('RoomInfoController', function($scope, $modalInstance, $filter) { .controller('RoomInfoController', function($scope, $modalInstance, $filter) {
console.log("Displaying room info."); console.log("Displaying room info.");
$scope.submitState = function(eventType, content) { $scope.submit = function(event) {
console.log("Submitting " + eventType + " with " + content); console.error("submit >>> " + JSON.stringify(event));
} };
$scope.dismiss = $modalInstance.dismiss; $scope.dismiss = $modalInstance.dismiss;

View File

@ -17,15 +17,19 @@
<div class="modal-body"> <div class="modal-body">
<table class="room-info"> <table class="room-info">
<tr ng-repeat="(key, event) in events.rooms[room_id] | stateEventsFilter" class="room-info-event"> <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> <span class="monospace">{{ key }}</span>
<br/> <br/>
{{ (event.origin_server_ts) | date:'MMM d HH:mm' }} {{ (event.origin_server_ts) | date:'MMM d HH:mm' }}
<br/> <br/>
Set by: <span class="monospace">{{ event.user_id }}</span> 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>
<td class="room-info-event-content"> <td class="room-info-event-content" width="70%">
<pre>{{ event.content | json }}</pre> <textarea class="room-info-textarea-content" elastic ng-model="event.content | json"></textarea>
</td> </td>
</tr> </tr>
</table> </table>