Ported AccessHistoryModal and ActivityLogModal to React-Bootstrap

Этот коммит содержится в:
hmhealey
2015-10-30 10:45:54 -04:00
родитель efa7b8252f
Коммит 1675adcc7a
4 изменённых файлов: 75 добавлений и 108 удалений

Просмотреть файл

@@ -1,6 +1,7 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
var Modal = ReactBootstrap.Modal;
var UserStore = require('../stores/user_store.jsx');
var ChannelStore = require('../stores/channel_store.jsx');
var AsyncClient = require('../utils/async_client.jsx');
@@ -30,16 +31,23 @@ export default class AccessHistoryModal extends React.Component {
}
onShow() {
AsyncClient.getAudits();
$(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 300);
if ($(window).width() > 768) {
$(ReactDOM.findDOMNode(this.refs.modalBody)).perfectScrollbar();
}
}
onHide() {
$('#user_settings').modal('show');
this.setState({moreInfo: []});
this.props.onModalDismissed();
}
componentDidMount() {
UserStore.addAuditsChangeListener(this.onAuditChange);
$(ReactDOM.findDOMNode(this.refs.modal)).on('shown.bs.modal', this.onShow);
$(ReactDOM.findDOMNode(this.refs.modal)).on('hidden.bs.modal', this.onHide);
}
componentDidUpdate(prevProps) {
if (this.props.show && !prevProps.show) {
this.onShow();
}
}
componentWillUnmount() {
UserStore.removeAuditsChangeListener(this.onAuditChange);
@@ -380,43 +388,23 @@ export default class AccessHistoryModal extends React.Component {
}
return (
<div>
<div
className='modal fade'
ref='modal'
id='access-history'
tabIndex='-1'
role='dialog'
aria-hidden='true'
>
<div className='modal-dialog modal-lg'>
<div className='modal-content'>
<div className='modal-header'>
<button
type='button'
className='close'
data-dismiss='modal'
aria-label='Close'
>
<span aria-hidden='true'>{'×'}</span>
</button>
<h4
className='modal-title'
id='myModalLabel'
>
{'Access History'}
</h4>
</div>
<div
ref='modalBody'
className='modal-body'
>
{content}
</div>
</div>
</div>
</div>
</div>
<Modal
show={this.props.show}
onHide={this.onHide}
bsSize='large'
>
<Modal.Header closeButton={true}>
<Modal.Title>{'Access History'}</Modal.Title>
</Modal.Header>
<Modal.Body ref='modalBody'>
{content}
</Modal.Body>
</Modal>
);
}
}
AccessHistoryModal.propTypes = {
show: React.PropTypes.bool.isRequired,
onModalDismissed: React.PropTypes.func.isRequired
};