|
|
@@ -7,20 +7,9 @@ import UserPicture from '../User/UserPicture';
|
|
|
|
|
|
export default class Revision extends React.Component {
|
|
|
|
|
|
- constructor(props) {
|
|
|
- super(props);
|
|
|
-
|
|
|
- this._onDiffOpenClicked = this._onDiffOpenClicked.bind(this);
|
|
|
- }
|
|
|
-
|
|
|
componentDidMount() {
|
|
|
}
|
|
|
|
|
|
- _onDiffOpenClicked(e) {
|
|
|
- e.preventDefault();
|
|
|
- this.props.onDiffOpenClicked(this.props.revision);
|
|
|
- }
|
|
|
-
|
|
|
renderSimplifiedNodiff(revision) {
|
|
|
const { t } = this.props;
|
|
|
|
|
|
@@ -57,7 +46,6 @@ export default class Revision extends React.Component {
|
|
|
pic = <UserPicture user={author} size="lg" />;
|
|
|
}
|
|
|
|
|
|
- const iconClass = this.props.revisionDiffOpened ? 'fa fa-caret-down caret caret-opened' : 'fa fa-caret-down caret';
|
|
|
return (
|
|
|
<div className="revision-history-main d-flex mt-3">
|
|
|
<div className="mt-2">
|
|
|
@@ -66,30 +54,13 @@ export default class Revision extends React.Component {
|
|
|
<div className="ml-2">
|
|
|
<div className="revision-history-author">
|
|
|
<strong><Username user={author}></Username></strong>
|
|
|
- { this.props.isLatestRevision
|
|
|
- && (
|
|
|
- <span className="badge badge-info ml-2">Latest</span>
|
|
|
- )
|
|
|
- }
|
|
|
+ {this.props.isLatestRevision && <span className="badge badge-info ml-2">Latest</span>}
|
|
|
</div>
|
|
|
<div className="revision-history-meta">
|
|
|
<p>
|
|
|
<UserDate dateTime={revision.createdAt} />
|
|
|
</p>
|
|
|
<p>
|
|
|
- <span className="d-inline-block" style={{ minWidth: '90px' }}>
|
|
|
- { !this.props.hasDiff
|
|
|
- && <span className="text-muted">{ t('No diff') }</span>
|
|
|
- }
|
|
|
- { this.props.hasDiff
|
|
|
- && (
|
|
|
- // use dummy href attr (with preventDefault()), because don't apply style by a:not([href])
|
|
|
- <a className="diff-view" href="" onClick={this._onDiffOpenClicked}>
|
|
|
- <i className={iconClass}></i> {t('View diff')}
|
|
|
- </a>
|
|
|
- )
|
|
|
- }
|
|
|
- </span>
|
|
|
<a href={`?revision=${revision._id}`} className="ml-2">
|
|
|
<i className="icon-login"></i> { t('Go to this version') }
|
|
|
</a>
|
|
|
@@ -120,5 +91,4 @@ Revision.propTypes = {
|
|
|
revisionDiffOpened: PropTypes.bool.isRequired,
|
|
|
hasDiff: PropTypes.bool.isRequired,
|
|
|
isCompactNodiffRevisions: PropTypes.bool.isRequired,
|
|
|
- onDiffOpenClicked: PropTypes.func.isRequired,
|
|
|
};
|