mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 01:12:03 +00:00
Change dir others content (#6320)
* change dir others content * optimise css codes * remove this.refs * lib-others always show repo trashUrl
This commit is contained in:
15
frontend/src/components/dir-view-mode/dir-column-file.css
Normal file
15
frontend/src/components/dir-view-mode/dir-column-file.css
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
.dir-column-file {
|
||||||
|
padding-right: 10px;
|
||||||
|
padding-left: 10px;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dir-column-file .dir-column-file-top {
|
||||||
|
width: 100%;
|
||||||
|
height: 10px;
|
||||||
|
z-index: 7;
|
||||||
|
transform: translateZ(1000px);
|
||||||
|
position: relative;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
@@ -5,6 +5,8 @@ import { Utils } from '../../utils/utils';
|
|||||||
import { gettext, siteRoot, lang, mediaUrl } from '../../utils/constants';
|
import { gettext, siteRoot, lang, mediaUrl } from '../../utils/constants';
|
||||||
import SeafileMarkdownViewer from '../seafile-markdown-viewer';
|
import SeafileMarkdownViewer from '../seafile-markdown-viewer';
|
||||||
|
|
||||||
|
import './dir-column-file.css';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
repoID: PropTypes.string.isRequired,
|
repoID: PropTypes.string.isRequired,
|
||||||
@@ -59,8 +61,8 @@ class DirColumnFile extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-100 h-100 o-hidden d-flex" style={{ paddingRight: 10, paddingLeft: 10, flexDirection: 'column', alignItems: 'center' }}>
|
<div className="dir-column-file w-100 h-100 o-hidden d-flex">
|
||||||
<div className="" style={{ width: '100%', height: 10, zIndex: 7, transform: 'translateZ(1000px)', position: 'relative', background: '#fff' }}></div>
|
<div className="dir-column-file-top"></div>
|
||||||
<SeafileMetadata repoID={this.props.repoID} currentRepoInfo={this.props.currentRepoInfo} />
|
<SeafileMetadata repoID={this.props.repoID} currentRepoInfo={this.props.currentRepoInfo} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@@ -279,7 +279,6 @@ class DirColumnNav extends React.Component {
|
|||||||
/>
|
/>
|
||||||
<DirOthers
|
<DirOthers
|
||||||
repoID={this.props.repoID}
|
repoID={this.props.repoID}
|
||||||
currentPath={this.props.currentPath}
|
|
||||||
userPerm={this.props.userPerm}
|
userPerm={this.props.userPerm}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
@@ -86,6 +86,7 @@ class DirColumnView extends React.Component {
|
|||||||
this.containerWidth = null;
|
this.containerWidth = null;
|
||||||
this.resizeRef = null;
|
this.resizeRef = null;
|
||||||
this.dragHandler = null;
|
this.dragHandler = null;
|
||||||
|
this.viewModeContainer = React.createRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
onResizeMouseUp = () => {
|
onResizeMouseUp = () => {
|
||||||
@@ -98,7 +99,7 @@ class DirColumnView extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onResizeMouseDown = () => {
|
onResizeMouseDown = () => {
|
||||||
this.containerWidth = this.refs.viewModeContainer.clientWidth;
|
this.containerWidth = this.viewModeContainer.current.clientWidth;
|
||||||
this.setState({
|
this.setState({
|
||||||
inResizing: true
|
inResizing: true
|
||||||
});
|
});
|
||||||
@@ -172,7 +173,7 @@ class DirColumnView extends React.Component {
|
|||||||
const select = inResizing ? 'none' : '';
|
const select = inResizing ? 'none' : '';
|
||||||
const mainFlex = '1 0 ' + (1 - navRate) * 100 + '%';
|
const mainFlex = '1 0 ' + (1 - navRate) * 100 + '%';
|
||||||
return (
|
return (
|
||||||
<div className="dir-column-view" onMouseMove={onResizeMove} onMouseUp={this.onResizeMouseUp} ref="viewModeContainer">
|
<div className="dir-column-view" onMouseMove={onResizeMove} onMouseUp={this.onResizeMouseUp} ref={this.viewModeContainer}>
|
||||||
{isTreePanelShown && (
|
{isTreePanelShown && (
|
||||||
<>
|
<>
|
||||||
<DirColumnNav
|
<DirColumnNav
|
||||||
|
@@ -1,19 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { gettext, siteRoot } from '../../utils/constants';
|
import { gettext, siteRoot } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
|
||||||
import TreeSection from '../tree-section';
|
import TreeSection from '../tree-section';
|
||||||
|
|
||||||
const DirOthers = ({ userPerm, repoID, currentPath }) => {
|
const DirOthers = ({ userPerm, repoID }) => {
|
||||||
|
|
||||||
let trashUrl = null;
|
let trashUrl = null;
|
||||||
const historyUrl = siteRoot + 'repo/history/' + repoID + '/';
|
const historyUrl = siteRoot + 'repo/history/' + repoID + '/';
|
||||||
if (userPerm === 'rw' && !Utils.isMarkdownFile(currentPath)) {
|
if (userPerm === 'rw') {
|
||||||
if (Utils.getFileName(currentPath)) {
|
trashUrl = siteRoot + 'repo/' + repoID + '/trash/';
|
||||||
trashUrl = siteRoot + 'repo/' + repoID + '/trash/?path=' + encodeURIComponent(currentPath);
|
|
||||||
} else {
|
|
||||||
trashUrl = siteRoot + 'repo/' + repoID + '/trash/';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -43,7 +38,6 @@ const DirOthers = ({ userPerm, repoID, currentPath }) => {
|
|||||||
DirOthers.propTypes = {
|
DirOthers.propTypes = {
|
||||||
userPerm: PropTypes.string,
|
userPerm: PropTypes.string,
|
||||||
repoID: PropTypes.string,
|
repoID: PropTypes.string,
|
||||||
currentPath: PropTypes.string,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default DirOthers;
|
export default DirOthers;
|
||||||
|
Reference in New Issue
Block a user