Skip to content

Commit fe71f69

Browse files
committed
rename EditableText's placeHolder parameter to be 'label' to avoid colliding with the HTML5 placeholder parameter
1 parent e0673ee commit fe71f69

8 files changed

Lines changed: 60 additions & 16 deletions

File tree

‎skins/base/css/molecules/MemberTile.css‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
.mx_MemberTile {
1818
cursor: pointer;
1919
display: table-row;
20+
height: 49px;
2021
}
2122

2223
.mx_MemberTile_avatar {
@@ -36,6 +37,24 @@ limitations under the License.
3637
background-color: #dbdbdb;
3738
}
3839

40+
.mx_MemberTile_inviteEditing .mx_MemberTile_avatar {
41+
display: none;
42+
}
43+
44+
.mx_MemberTile_inviteEditing .mx_MemberTile_name {
45+
position: absolute;
46+
width: 200px;
47+
}
48+
49+
.mx_MemberTile_inviteEditing .mx_MemberTile_name input {
50+
border-radius: 3px;
51+
border: 1px solid #c7c7c7;
52+
font-weight: 300;
53+
font-size: 14px;
54+
padding: 9px;
55+
margin-top: 6px;
56+
}
57+
3958
.mx_MemberTile_power {
4059
z-index: 10;
4160
position: absolute;

‎skins/base/views/atoms/EditableText.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = React.createClass({
3333
},
3434

3535
onClickDiv: function() {
36+
console.log("onClickDiv triggered");
3637
this.setState({
3738
phase: this.Phases.Edit,
3839
})
@@ -57,12 +58,12 @@ module.exports = React.createClass({
5758
if (this.state.value) {
5859
editable_el = <div ref="display_div" onClick={this.onClickDiv}>{this.state.value}</div>;
5960
} else {
60-
editable_el = <div ref="display_div" onClick={this.onClickDiv}><i>{this.props.placeHolder}</i></div>;
61+
editable_el = <div ref="display_div" onClick={this.onClickDiv}>{this.props.label}</div>;
6162
}
6263
} else if (this.state.phase == this.Phases.Edit) {
6364
editable_el = (
6465
<div>
65-
<input type="text" defaultValue={this.state.value} onKeyUp={this.onKeyUp} onFocus={this.onFocus} onBlur={this.onFinish} autoFocus/>
66+
<input type="text" defaultValue={this.state.value} onKeyUp={this.onKeyUp} onFocus={this.onFocus} onBlur={this.onFinish} placeholder={this.props.placeHolder} autoFocus/>
6667
</div>
6768
);
6869
}

‎skins/base/views/molecules/MemberTile.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ module.exports = React.createClass({
5959
mainClassName += presenceClass;
6060

6161
return (
62-
<div className={mainClassName} onMouseEnter={ this.mouseEnter } onMouseLeave={ this.mouseLeave }
63-
>
62+
<div className={mainClassName} onMouseEnter={ this.mouseEnter } onMouseLeave={ this.mouseLeave }>
6463
<div className="mx_MemberTile_avatar">
6564
<img className="mx_MemberTile_avatarImg"
6665
src={ this.props.member ? MatrixClientPeg.get().getAvatarUrlForMember(this.props.member, 40, 40, "crop") : null }

‎skins/base/views/organisms/MemberList.js‎

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
'use strict';
1818

1919
var React = require('react');
20+
var classNames = require('classnames');
2021

2122
var MemberListController = require("../../../../src/controllers/organisms/MemberList");
2223

@@ -30,6 +31,10 @@ module.exports = React.createClass({
3031
displayName: 'MemberList',
3132
mixins: [MemberListController],
3233

34+
getInitialState: function() {
35+
return { editing: false };
36+
},
37+
3338
// FIXME: combine this more nicely with the MemberInfo positioning stuff...
3439
onMemberListScroll: function(ev) {
3540
if (this.refs.memberListScroll) {
@@ -55,23 +60,40 @@ module.exports = React.createClass({
5560
onPopulateInvite: function(inputText, shouldSubmit) {
5661
// reset back to placeholder
5762
this.refs.invite.setValue("Invite", false, true);
63+
this.setState({ editing: false });
5864
if (!shouldSubmit) {
5965
return; // enter key wasn't pressed
6066
}
6167
this.onInvite(inputText);
6268
},
6369

70+
onClickInvite: function(ev) {
71+
this.setState({ editing: true });
72+
this.refs.invite.onClickDiv();
73+
console.log("forcing update on memberlist after having clicked invite");
74+
ev.stopPropagation();
75+
ev.preventDefault();
76+
},
77+
6478
inviteTile: function() {
65-
if (this.state.inviting) {
66-
return (
67-
<div></div>
68-
);
69-
}
79+
// if (this.state.inviting) {
80+
// return (
81+
// <div></div>
82+
// );
83+
// }
84+
85+
var classes = classNames({
86+
mx_MemberTile: true,
87+
mx_MemberTile_inviteEditing: this.state.editing,
88+
});
89+
90+
console.log("rendering inviteTile, with phase as " + (this.refs.invite ? this.refs.invite.state.phase : "unknown"));
91+
7092
return (
71-
<div className="mx_MemberTile">
93+
<div className={ classes } onClick={ this.onClickInvite } >
7294
<div className="mx_MemberTile_avatar"><img src="img/create-big.png" width="40" height="40" alt=""/></div>
7395
<div className="mx_MemberTile_name">
74-
<EditableText ref="invite" placeHolder="Invite" onValueChanged={this.onPopulateInvite}/>
96+
<EditableText ref="invite" label="Invite" placeHolder="@user:domain.com" initialValue="" onValueChanged={this.onPopulateInvite}/>
7597
</div>
7698
</div>
7799
);

‎skins/base/views/organisms/UserSettings.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module.exports = React.createClass({
7373
</div>
7474

7575
<div className="mx_UserSettings_DisplayName">
76-
<EditableText ref="displayname" initialValue={this.state.displayName} placeHolder="Click to set display name." onValueChanged={this.changeDisplayname}/>
76+
<EditableText ref="displayname" initialValue={this.state.displayName} label="Click to set display name." onValueChanged={this.changeDisplayname}/>
7777
<div className="mx_UserSettings_DisplayName_Edit" onClick={this.editDisplayName}>Edit</div>
7878
</div>
7979

‎src/controllers/atoms/EditableText.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module.exports = {
2222
propTypes: {
2323
onValueChanged: React.PropTypes.func,
2424
initialValue: React.PropTypes.string,
25+
label: React.PropTypes.string,
2526
placeHolder: React.PropTypes.string,
2627
},
2728

@@ -34,7 +35,8 @@ module.exports = {
3435
return {
3536
onValueChanged: function() {},
3637
initialValue: '',
37-
placeHolder: 'Click to set',
38+
label: 'Click to set',
39+
placeholder: '',
3840
};
3941
},
4042

@@ -77,6 +79,7 @@ module.exports = {
7779
this.setState({
7880
phase: this.Phases.Display,
7981
});
82+
this.onValueChanged(false);
8083
},
8184

8285
onValueChanged: function(shouldSubmit) {

‎src/controllers/molecules/MessageComposer.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,15 @@ module.exports = {
200200
}, function(err) {
201201
console.error("Command failure: %s", err);
202202
Modal.createDialog(ErrorDialog, {
203-
title: "Server Error",
203+
title: "Server error",
204204
description: err.message
205205
});
206206
});
207207
}
208208
else if (cmd.error) {
209209
console.error(cmd.error);
210210
Modal.createDialog(ErrorDialog, {
211-
title: "Command Error",
211+
title: "Command error",
212212
description: cmd.error
213213
});
214214
}

‎src/controllers/organisms/MemberList.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ module.exports = {
101101
}, function(err) {
102102
console.error("Failed to invite: %s", JSON.stringify(err));
103103
Modal.createDialog(ErrorDialog, {
104-
title: "Invite Server Error",
104+
title: "Server error whilst inviting",
105105
description: err.message
106106
});
107107
self.setState({

0 commit comments

Comments
 (0)