mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
[misc] updated text, fixup, cleaned up code & files for 'list sdoc revisions'
This commit is contained in:
@@ -210,7 +210,7 @@ class ExtraAttributesDialog extends Component {
|
||||
|
||||
return (
|
||||
<>
|
||||
<ModalHeader toggle={this.onToggle}>{gettext('Edit extra attributes')}</ModalHeader>
|
||||
<ModalHeader toggle={this.onToggle}>{gettext('Edit extra properties')}</ModalHeader>
|
||||
<ModalBody>
|
||||
{this.renderColumns()}
|
||||
</ModalBody>
|
||||
|
@@ -110,7 +110,7 @@ class DetailListView extends React.Component {
|
||||
<tr className="file-extra-attributes">
|
||||
<th colSpan={2}>
|
||||
<div className="edit-file-extra-attributes-btn" onClick={this.toggleExtraAttributesDialog}>
|
||||
{gettext('Edit extra attributes')}
|
||||
{gettext('Edit extra properties')}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
|
@@ -152,9 +152,6 @@ class DirentGridView extends React.Component {
|
||||
case 'Unmark as draft':
|
||||
this.onUnmarkAsDraft(currentObject);
|
||||
break;
|
||||
case 'List revisions':
|
||||
this.openRevisionsPage(currentObject);
|
||||
break;
|
||||
case 'Comment':
|
||||
this.onCommentItem();
|
||||
break;
|
||||
@@ -292,14 +289,6 @@ class DirentGridView extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
openRevisionsPage = (currentObject) => {
|
||||
const repoID = this.props.repoID;
|
||||
const filePath = this.getDirentPath(currentObject);
|
||||
const url = Utils.generateRevisionsURL(siteRoot, repoID, filePath);
|
||||
if (!url) return;
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
onCommentItem = () => {
|
||||
this.props.showDirentDetail('comments');
|
||||
}
|
||||
|
@@ -272,9 +272,6 @@ class DirentListItem extends React.Component {
|
||||
case 'Unmark as draft':
|
||||
this.onUnmarkAsDraft();
|
||||
break;
|
||||
case 'List revisions':
|
||||
this.openRevisionsPage();
|
||||
break;
|
||||
case 'Comment':
|
||||
this.props.onDirentClick(this.props.dirent);
|
||||
this.props.showDirentDetail('comments');
|
||||
@@ -394,14 +391,6 @@ class DirentListItem extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
openRevisionsPage = () => {
|
||||
const repoID = this.props.repoID;
|
||||
const filePath = this.getDirentPath(this.props.dirent);
|
||||
const url = Utils.generateRevisionsURL(siteRoot, repoID, filePath);
|
||||
if (!url) return;
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
onHistory = () => {
|
||||
let repoID = this.props.repoID;
|
||||
let filePath = this.getDirentPath(this.props.dirent);
|
||||
|
@@ -157,7 +157,7 @@ class LinkCreation extends React.Component {
|
||||
return false;
|
||||
}
|
||||
if (parseInt(linkAmount) > SHARE_LINK_MAX_NUMBER) {
|
||||
this.setState({errorInfo: gettext('Please enter an integer smaller than 200 as number of links.')});
|
||||
this.setState({errorInfo: gettext('Please enter an integer not bigger than {max_number} as number of links.').replace('{max_number}', SHARE_LINK_MAX_NUMBER)});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +0,0 @@
|
||||
.sdoc-revisions .sdoc-revision:hover {
|
||||
background-color: #f8f8f8;
|
||||
}
|
@@ -167,7 +167,7 @@ class SidePanel extends Component {
|
||||
}
|
||||
return (
|
||||
<div className="h-100 w-100 d-flex align-items-center justify-content-center empty-tip-color">
|
||||
{gettext('No_historical_versions')}
|
||||
{gettext('No version history')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@@ -1,122 +0,0 @@
|
||||
import React, { Component, Fragment } from 'react';
|
||||
import ReactDom from 'react-dom';
|
||||
import moment from 'moment';
|
||||
import classnames from 'classnames';
|
||||
import { siteRoot, mediaUrl, logoPath, siteTitle, logoHeight, logoWidth, gettext } from '../../utils/constants';
|
||||
import '../../css/sdoc-revisions.css';
|
||||
|
||||
moment.locale(window.app.config.lang);
|
||||
const { filename, zipped, forloopLast, repo, viewLibFile, revisions, currentPage, prevPage,
|
||||
nextPage, perPage, pageNext, extraHref } = window.sdocRevisions;
|
||||
const validZipped = JSON.parse(zipped);
|
||||
const validRevisions = JSON.parse(revisions);
|
||||
|
||||
class SdocRevisions extends Component {
|
||||
|
||||
renderPerPage = (perPageCount, className) => {
|
||||
if (perPage === perPageCount) {
|
||||
return (<span className={classnames('', className)}>{perPageCount}</span>);
|
||||
}
|
||||
return (
|
||||
<a href={`?per_page=${perPageCount}${extraHref}`} className={classnames('per-page', className)}>{perPageCount}</a>
|
||||
);
|
||||
}
|
||||
|
||||
renderRevisions = () => {
|
||||
if (!Array.isArray(validRevisions) || validRevisions.length === 0) {
|
||||
return (
|
||||
<div className="empty-tips">
|
||||
<h2 className="alc">{gettext('This file has not revisions yet')}</h2>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<table className="file-audit-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="25%" className="user">{gettext('User')}</th>
|
||||
<th width="50%">{gettext('File_name')}</th>
|
||||
<th width="25%">{gettext('Ctime')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{validRevisions.map(revision => {
|
||||
return (
|
||||
<tr key={revision.doc_uuid} className="sdoc-revision">
|
||||
<td width="25%" className="user">{revision.nickname}</td>
|
||||
<td width="50%">
|
||||
<a href={`${siteRoot}lib/${repo['id']}/file${revision.file_path}`}>
|
||||
{revision.filename}
|
||||
</a>
|
||||
</td>
|
||||
<td width="25%">{moment(revision.created_at).format('YYYY-MM-DD HH:MM')}</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
}
|
||||
|
||||
renderFooter = () => {
|
||||
return (
|
||||
<div id="paginator">
|
||||
{currentPage !== 1 && (
|
||||
<a href={`?page=${prevPage}&per_page=${perPage}${extraHref}`} className="mr-1">{gettext('Previous')}</a>
|
||||
)}
|
||||
{pageNext && (
|
||||
<a href={`?page=${nextPage}&per_page=${perPage}${extraHref}`} className="mr-1">{gettext('Next')}</a>
|
||||
)}
|
||||
{(currentPage !== 1 || pageNext) && (<span className="mr-1">{'|'}</span>)}
|
||||
<span className="mr-1">{gettext('Per page: ')}</span>
|
||||
{this.renderPerPage(25, 'mr-1')}
|
||||
{this.renderPerPage(50, 'mr-1')}
|
||||
{this.renderPerPage(100)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<div id="header" className="d-flex">
|
||||
<a href={siteRoot} id="logo">
|
||||
<img src={`${mediaUrl}${logoPath}`} title={siteTitle} alt="logo" width={logoWidth} height={logoHeight} />
|
||||
</a>
|
||||
</div>
|
||||
<div id="main" className="container-fluid w100 flex-auto ov-auto sdoc-revisions">
|
||||
<div id="wide-panel-noframe" className="row">
|
||||
<div className="col-md-10 col-md-offset-1">
|
||||
<h2 className="file-access-hd">
|
||||
<span className="op-target mr-1">{filename}</span>
|
||||
{gettext('Revisions')}
|
||||
</h2>
|
||||
<div className="file-audit-list-topbar">
|
||||
<p className="path">
|
||||
<span className="mr-1">{gettext('Current Path:')}</span>
|
||||
{validZipped.map((item, index) => {
|
||||
if (forloopLast) {
|
||||
return (<a key={index} href={`${viewLibFile.slice(0, -1)}${item[1]}`} target="_blank" rel="noreferrer">{item[0]}</a>);
|
||||
}
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
<a href={`${viewLibFile.slice(0, -1)}${item[1]}`} target="_blank" rel="noreferrer">{item[0]}</a>
|
||||
{index !== validZipped.length - 1 && (
|
||||
<span className="mr-1 ml-1">{'/'}</span>
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
{this.renderRevisions()}
|
||||
{this.renderFooter()}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ReactDom.render(<SdocRevisions />, document.getElementById('wrapper'));
|
@@ -18,7 +18,6 @@ const TextTranslation = {
|
||||
'UNLOCK' : {key : 'Unlock', value : gettext('Unlock')},
|
||||
'MARK_AS_DRAFT' : {key : 'Mark as draft', value : gettext('Mark as draft')},
|
||||
'UNMARK_AS_DRAFT' : {key : 'Unmark as draft', value : gettext('Unmark as draft')},
|
||||
'LIST_REVISIONS': { key: 'List revisions', value: gettext('List revisions') },
|
||||
'COMMENT' : {key : 'Comment', value : gettext('Comment')},
|
||||
'HISTORY' : {key : 'History', value : gettext('History')},
|
||||
'ACCESS_LOG' : {key : 'Access Log', value : gettext('Access Log')},
|
||||
|
@@ -63,7 +63,7 @@ You've got {{num}} new notices on {{ site_name }}:
|
||||
<p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with user=notice.inv_accepter inv_url=notice.inv_url time=notice.inv_accept_at %}Guest {{user}} accepted your <a href="{{url_base}}{{inv_url}}">invitation</a> at {{time}}.{% endblocktrans %}</p>
|
||||
|
||||
{% elif notice.is_deleted_files_msg %}
|
||||
<p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with repo_url=notice.repo_url repo_name=notice.repo_name %}Your library <a href="{{url_base}}{{ repo_url }}">{{ repo_name }}</a> has recently deleted a large number of files.{% endblocktrans %}</p>
|
||||
<p style="line-height:1.5; margin:.2em 10px .2em 0;">{% blocktrans with repo_url=notice.repo_url repo_name=notice.repo_name %}A large number of files in your library <a href="{{url_base}}{{ repo_url }}">{{ repo_name }}</a> has been deleted recently.{% endblocktrans %}</p>
|
||||
|
||||
{% elif notice.is_repo_monitor_msg %}
|
||||
<p style="line-height:1.5; margin:.2em 10px .2em 0;">
|
||||
|
@@ -380,7 +380,7 @@ REPO_PASSWORD_MIN_LENGTH = 8
|
||||
# token length for the share link
|
||||
SHARE_LINK_TOKEN_LENGTH = 20
|
||||
|
||||
# the maximum number of external share links in a sdoc file
|
||||
# max link number for creating share links in batch
|
||||
SHARE_LINK_MAX_NUMBER = 200
|
||||
|
||||
# if limit only authenticated user can view preview share link
|
||||
|
Reference in New Issue
Block a user