remove pointless self vars and DRY render method of send custom events

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/4735/head
Michael Telatynski 2017-08-31 09:45:46 +01:00
parent ce0861d5bd
commit 68fc202086
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E
1 changed files with 13 additions and 36 deletions

View File

@ -66,6 +66,10 @@ class SendCustomEvent extends React.Component {
this.setState({ message });
}
_additionalFields() {
return <div></div>;
}
render() {
if (this.state.message) {
return <div>
@ -78,6 +82,7 @@ class SendCustomEvent extends React.Component {
return <div>
<div className="mx_Dialog_content">
{this._additionalFields()}
<div className="mx_TextInputDialog_label">
<label htmlFor="eventType"> { _t('Event Type') } </label>
</div>
@ -103,40 +108,14 @@ class SendCustomStateEvent extends SendCustomEvent {
this.refs.stateKey.value);
}
render() {
if (this.state.message) {
return <div>
<div className="mx_Dialog_content">
{this.state.message}
</div>
{this._buttons()}
</div>;
}
_additionalFields() {
return <div>
<div className="mx_Dialog_content">
<div className="mx_TextInputDialog_label">
<label htmlFor="stateKey"> { _t('State Key') } </label>
</div>
<div>
<input id="stateKey" ref="stateKey" className="mx_TextInputDialog_input" size="64" />
</div>
<div className="mx_TextInputDialog_label">
<label htmlFor="eventType"> { _t('Event Type') } </label>
</div>
<div>
<input id="eventType" ref="eventType" className="mx_TextInputDialog_input" size="64" />
</div>
<div className="mx_TextInputDialog_label">
<label htmlFor="evContent"> { _t('Event Content') } </label>
</div>
<div>
<textarea id="evContent" ref="evContent" className="mx_TextInputDialog_input" defaultValue={"{\n\n}"} cols="63" rows="5" />
</div>
<div className="mx_TextInputDialog_label">
<label htmlFor="stateKey"> { _t('State Key') } </label>
</div>
<div>
<input id="stateKey" ref="stateKey" className="mx_TextInputDialog_input" size="64" />
</div>
{this._buttons()}
</div>;
}
}
@ -162,16 +141,14 @@ class RoomStateExplorer extends React.Component {
};
browseEventType(eventType) {
const self = this;
return () => {
self.setState({ eventType });
this.setState({ eventType });
};
}
onViewSourceClick(event) {
const self = this;
return () => {
self.setState({ event: event.event });
this.setState({ event: event.event });
};
}