Renamed onModalDismissed to onHide to keep it consistent with React-Bootstrap
Этот коммит содержится в:
@@ -14,6 +14,7 @@ export default class AccessHistoryModal extends React.Component {
|
|||||||
|
|
||||||
this.onAuditChange = this.onAuditChange.bind(this);
|
this.onAuditChange = this.onAuditChange.bind(this);
|
||||||
this.handleMoreInfo = this.handleMoreInfo.bind(this);
|
this.handleMoreInfo = this.handleMoreInfo.bind(this);
|
||||||
|
this.onShow = this.onShow.bind(this);
|
||||||
this.onHide = this.onHide.bind(this);
|
this.onHide = this.onHide.bind(this);
|
||||||
this.formatAuditInfo = this.formatAuditInfo.bind(this);
|
this.formatAuditInfo = this.formatAuditInfo.bind(this);
|
||||||
this.handleRevokedSession = this.handleRevokedSession.bind(this);
|
this.handleRevokedSession = this.handleRevokedSession.bind(this);
|
||||||
@@ -38,7 +39,7 @@ export default class AccessHistoryModal extends React.Component {
|
|||||||
}
|
}
|
||||||
onHide() {
|
onHide() {
|
||||||
this.setState({moreInfo: []});
|
this.setState({moreInfo: []});
|
||||||
this.props.onModalDismissed();
|
this.props.onHide();
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
UserStore.addAuditsChangeListener(this.onAuditChange);
|
UserStore.addAuditsChangeListener(this.onAuditChange);
|
||||||
@@ -401,5 +402,5 @@ export default class AccessHistoryModal extends React.Component {
|
|||||||
|
|
||||||
AccessHistoryModal.propTypes = {
|
AccessHistoryModal.propTypes = {
|
||||||
show: React.PropTypes.bool.isRequired,
|
show: React.PropTypes.bool.isRequired,
|
||||||
onModalDismissed: React.PropTypes.func.isRequired
|
onHide: React.PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
const UserStore = require('../stores/user_store.jsx');
|
const UserStore = require('../stores/user_store.jsx');
|
||||||
const Client = require('../utils/client.jsx');
|
const Client = require('../utils/client.jsx');
|
||||||
const AsyncClient = require('../utils/async_client.jsx');
|
const AsyncClient = require('../utils/async_client.jsx');
|
||||||
const Modal = ReactBootstrap.Modal;
|
const Modal = require('./modal.jsx');
|
||||||
const LoadingScreen = require('./loading_screen.jsx');
|
const LoadingScreen = require('./loading_screen.jsx');
|
||||||
const Utils = require('../utils/utils.jsx');
|
const Utils = require('../utils/utils.jsx');
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ export default class ActivityLogModal extends React.Component {
|
|||||||
}
|
}
|
||||||
onHide() {
|
onHide() {
|
||||||
this.setState({moreInfo: []});
|
this.setState({moreInfo: []});
|
||||||
this.props.onModalDismissed();
|
this.props.onHide();
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
UserStore.addSessionsChangeListener(this.onListenerChange);
|
UserStore.addSessionsChangeListener(this.onListenerChange);
|
||||||
@@ -174,5 +174,5 @@ export default class ActivityLogModal extends React.Component {
|
|||||||
|
|
||||||
ActivityLogModal.propTypes = {
|
ActivityLogModal.propTypes = {
|
||||||
show: React.PropTypes.bool.isRequired,
|
show: React.PropTypes.bool.isRequired,
|
||||||
onModalDismissed: React.PropTypes.func.isRequired
|
onHide: React.PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,29 +24,29 @@ export default class ModalToggleButton extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
const {children, dialogType, dialogProps, ...props} = this.props;
|
const {children, dialogType, dialogProps, ...props} = this.props;
|
||||||
|
|
||||||
// this assumes that all modals will have a show property and an onModalDismissed event
|
// this assumes that all modals will have a show property and an onHide event
|
||||||
const dialog = React.createElement(this.props.dialogType, Object.assign({}, dialogProps, {
|
const dialog = React.createElement(this.props.dialogType, Object.assign({}, dialogProps, {
|
||||||
show: this.state.show,
|
show: this.state.show,
|
||||||
onModalDismissed: () => {
|
onHide: () => {
|
||||||
this.hide();
|
this.hide();
|
||||||
|
|
||||||
if (dialogProps.onModalDismissed) {
|
if (dialogProps.onHide) {
|
||||||
dialogProps.onModalDismissed();
|
dialogProps.onHide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// nesting the dialog in the anchor tag looks like it shouldn't work, but it does due to how react-bootstrap
|
||||||
|
// renders modals at the top level of the DOM instead of where you specify in the virtual DOM
|
||||||
return (
|
return (
|
||||||
<div style={{display: 'inline'}}>
|
<a
|
||||||
<a
|
{...props}
|
||||||
{...props}
|
href='#'
|
||||||
href='#'
|
onClick={this.show}
|
||||||
onClick={this.show}
|
>
|
||||||
>
|
{children}
|
||||||
{children}
|
|
||||||
</a>
|
|
||||||
{dialog}
|
{dialog}
|
||||||
</div>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user