From ce3dab3c5be05cd5be6513cc7f740ba7d89fd4c8 Mon Sep 17 00:00:00 2001 From: Erik Johnston <erikj@matrix.org> Date: Thu, 16 Jul 2015 17:42:33 +0100 Subject: [PATCH] Make room name editable --- skins/base/views/molecules/RoomHeader.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/skins/base/views/molecules/RoomHeader.js b/skins/base/views/molecules/RoomHeader.js index 62f24484..33d43302 100644 --- a/skins/base/views/molecules/RoomHeader.js +++ b/skins/base/views/molecules/RoomHeader.js @@ -17,14 +17,20 @@ limitations under the License. 'use strict'; var React = require('react'); +var ComponentBroker = require('../../../../src/ComponentBroker'); var MatrixClientPeg = require("../../../../src/MatrixClientPeg"); var RoomHeaderController = require("../../../../src/controllers/molecules/RoomHeader"); +var EditableText = ComponentBroker.get("atoms/EditableText"); module.exports = React.createClass({ displayName: 'RoomHeader', mixins: [RoomHeaderController], + onNameChange: function(new_name) { + MatrixClientPeg.get().setRoomName(this.props.room.roomId, new_name); + }, + render: function() { var topic = this.props.room.currentState.getStateEvents('m.room.topic', ''); @@ -52,7 +58,9 @@ module.exports = React.createClass({ <img src={ MatrixClientPeg.get().getAvatarUrlForRoom(this.props.room, 48, 48, "crop") } width="48" height="48"/> </div> <div className="mx_RoomHeader_info"> - <div className="mx_RoomHeader_name">{ this.props.room.name }</div> + <div className="mx_RoomHeader_name"> + <EditableText initalValue={this.props.room.name} onValueChanged={this.onNameChange} /> + </div> { topic } </div> </div> @@ -76,4 +84,3 @@ module.exports = React.createClass({ ); }, }); -