mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-23 18:56:10 +00:00
Add ability to set topic by double-clicking on the topic text then hitting enter.
This commit is contained in:
parent
f64cc237fc
commit
6bdb23449a
@ -297,9 +297,14 @@ a:active { color: #000; }
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.roomTopicInput {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.roomHeaderInfo {
|
.roomHeaderInfo {
|
||||||
float: right;
|
float: right;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Participant list ***/
|
/*** Participant list ***/
|
||||||
|
@ -149,6 +149,7 @@ angular.module('eventHandlerService', [])
|
|||||||
$rootScope.$broadcast(NAME_EVENT, event, isLiveEvent);
|
$rootScope.$broadcast(NAME_EVENT, event, isLiveEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: Can this just be a generic "I am a room state event, can haz store?"
|
||||||
var handleRoomTopic = function(event, isLiveEvent) {
|
var handleRoomTopic = function(event, isLiveEvent) {
|
||||||
console.log("handleRoomTopic live="+isLiveEvent);
|
console.log("handleRoomTopic live="+isLiveEvent);
|
||||||
|
|
||||||
|
@ -235,6 +235,25 @@ angular.module('matrixService', [])
|
|||||||
|
|
||||||
return doRequest("GET", path, undefined, {});
|
return doRequest("GET", path, undefined, {});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setTopic: function(room_id, topic) {
|
||||||
|
var data = {
|
||||||
|
topic: topic
|
||||||
|
};
|
||||||
|
return this.sendStateEvent(room_id, "m.room.topic", data);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
sendStateEvent: function(room_id, eventType, content, state_key) {
|
||||||
|
var path = "/rooms/$room_id/state/"+eventType;
|
||||||
|
if (state_key !== undefined) {
|
||||||
|
path += "/" + state_key;
|
||||||
|
}
|
||||||
|
room_id = encodeURIComponent(room_id);
|
||||||
|
path = path.replace("$room_id", room_id);
|
||||||
|
|
||||||
|
return doRequest("PUT", path, undefined, content);
|
||||||
|
},
|
||||||
|
|
||||||
sendEvent: function(room_id, eventType, txn_id, content) {
|
sendEvent: function(room_id, eventType, txn_id, content) {
|
||||||
// The REST path spec
|
// The REST path spec
|
||||||
|
@ -42,6 +42,31 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
|
|||||||
$scope.imageURLToSend = "";
|
$scope.imageURLToSend = "";
|
||||||
$scope.userIDToInvite = "";
|
$scope.userIDToInvite = "";
|
||||||
|
|
||||||
|
// vars and functions for updating the topic
|
||||||
|
$scope.topic = {
|
||||||
|
isEditing: false,
|
||||||
|
newTopicText: "",
|
||||||
|
editTopic: function() {
|
||||||
|
if ($scope.topic.isEditing) {
|
||||||
|
console.log("Warning: Already editing topic.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.topic.newTopicText = $rootScope.events.rooms[$scope.room_id]['m.room.topic'].content.topic;
|
||||||
|
$scope.topic.isEditing = true;
|
||||||
|
},
|
||||||
|
updateTopic: function() {
|
||||||
|
console.log("Updating topic to "+$scope.topic.newTopicText);
|
||||||
|
matrixService.setTopic($scope.room_id, $scope.topic.newTopicText);
|
||||||
|
$scope.topic.isEditing = false;
|
||||||
|
},
|
||||||
|
cancelEdit: function() {
|
||||||
|
$scope.topic.isEditing = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var scrollToBottom = function(force) {
|
var scrollToBottom = function(force) {
|
||||||
console.log("Scrolling to bottom");
|
console.log("Scrolling to bottom");
|
||||||
|
|
||||||
|
@ -7,7 +7,15 @@
|
|||||||
{{ room_id | mRoomName }}
|
{{ room_id | mRoomName }}
|
||||||
</div>
|
</div>
|
||||||
<div id="roomTopic" ng-show="events.rooms[room_id]['m.room.topic'].content.topic">
|
<div id="roomTopic" ng-show="events.rooms[room_id]['m.room.topic'].content.topic">
|
||||||
{{ events.rooms[room_id]['m.room.topic'].content.topic }}
|
<div ng-hide="topic.isEditing" ng-dblclick="topic.editTopic()">
|
||||||
|
{{ events.rooms[room_id]['m.room.topic'].content.topic | limitTo: 200}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form ng-submit="topic.updateTopic()" ng-show="topic.isEditing" class="roomTopicForm">
|
||||||
|
<input ng-model="topic.newTopicText" ng-blur="topic.cancelEdit()" class="roomTopicInput"
|
||||||
|
autofocus />
|
||||||
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user