rename EditableText's placeHolder parameter to be 'label' to avoid colliding with the HTML5 placeholder parameter
This commit is contained in:
parent
e0673eee29
commit
fe71f69f0a
8 changed files with 60 additions and 16 deletions
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
.mx_MemberTile {
|
.mx_MemberTile {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: table-row;
|
display: table-row;
|
||||||
|
height: 49px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_MemberTile_avatar {
|
.mx_MemberTile_avatar {
|
||||||
|
@ -36,6 +37,24 @@ limitations under the License.
|
||||||
background-color: #dbdbdb;
|
background-color: #dbdbdb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_MemberTile_inviteEditing .mx_MemberTile_avatar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_MemberTile_inviteEditing .mx_MemberTile_name {
|
||||||
|
position: absolute;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_MemberTile_inviteEditing .mx_MemberTile_name input {
|
||||||
|
border-radius: 3px;
|
||||||
|
border: 1px solid #c7c7c7;
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 9px;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.mx_MemberTile_power {
|
.mx_MemberTile_power {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -33,6 +33,7 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onClickDiv: function() {
|
onClickDiv: function() {
|
||||||
|
console.log("onClickDiv triggered");
|
||||||
this.setState({
|
this.setState({
|
||||||
phase: this.Phases.Edit,
|
phase: this.Phases.Edit,
|
||||||
})
|
})
|
||||||
|
@ -57,12 +58,12 @@ module.exports = React.createClass({
|
||||||
if (this.state.value) {
|
if (this.state.value) {
|
||||||
editable_el = <div ref="display_div" onClick={this.onClickDiv}>{this.state.value}</div>;
|
editable_el = <div ref="display_div" onClick={this.onClickDiv}>{this.state.value}</div>;
|
||||||
} else {
|
} else {
|
||||||
editable_el = <div ref="display_div" onClick={this.onClickDiv}><i>{this.props.placeHolder}</i></div>;
|
editable_el = <div ref="display_div" onClick={this.onClickDiv}>{this.props.label}</div>;
|
||||||
}
|
}
|
||||||
} else if (this.state.phase == this.Phases.Edit) {
|
} else if (this.state.phase == this.Phases.Edit) {
|
||||||
editable_el = (
|
editable_el = (
|
||||||
<div>
|
<div>
|
||||||
<input type="text" defaultValue={this.state.value} onKeyUp={this.onKeyUp} onFocus={this.onFocus} onBlur={this.onFinish} autoFocus/>
|
<input type="text" defaultValue={this.state.value} onKeyUp={this.onKeyUp} onFocus={this.onFocus} onBlur={this.onFinish} placeholder={this.props.placeHolder} autoFocus/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,7 @@ module.exports = React.createClass({
|
||||||
mainClassName += presenceClass;
|
mainClassName += presenceClass;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={mainClassName} onMouseEnter={ this.mouseEnter } onMouseLeave={ this.mouseLeave }
|
<div className={mainClassName} onMouseEnter={ this.mouseEnter } onMouseLeave={ this.mouseLeave }>
|
||||||
>
|
|
||||||
<div className="mx_MemberTile_avatar">
|
<div className="mx_MemberTile_avatar">
|
||||||
<img className="mx_MemberTile_avatarImg"
|
<img className="mx_MemberTile_avatarImg"
|
||||||
src={ this.props.member ? MatrixClientPeg.get().getAvatarUrlForMember(this.props.member, 40, 40, "crop") : null }
|
src={ this.props.member ? MatrixClientPeg.get().getAvatarUrlForMember(this.props.member, 40, 40, "crop") : null }
|
||||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
|
var classNames = require('classnames');
|
||||||
|
|
||||||
var MemberListController = require("../../../../src/controllers/organisms/MemberList");
|
var MemberListController = require("../../../../src/controllers/organisms/MemberList");
|
||||||
|
|
||||||
|
@ -30,6 +31,10 @@ module.exports = React.createClass({
|
||||||
displayName: 'MemberList',
|
displayName: 'MemberList',
|
||||||
mixins: [MemberListController],
|
mixins: [MemberListController],
|
||||||
|
|
||||||
|
getInitialState: function() {
|
||||||
|
return { editing: false };
|
||||||
|
},
|
||||||
|
|
||||||
// FIXME: combine this more nicely with the MemberInfo positioning stuff...
|
// FIXME: combine this more nicely with the MemberInfo positioning stuff...
|
||||||
onMemberListScroll: function(ev) {
|
onMemberListScroll: function(ev) {
|
||||||
if (this.refs.memberListScroll) {
|
if (this.refs.memberListScroll) {
|
||||||
|
@ -55,23 +60,40 @@ module.exports = React.createClass({
|
||||||
onPopulateInvite: function(inputText, shouldSubmit) {
|
onPopulateInvite: function(inputText, shouldSubmit) {
|
||||||
// reset back to placeholder
|
// reset back to placeholder
|
||||||
this.refs.invite.setValue("Invite", false, true);
|
this.refs.invite.setValue("Invite", false, true);
|
||||||
|
this.setState({ editing: false });
|
||||||
if (!shouldSubmit) {
|
if (!shouldSubmit) {
|
||||||
return; // enter key wasn't pressed
|
return; // enter key wasn't pressed
|
||||||
}
|
}
|
||||||
this.onInvite(inputText);
|
this.onInvite(inputText);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onClickInvite: function(ev) {
|
||||||
|
this.setState({ editing: true });
|
||||||
|
this.refs.invite.onClickDiv();
|
||||||
|
console.log("forcing update on memberlist after having clicked invite");
|
||||||
|
ev.stopPropagation();
|
||||||
|
ev.preventDefault();
|
||||||
|
},
|
||||||
|
|
||||||
inviteTile: function() {
|
inviteTile: function() {
|
||||||
if (this.state.inviting) {
|
// if (this.state.inviting) {
|
||||||
return (
|
// return (
|
||||||
<div></div>
|
// <div></div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
var classes = classNames({
|
||||||
|
mx_MemberTile: true,
|
||||||
|
mx_MemberTile_inviteEditing: this.state.editing,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("rendering inviteTile, with phase as " + (this.refs.invite ? this.refs.invite.state.phase : "unknown"));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_MemberTile">
|
<div className={ classes } onClick={ this.onClickInvite } >
|
||||||
<div className="mx_MemberTile_avatar"><img src="img/create-big.png" width="40" height="40" alt=""/></div>
|
<div className="mx_MemberTile_avatar"><img src="img/create-big.png" width="40" height="40" alt=""/></div>
|
||||||
<div className="mx_MemberTile_name">
|
<div className="mx_MemberTile_name">
|
||||||
<EditableText ref="invite" placeHolder="Invite" onValueChanged={this.onPopulateInvite}/>
|
<EditableText ref="invite" label="Invite" placeHolder="@user:domain.com" initialValue="" onValueChanged={this.onPopulateInvite}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -73,7 +73,7 @@ module.exports = React.createClass({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mx_UserSettings_DisplayName">
|
<div className="mx_UserSettings_DisplayName">
|
||||||
<EditableText ref="displayname" initialValue={this.state.displayName} placeHolder="Click to set display name." onValueChanged={this.changeDisplayname}/>
|
<EditableText ref="displayname" initialValue={this.state.displayName} label="Click to set display name." onValueChanged={this.changeDisplayname}/>
|
||||||
<div className="mx_UserSettings_DisplayName_Edit" onClick={this.editDisplayName}>Edit</div>
|
<div className="mx_UserSettings_DisplayName_Edit" onClick={this.editDisplayName}>Edit</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ module.exports = {
|
||||||
propTypes: {
|
propTypes: {
|
||||||
onValueChanged: React.PropTypes.func,
|
onValueChanged: React.PropTypes.func,
|
||||||
initialValue: React.PropTypes.string,
|
initialValue: React.PropTypes.string,
|
||||||
|
label: React.PropTypes.string,
|
||||||
placeHolder: React.PropTypes.string,
|
placeHolder: React.PropTypes.string,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -34,7 +35,8 @@ module.exports = {
|
||||||
return {
|
return {
|
||||||
onValueChanged: function() {},
|
onValueChanged: function() {},
|
||||||
initialValue: '',
|
initialValue: '',
|
||||||
placeHolder: 'Click to set',
|
label: 'Click to set',
|
||||||
|
placeholder: '',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -77,6 +79,7 @@ module.exports = {
|
||||||
this.setState({
|
this.setState({
|
||||||
phase: this.Phases.Display,
|
phase: this.Phases.Display,
|
||||||
});
|
});
|
||||||
|
this.onValueChanged(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
onValueChanged: function(shouldSubmit) {
|
onValueChanged: function(shouldSubmit) {
|
||||||
|
|
|
@ -200,7 +200,7 @@ module.exports = {
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
console.error("Command failure: %s", err);
|
console.error("Command failure: %s", err);
|
||||||
Modal.createDialog(ErrorDialog, {
|
Modal.createDialog(ErrorDialog, {
|
||||||
title: "Server Error",
|
title: "Server error",
|
||||||
description: err.message
|
description: err.message
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -208,7 +208,7 @@ module.exports = {
|
||||||
else if (cmd.error) {
|
else if (cmd.error) {
|
||||||
console.error(cmd.error);
|
console.error(cmd.error);
|
||||||
Modal.createDialog(ErrorDialog, {
|
Modal.createDialog(ErrorDialog, {
|
||||||
title: "Command Error",
|
title: "Command error",
|
||||||
description: cmd.error
|
description: cmd.error
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ module.exports = {
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
console.error("Failed to invite: %s", JSON.stringify(err));
|
console.error("Failed to invite: %s", JSON.stringify(err));
|
||||||
Modal.createDialog(ErrorDialog, {
|
Modal.createDialog(ErrorDialog, {
|
||||||
title: "Invite Server Error",
|
title: "Server error whilst inviting",
|
||||||
description: err.message
|
description: err.message
|
||||||
});
|
});
|
||||||
self.setState({
|
self.setState({
|
||||||
|
|
Loading…
Add table
Reference in a new issue