Merge branch 'develop' into rav/roomview_works

This commit is contained in:
Richard van der Hoff 2016-02-15 17:24:15 +00:00
commit b766055f2f
5 changed files with 43 additions and 37 deletions

View file

@ -352,11 +352,12 @@ module.exports = {
}, },
getCommandList: function() { getCommandList: function() {
// Return all the commands plus /me which isn't handled like normal commands // Return all the commands plus /me and /markdown which aren't handled like normal commands
var cmds = Object.keys(commands).sort().map(function(cmdKey) { var cmds = Object.keys(commands).sort().map(function(cmdKey) {
return commands[cmdKey]; return commands[cmdKey];
}) })
cmds.push(new Command("me", "<action>", function(){})); cmds.push(new Command("me", "<action>", function(){}));
cmds.push(new Command("markdown", "<on|off>", function(){}));
return cmds; return cmds;
} }

View file

@ -51,7 +51,7 @@ module.exports = React.createClass({
if (this.props.truncateAt >= 0) { if (this.props.truncateAt >= 0) {
var overflowCount = childCount - this.props.truncateAt; var overflowCount = childCount - this.props.truncateAt;
if (overflowCount > 0) { if (overflowCount > 1) {
overflowJsx = this.props.createOverflowElement( overflowJsx = this.props.createOverflowElement(
overflowCount, childCount overflowCount, childCount
); );

View file

@ -89,7 +89,7 @@ module.exports = React.createClass({
} }
return ( return (
<SearchableEntityList searchPlaceholderText={"Invite / Search"} <SearchableEntityList searchPlaceholderText={"Invite/search by name, email, id"}
onSubmit={this.props.onInvite} onSubmit={this.props.onInvite}
onQueryChanged={this.onSearchQueryChanged} onQueryChanged={this.onSearchQueryChanged}
entities={entities} entities={entities}

View file

@ -35,21 +35,23 @@ var invite_defer = q.defer();
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'MemberList', displayName: 'MemberList',
getInitialState: function() { getInitialState: function() {
if (!this.props.roomId) return { members: [] }; var state = {
var cli = MatrixClientPeg.get(); members: [],
var room = cli.getRoom(this.props.roomId);
if (!room) return { members: [] };
this.memberDict = this.getMemberDict();
var members = this.roomMembers(INITIAL_LOAD_NUM_MEMBERS);
return {
members: members,
// ideally we'd size this to the page height, but // ideally we'd size this to the page height, but
// in practice I find that a little constraining // in practice I find that a little constraining
truncateAt: INITIAL_LOAD_NUM_MEMBERS, truncateAt: INITIAL_LOAD_NUM_MEMBERS,
}; };
if (!this.props.roomId) return state;
var cli = MatrixClientPeg.get();
var room = cli.getRoom(this.props.roomId);
if (!room) return state;
this.memberDict = this.getMemberDict();
state.members = this.roomMembers(INITIAL_LOAD_NUM_MEMBERS);
return state;
}, },
componentWillMount: function() { componentWillMount: function() {

View file

@ -140,34 +140,37 @@ var SearchableEntityList = React.createClass({
} }
var list; var list;
if (this.props.truncateAt) { // caller wants list truncated if (this.state.results.length) {
var TruncatedList = sdk.getComponent("elements.TruncatedList"); if (this.props.truncateAt) { // caller wants list truncated
list = ( var TruncatedList = sdk.getComponent("elements.TruncatedList");
<TruncatedList className="mx_SearchableEntityList_list" list = (
truncateAt={this.state.truncateAt} // use state truncation as it may be expanded <TruncatedList className="mx_SearchableEntityList_list"
createOverflowElement={this._createOverflowEntity}> truncateAt={this.state.truncateAt} // use state truncation as it may be expanded
{this.state.results.map((entity) => { createOverflowElement={this._createOverflowEntity}>
return entity.getJsx(); {this.state.results.map((entity) => {
})} return entity.getJsx();
</TruncatedList> })}
); </TruncatedList>
} );
else { }
list = ( else {
<div className="mx_SearchableEntityList_list"> list = (
{this.state.results.map((entity) => { <div className="mx_SearchableEntityList_list">
return entity.getJsx(); {this.state.results.map((entity) => {
})} return entity.getJsx();
</div> })}
); </div>
);
}
list = <GeminiScrollbar autoshow={true} className="mx_SearchableEntityList_listWrapper">
{ list }
</GeminiScrollbar>;
} }
return ( return (
<div className={ "mx_SearchableEntityList " + (this.state.query.length ? "mx_SearchableEntityList_expanded" : "") }> <div className={ "mx_SearchableEntityList " + (this.state.query.length ? "mx_SearchableEntityList_expanded" : "") }>
{inputBox} { inputBox }
<GeminiScrollbar autoshow={true} className="mx_SearchableEntityList_listWrapper"> { list }
{ list }
</GeminiScrollbar>
{ this.state.query.length ? <div className="mx_SearchableEntityList_hrWrapper"><hr/></div> : '' } { this.state.query.length ? <div className="mx_SearchableEntityList_hrWrapper"><hr/></div> : '' }
</div> </div>
); );