mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-15 04:41:29 +03:00
Make dialog more specific and hide options behind advanced spoiler
This commit is contained in:
parent
6e39e72849
commit
ca5e26744f
3 changed files with 28 additions and 54 deletions
|
@ -786,19 +786,8 @@ module.exports = React.createClass({
|
||||||
dis.dispatch({action: 'view_set_mxid'});
|
dis.dispatch({action: 'view_set_mxid'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Dialog shows inverse of m.federate (noFederate) strict false check to skip undefined check (default = true)
|
const CreateRoomDialog = sdk.getComponent('dialogs.CreateRoomDialog');
|
||||||
const defaultNoFederate = this.props.config.default_federate === false;
|
Modal.createDialog(CreateRoomDialog, {
|
||||||
const TextInputWithCheckboxDialog = sdk.getComponent("dialogs.TextInputWithCheckboxDialog");
|
|
||||||
Modal.createDialog(TextInputWithCheckboxDialog, {
|
|
||||||
title: _t('Create Room'),
|
|
||||||
description: _t('Room name (optional)'),
|
|
||||||
button: _t('Create Room'),
|
|
||||||
check: defaultNoFederate,
|
|
||||||
checkLabel: <span>
|
|
||||||
{_t('Block users on other matrix homeservers from joining this room')}
|
|
||||||
<br/>
|
|
||||||
({_t('This setting cannot be changed later!')})
|
|
||||||
</span>,
|
|
||||||
onFinished: (shouldCreate, name, noFederate) => {
|
onFinished: (shouldCreate, name, noFederate) => {
|
||||||
if (shouldCreate) {
|
if (shouldCreate) {
|
||||||
const createOpts = {};
|
const createOpts = {};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2015, 2016 OpenMarket Ltd
|
Copyright 2017 Michael Telatynski <7t3chguy@gmail.com>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -16,43 +16,19 @@ limitations under the License.
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
|
import SdkConfig from '../../../SdkConfig';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
|
|
||||||
export default React.createClass({
|
export default React.createClass({
|
||||||
displayName: 'TextInputWithCheckboxDialog',
|
displayName: 'CreateRoomDialog',
|
||||||
propTypes: {
|
propTypes: {
|
||||||
title: React.PropTypes.string,
|
|
||||||
description: React.PropTypes.oneOfType([
|
|
||||||
React.PropTypes.element,
|
|
||||||
React.PropTypes.string,
|
|
||||||
]),
|
|
||||||
value: React.PropTypes.string,
|
|
||||||
button: React.PropTypes.string,
|
|
||||||
focus: React.PropTypes.bool,
|
|
||||||
checkLabel: React.PropTypes.oneOfType([
|
|
||||||
React.PropTypes.element,
|
|
||||||
React.PropTypes.string,
|
|
||||||
]),
|
|
||||||
check: React.PropTypes.bool,
|
|
||||||
onFinished: React.PropTypes.func.isRequired,
|
onFinished: React.PropTypes.func.isRequired,
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
|
||||||
return {
|
|
||||||
title: "",
|
|
||||||
value: "",
|
|
||||||
description: "",
|
|
||||||
focus: true,
|
|
||||||
checkLabel: "",
|
|
||||||
check: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
if (this.props.focus) {
|
const config = SdkConfig.get();
|
||||||
// Set the cursor at the end of the text input
|
// Dialog shows inverse of m.federate (noFederate) strict false check to skip undefined check (default = true)
|
||||||
this.refs.textinput.value = this.props.value;
|
this.defaultNoFederate = config.default_federate === false;
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onOk: function() {
|
onOk: function() {
|
||||||
|
@ -66,29 +42,37 @@ export default React.createClass({
|
||||||
render: function() {
|
render: function() {
|
||||||
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
||||||
return (
|
return (
|
||||||
<BaseDialog className="mx_TextInputWithCheckboxDialog" onFinished={this.props.onFinished}
|
<BaseDialog className="mx_CreateRoomDialog" onFinished={this.props.onFinished}
|
||||||
onEnterPressed={this.onOk}
|
onEnterPressed={this.onOk}
|
||||||
title={this.props.title}
|
title={_t('Create Room')}
|
||||||
>
|
>
|
||||||
<div className="mx_Dialog_content">
|
<div className="mx_Dialog_content">
|
||||||
<div className="mx_TextInputWithCheckboxDialog_label">
|
<div className="mx_CreateRoomDialog_label">
|
||||||
<label htmlFor="textinput"> {this.props.description} </label>
|
<label htmlFor="textinput"> {_t('Room name (optional)')} </label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input id="textinput" ref="textinput" className="mx_TextInputWithCheckboxDialog_input" defaultValue={this.props.value} autoFocus={this.props.focus} size="64" onKeyDown={this.onKeyDown}/>
|
<input id="textinput" ref="textinput" className="mx_CreateRoomDialog_input" autoFocus={true} size="64" onKeyDown={this.onKeyDown}/>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<label>
|
|
||||||
<input type="checkbox" id="checkbox" ref="checkbox" defaultChecked={this.props.check}/>
|
<details className="mx_CreateRoomDialog_details">
|
||||||
{this.props.checkLabel}
|
<summary className="mx_CreateRoomDialog_details_summary">{ _t('Advanced options') }</summary>
|
||||||
|
<div>
|
||||||
|
<input type="checkbox" id="checkbox" ref="checkbox" defaultChecked={this.defaultNoFederate}/>
|
||||||
|
<label htmlFor="checkbox">
|
||||||
|
{_t('Block users on other matrix homeservers from joining this room')}
|
||||||
|
<br/>
|
||||||
|
({_t('This setting cannot be changed later!')})
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
<div className="mx_Dialog_buttons">
|
<div className="mx_Dialog_buttons">
|
||||||
<button onClick={this.onCancel}>
|
<button onClick={this.onCancel}>
|
||||||
{ _t("Cancel") }
|
{ _t('Cancel') }
|
||||||
</button>
|
</button>
|
||||||
<button className="mx_Dialog_primary" onClick={this.onOk}>
|
<button className="mx_Dialog_primary" onClick={this.onOk}>
|
||||||
{this.props.button}
|
{ _t('Create Room') }
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</BaseDialog>
|
</BaseDialog>
|
|
@ -146,6 +146,7 @@
|
||||||
"Microphone": "Microphone",
|
"Microphone": "Microphone",
|
||||||
"Camera": "Camera",
|
"Camera": "Camera",
|
||||||
"Advanced": "Advanced",
|
"Advanced": "Advanced",
|
||||||
|
"Advanced options": "Advanced options",
|
||||||
"Algorithm": "Algorithm",
|
"Algorithm": "Algorithm",
|
||||||
"Hide removed messages": "Hide removed messages",
|
"Hide removed messages": "Hide removed messages",
|
||||||
"Always show message timestamps": "Always show message timestamps",
|
"Always show message timestamps": "Always show message timestamps",
|
||||||
|
|
Loading…
Reference in a new issue