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

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
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

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) {
_additionalFields() {
return <div>
<div className="mx_Dialog_content">
{this.state.message}
</div>
{this._buttons()}
</div>;
}
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>
{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 });
};
}