put cancel & save buttons into the roomheader

This commit is contained in:
Matthew Hodgson 2015-08-12 01:30:23 +01:00
parent bf10a03ab1
commit 5153954a28
3 changed files with 10 additions and 7 deletions

View File

@ -67,6 +67,7 @@ module.exports = React.createClass({
var name = null;
var topic_el = null;
var cancel_button = null;
var save_button = null;
var settings_button = null;
var actual_name = this.props.room.currentState.getStateEvents('m.room.name', '');
@ -77,6 +78,8 @@ module.exports = React.createClass({
<input className="mx_RoomHeader_nameInput" type="text" defaultValue={actual_name} placeholder="Name" ref="name_edit"/>
</div>
// if (topic) topic_el = <div className="mx_RoomHeader_topic"><textarea>{ topic.getContent().topic }</textarea></div>
cancel_button = <div className="mx_RoomHeader_textButton" onClick={this.props.onCancelClick}>Cancel</div>
save_button = <div className="mx_RoomHeader_textButton" onClick={this.props.onSaveClick}>Save Changes</div>
} else {
name =
<div className="mx_RoomHeader_name">
@ -102,6 +105,8 @@ module.exports = React.createClass({
</div>
</div>
{callButtons}
{cancel_button}
{save_button}
<div className="mx_RoomHeader_rightRow">
{ settings_button }
<div className="mx_RoomHeader_button mx_RoomHeader_search">

View File

@ -207,12 +207,6 @@ module.exports = React.createClass({
);
})}
</div>
<div className="mx_RoomSettings_buttons">
<div className="mx_RoomSettings_button" onClick={this.props.onSaveClick}>
Save this room
</div>
</div>
</div>
);
}

View File

@ -64,6 +64,10 @@ module.exports = React.createClass({
);
},
onCancelClick: function() {
this.setState(this.getInitialState());
},
getUnreadMessagesString: function() {
if (!this.state.numUnreadMessages) {
return "";
@ -163,7 +167,7 @@ module.exports = React.createClass({
return (
<div className="mx_RoomView">
<RoomHeader ref="header" room={this.state.room} editing={this.state.editingRoomSettings}
onSettingsClick={this.onSettingsClick}/>
onSettingsClick={this.onSettingsClick} onSaveClick={this.onSaveClick} onCancelClick={this.onCancelClick} />
<div className="mx_RoomView_auxPanel">
<CallView room={this.state.room}/>
{ roomEdit }