1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 04:48:03 +00:00

add link for tagged file

This commit is contained in:
shanshuirenjia
2018-12-18 14:21:25 +08:00
parent 30357d3195
commit 06b1165077
3 changed files with 14 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { gettext } from '../../utils/constants';
import { gettext, siteRoot } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import moment from 'moment';
import { Utils } from '../../utils/utils';
@@ -49,7 +49,7 @@ class ListTaggedFilesDialog extends React.Component {
return (
<Modal isOpen={true} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}>{gettext('Tagged Files')}</ModalHeader>
<ModalBody>
<ModalBody className="dialog-list-container">
<table>
<thead className="table-thread-hidden">
<tr>
@@ -60,9 +60,18 @@ class ListTaggedFilesDialog extends React.Component {
</thead>
<tbody>
{taggedFileList.map((taggedFile, index) => {
let path = Utils.joinPath(taggedFile.parent_path, taggedFile.filename);
let href = '';
if (Utils.isMarkdownFile(path)) {
href = siteRoot + 'wiki/lib/' + this.props.repoID + Utils.encodePath(path);
} else {
href = siteRoot + 'lib/' + this.props.repoID + '/file' + Utils.encodePath(path);
}
return (
<tr key={index}>
<td>{taggedFile.filename}</td>
<td className="name">
<a href={href} target='_blank'>{taggedFile.filename}</a>
</td>
<td>{Utils.bytesToSize(taggedFile.size)}</td>
<td>{moment.unix(taggedFile.mtime).fromNow()}</td>
</tr>