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