1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

Bug repair (#2458)

This commit is contained in:
山水人家
2018-10-25 14:42:53 +08:00
committed by Daniel Pan
parent f3e0284751
commit 209237a22a
12 changed files with 80 additions and 91 deletions

View File

@@ -53,7 +53,7 @@ class CopyDirent extends React.Component {
}
if ( filePath && filePath.length > direntPath.length && filePath.indexOf(direntPath) > -1) {
message = gettext('Can not copy directory %(src)s to its subdirectory %(des)s')
message = gettext('Can not copy directory %(src)s to its subdirectory %(des)s');
message = message.replace('%(src)s', direntPath);
message = message.replace('%(des)s', filePath);
this.setState({errMessage: message});
@@ -88,7 +88,7 @@ class CopyDirent extends React.Component {
}
render() {
let title = gettext("Copy {placeholder} to:");
let title = gettext('Copy {placeholder} to:');
title = title.replace('{placeholder}', '<span class="sf-font">' + Utils.HTMLescape(this.props.dirent.name) + '</span>');
return (
<Modal isOpen={true} toggle={this.toggle}>

View File

@@ -53,7 +53,7 @@ class MoveDirent extends React.Component {
}
if ( filePath && filePath.length > direntPath.length && filePath.indexOf(direntPath) > -1) {
message = gettext('Can not move directory %(src)s to its subdirectory %(des)s')
message = gettext('Can not move directory %(src)s to its subdirectory %(des)s');
message = message.replace('%(src)s', direntPath);
message = message.replace('%(des)s', filePath);
this.setState({errMessage: message});
@@ -87,7 +87,7 @@ class MoveDirent extends React.Component {
}
render() {
let title = gettext("Move {placeholder} to:");
let title = gettext('Move {placeholder} to:');
title = title.replace('{placeholder}', '<span class="sf-font">' + Utils.HTMLescape(this.props.dirent.name) + '</span>');
return (
<Modal isOpen={true} toggle={this.toggle}>

View File

@@ -79,8 +79,12 @@ class DraftListItem extends React.Component {
return (
<tr className={this.state.highlight} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
<td className="icon"><img src={siteRoot + 'media/img/file/192/txt.png'} alt='icon' /></td>
<td className="name a-simulate" onClick={this.onDraftEditClick}>{fileName}</td>
<td className="library a-simulate" onClick={this.onLibraryClick}>{draft.repo_name}</td>
<td className="name a-simulate" >
<span onClick={this.onDraftEditClick}>{fileName}</span>
</td>
<td className="library a-simulate">
<span onClick={this.onLibraryClick}>{draft.repo_name}</span>
</td>
<td className="review">
{ draft.review_id && draft.review_status === 'open' ? <span className="a-simulate" onClick={this.onReviewClick}>#{draft.review_id}</span> : <span>--</span> }
</td>

View File

@@ -1,10 +0,0 @@
.activity-table a {
color: #333;
}
.activity-op {
color: #707070;
background: #f0f0f0;
padding: 4px;
border-radius: 4px;
}

View File

@@ -72,6 +72,7 @@
flex-direction: column;
flex: 1 1 auto;
overflow: hidden;
min-height: 0;
}
.cur-view-path {
@@ -94,9 +95,10 @@
}
.cur-view-content {
padding: 10px 16px 20px;
padding: 0;
height: calc(100% - 40px);
flex: 1;
min-height: 0;
overflow: auto;
}

View File

@@ -57,19 +57,8 @@ img[src=""] {
min-height: 0;
}
.cur-view-container {
min-height: 0;
}
.cur-view-content {
display: flex;
padding: 0;
min-height: 0;
}
.cur-view-content .markdown-container{
padding-left: 40px;
padding-right: 40px;
padding: 10px 40px 20px;
display: flex;
flex: 1;
overflow: auto;

View File

@@ -17,8 +17,8 @@ class FileActivitiesContent extends Component {
return <p className="error text-center">{error_msg}</p>;
} else {
return (
<React.Fragment>
<table className="table table-hover table-vcenter activity-table">
<div className="activity-table-container">
<table className="table table-hover table-vcenter">
<thead>
<tr>
<th width="8%">{/* avatar */}</th>
@@ -32,7 +32,7 @@ class FileActivitiesContent extends Component {
</table>
{has_more ? <span className="loading-icon loading-tip"></span> : ''}
{error_msg ? <p className="error text-center">{error_msg}</p> : ''}
</React.Fragment>
</div>
);
}
}

View File

@@ -103,7 +103,7 @@ class DraftContent extends React.Component {
render() {
return (
<div className="cur-view-content" style={{padding: 0}}>
<div className="cur-view-content">
{this.state.isLoadingDraft && <Loading /> }
{(!this.state.isLoadingDraft && this.state.draftList.length !==0) &&
<DraftListView

View File

@@ -31,7 +31,7 @@ class ReviewContent extends React.Component {
render() {
return (
<div className="cur-view-content" style={{padding: 0}}>
<div className="cur-view-content">
{this.state.isLoadingReviews && <Loading /> }
{(!this.state.isLoadingReviews && this.state.reviewsList.length !==0) &&
<ReviewListView

View File

@@ -17,9 +17,9 @@ class Content extends Component {
<thead>
<tr>
<th width="5%"></th>
<th width="40%">{gettext("File Name")}</th>
<th width="32%">{gettext("Library")}</th>
<th width="18%">{gettext("Last Update")}</th>
<th width="40%">{gettext('File Name')}</th>
<th width="32%">{gettext('Library')}</th>
<th width="18%">{gettext('Last Update')}</th>
<th width="5%"></th>
</tr>
</thead>
@@ -28,7 +28,7 @@ class Content extends Component {
<thead>
<tr>
<th width="5%"></th>
<th width="90%">{gettext("File Name")}</th>
<th width="90%">{gettext('File Name')}</th>
<th width="5%"></th>
</tr>
</thead>
@@ -71,14 +71,11 @@ class TableBody extends Component {
const _this = this;
let getThumbnail = function(i) {
const curItem = items[i];
seafileAPI.createThumbnail(curItem.repo_id, curItem.path, thumbnailSize).
then((res) => {
seafileAPI.createThumbnail(curItem.repo_id, curItem.path, thumbnailSize).then((res) => {
curItem.encoded_thumbnail_src = res.data.encoded_thumbnail_src;
})
.catch((error) => {
}).catch((error) => {
// do nothing
})
.then(() => {
}).then(() => {
if (i < len - 1) {
getThumbnail(++i);
} else {
@@ -144,14 +141,12 @@ class Item extends Component {
e.preventDefault();
const data = this.props.data;
seafileAPI.unStarFile(data.repo_id, data.path)
.then((res) => {
seafileAPI.unStarFile(data.repo_id, data.path).then((res) => {
this.setState({
unstarred: true
});
// TODO: show feedback msg
})
.catch((error) => {
}).catch((error) => {
// TODO: show feedback msg
});
}
@@ -173,7 +168,7 @@ class Item extends Component {
{
data.thumbnail_url ?
<img className="thumbnail" src={data.thumbnail_url} alt="" /> :
<img src={data.file_icon_url} alt={gettext("icon")} width="24" />
<img src={data.file_icon_url} alt={gettext('icon')} width="24" />
}
</td>
<td>
@@ -186,7 +181,7 @@ class Item extends Component {
<td>{data.repo_name}</td>
<td dangerouslySetInnerHTML={{__html:data.mtime_relative}}></td>
<td>
<a href="#" className={opClasses} title={gettext("Unstar")} aria-label={gettext("Unstar")} onClick={this.handleClick}></a>
<a href="#" className={opClasses} title={gettext('Unstar')} aria-label={gettext('Unstar')} onClick={this.handleClick}></a>
</td>
</tr>
);
@@ -197,7 +192,7 @@ class Item extends Component {
{
data.thumbnail_url ?
<img className="thumbnail" src={data.thumbnail_url} alt="" /> :
<img src={data.file_icon_url} alt={gettext("icon")} width="24" />
<img src={data.file_icon_url} alt={gettext('icon')} width="24" />
}
</td>
<td>
@@ -211,7 +206,7 @@ class Item extends Component {
<span className="dirent-meta-info" dangerouslySetInnerHTML={{__html:data.mtime_relative}}></span>
</td>
<td>
<a href="#" className="sf2-icon-delete unstar op-icon" title={gettext("Unstar")} aria-label={gettext("Unstar")} onClick={this.handleClick}></a>
<a href="#" className="sf2-icon-delete unstar op-icon" title={gettext('Unstar')} aria-label={gettext('Unstar')} onClick={this.handleClick}></a>
</td>
</tr>
);
@@ -235,33 +230,31 @@ class Starred extends Component {
}
componentDidMount() {
seafileAPI.listStarred()
.then((res) => {
// res: {data: Array(2), status: 200, statusText: "OK", headers: {…}, config: {…}, …}
seafileAPI.listStarred().then((res) => {
//res: {data: Array(2), status: 200, statusText: "OK", headers: {…}, config: {…}, …}
this.setState({
loading: false,
items: res.data
});
})
.catch((error) => {
}).catch((error) => {
if (error.response) {
if (error.response.status == 403) {
this.setState({
loading: false,
errorMsg: gettext("Permission denied")
errorMsg: gettext('Permission denied')
});
location.href = `${loginUrl}?next=${encodeURIComponent(location.href)}`;
} else {
this.setState({
loading: false,
errorMsg: gettext("Error")
errorMsg: gettext('Error')
});
}
} else {
this.setState({
loading: false,
errorMsg: gettext("Please check the network.")
errorMsg: gettext('Please check the network.')
});
}
});
@@ -271,12 +264,14 @@ class Starred extends Component {
return (
<div className="cur-view-container" id="starred">
<div className="cur-view-path">
<h3 className="sf-heading">{gettext("Favorites")}</h3>
<h3 className="sf-heading">{gettext('Favorites')}</h3>
</div>
<div className="cur-view-content">
<div className="table-container">
<Content data={this.state} />
</div>
</div>
</div>
);
}
}

View File

@@ -972,3 +972,12 @@ a.op-icon:focus {
text-decoration:none;
border-bottom-color:#eb8205;
}
/* begin activity page */
.activity-table-container {
flex: 1;
padding: 10px 16px 20px;
overflow: auto;
}
/* end activity page */