mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-27 03:58:06 +03:00
Display a 'Set Topic' button if there is no topic or it's a 0-len string.
This commit is contained in:
parent
6bdb23449a
commit
e8f19b4c0d
3 changed files with 30 additions and 11 deletions
|
@ -280,7 +280,6 @@ a:active { color: #000; }
|
||||||
color: #888;
|
color: #888;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
float: right;
|
|
||||||
width: 15em;
|
width: 15em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
@ -301,6 +300,15 @@ a:active { color: #000; }
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.roomTopicSection {
|
||||||
|
float: right;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roomTopicSetNew {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
.roomHeaderInfo {
|
.roomHeaderInfo {
|
||||||
float: right;
|
float: right;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
|
|
|
@ -51,7 +51,14 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
|
||||||
console.log("Warning: Already editing topic.");
|
console.log("Warning: Already editing topic.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.topic.newTopicText = $rootScope.events.rooms[$scope.room_id]['m.room.topic'].content.topic;
|
var topicEvent = $rootScope.events.rooms[$scope.room_id]['m.room.topic'];
|
||||||
|
if (topicEvent) {
|
||||||
|
$scope.topic.newTopicText = topicEvent.content.topic;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$scope.topic.newTopicText = "";
|
||||||
|
}
|
||||||
|
|
||||||
$scope.topic.isEditing = true;
|
$scope.topic.isEditing = true;
|
||||||
},
|
},
|
||||||
updateTopic: function() {
|
updateTopic: function() {
|
||||||
|
|
|
@ -6,16 +6,20 @@
|
||||||
<div id="roomName">
|
<div id="roomName">
|
||||||
{{ room_id | mRoomName }}
|
{{ room_id | mRoomName }}
|
||||||
</div>
|
</div>
|
||||||
<div id="roomTopic" ng-show="events.rooms[room_id]['m.room.topic'].content.topic">
|
<div class="roomTopicSection">
|
||||||
<div ng-hide="topic.isEditing" ng-dblclick="topic.editTopic()">
|
<button ng-hide="events.rooms[room_id]['m.room.topic'].content.topic || topic.isEditing"
|
||||||
{{ events.rooms[room_id]['m.room.topic'].content.topic | limitTo: 200}}
|
ng-click="topic.editTopic()" class="roomTopicSetNew">
|
||||||
|
Set Topic
|
||||||
|
</button>
|
||||||
|
<div ng-show="events.rooms[room_id]['m.room.topic'].content.topic || topic.isEditing">
|
||||||
|
<div ng-hide="topic.isEditing" ng-dblclick="topic.editTopic()" id="roomTopic">
|
||||||
|
{{ 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>
|
||||||
|
|
||||||
<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 a new issue