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

Merge branch '7.0'

This commit is contained in:
shanshuirenjia
2020-03-02 10:15:05 +08:00
4 changed files with 114 additions and 101 deletions

View File

@@ -7,6 +7,7 @@ import ModalPortal from '../modal-portal';
import CreateFolder from '../../components/dialog/create-folder-dialog'; import CreateFolder from '../../components/dialog/create-folder-dialog';
import CreateFile from '../../components/dialog/create-file-dialog'; import CreateFile from '../../components/dialog/create-file-dialog';
import ShareDialog from '../../components/dialog/share-dialog'; import ShareDialog from '../../components/dialog/share-dialog';
import ViewModeToolbar from './view-mode-toolbar';
const propTypes = { const propTypes = {
path: PropTypes.string.isRequired, path: PropTypes.string.isRequired,
@@ -22,6 +23,8 @@ const propTypes = {
onUploadFile: PropTypes.func.isRequired, onUploadFile: PropTypes.func.isRequired,
onUploadFolder: PropTypes.func.isRequired, onUploadFolder: PropTypes.func.isRequired,
direntList: PropTypes.array.isRequired, direntList: PropTypes.array.isRequired,
currentMode: PropTypes.string.isRequired,
switchViewMode: PropTypes.func.isRequired,
}; };
class DirOperationToolbar extends React.Component { class DirOperationToolbar extends React.Component {
@@ -167,51 +170,56 @@ class DirOperationToolbar extends React.Component {
let itemType = path === '/' ? 'library' : 'dir'; let itemType = path === '/' ? 'library' : 'dir';
let itemName = path == '/' ? repoName : Utils.getFolderName(path); let itemName = path == '/' ? repoName : Utils.getFolderName(path);
const content = Utils.isDesktop() ? ( let content = null;
<Fragment> if (Utils.isDesktop()) {
{Utils.isSupportUploadFolder() ? let { showShareBtn } = this.props;
<button className="btn btn-secondary operation-item" title={gettext('Upload')} onClick={this.onUploadClick}>{gettext('Upload')}</button> : content = (
<button className="btn btn-secondary operation-item" title={gettext('Upload')} onClick={this.onUploadFile}>{gettext('Upload')}</button>} <Fragment>
<button className="btn btn-secondary operation-item" title={gettext('New')} onClick={this.onCreateClick}>{gettext('New')}</button> {Utils.isSupportUploadFolder() ?
{this.props.showShareBtn && <button className="btn btn-secondary operation-item" title={gettext('Upload')} onClick={this.onUploadClick}>{gettext('Upload')}</button> :
<button className="btn btn-secondary operation-item" title={gettext('Share')} onClick={this.onShareClick}>{gettext('Share')}</button>} <button className="btn btn-secondary operation-item" title={gettext('Upload')} onClick={this.onUploadFile}>{gettext('Upload')}</button>}
</Fragment> <button className="btn btn-secondary operation-item" title={gettext('New')} onClick={this.onCreateClick}>{gettext('New')}</button>
) : ( {showShareBtn && <button className="btn btn-secondary operation-item" title={gettext('Share')} onClick={this.onShareClick}>{gettext('Share')}</button>}
<Dropdown isOpen={this.state.isMobileOpMenuOpen} toggle={this.toggleMobileOpMenu}> </Fragment>
<DropdownToggle );
tag="span" } else {
className="sf2-icon-plus mobile-toolbar-icon" content = (
/> <Dropdown isOpen={this.state.isMobileOpMenuOpen} toggle={this.toggleMobileOpMenu}>
<DropdownMenu> <DropdownToggle tag="span" className="sf2-icon-plus mobile-toolbar-icon" />
<DropdownItem onClick={this.onUploadFile}>{gettext('Upload')}</DropdownItem> <DropdownMenu>
<DropdownItem onClick={this.onCreateFolderToggle}>{gettext('New Folder')}</DropdownItem> <DropdownItem onClick={this.onUploadFile}>{gettext('Upload')}</DropdownItem>
<DropdownItem onClick={this.onCreateFileToggle}>{gettext('New File')}</DropdownItem> <DropdownItem onClick={this.onCreateFolderToggle}>{gettext('New Folder')}</DropdownItem>
</DropdownMenu> <DropdownItem onClick={this.onCreateFileToggle}>{gettext('New File')}</DropdownItem>
</Dropdown> </DropdownMenu>
); </Dropdown>
);
}
return ( return (
<Fragment> <Fragment>
<div className="operation"> <div className="dir-operation">
{content} <div className="operation">
{content}
</div>
{this.state.isUploadMenuShow && (
<ul className="menu dropdown-menu" style={this.state.operationMenuStyle}>
<li className="dropdown-item" onClick={this.onUploadFile}>{gettext('Upload Files')}</li>
<li className="dropdown-item" onClick={this.onUploadFolder}>{gettext('Upload Folder')}</li>
</ul>
)}
{this.state.isCreateMenuShow && (
<ul className="menu dropdown-menu" style={this.state.operationMenuStyle}>
<li className="dropdown-item" onClick={this.onCreateFolderToggle}>{gettext('New Folder')}</li>
<li className="dropdown-item" onClick={this.onCreateFileToggle}>{gettext('New File')}</li>
<li className="dropdown-divider"></li>
<li className="dropdown-item" onClick={this.onCreateMarkdownToggle}>{gettext('New Markdown File')}</li>
<li className="dropdown-item" onClick={this.onCreateExcelToggle}>{gettext('New Excel File')}</li>
<li className="dropdown-item" onClick={this.onCreatePPTToggle}>{gettext('New PowerPoint File')}</li>
<li className="dropdown-item" onClick={this.onCreateWordToggle}>{gettext('New Word File')}</li>
</ul>
)}
</div> </div>
{this.state.isUploadMenuShow && ( {Utils.isDesktop() && <ViewModeToolbar currentMode={this.props.currentMode} switchViewMode={this.props.switchViewMode} />}
<ul className="menu dropdown-menu" style={this.state.operationMenuStyle}>
<li className="dropdown-item" onClick={this.onUploadFile}>{gettext('Upload Files')}</li>
<li className="dropdown-item" onClick={this.onUploadFolder}>{gettext('Upload Folder')}</li>
</ul>
)}
{this.state.isCreateMenuShow && (
<ul className="menu dropdown-menu" style={this.state.operationMenuStyle}>
<li className="dropdown-item" onClick={this.onCreateFolderToggle}>{gettext('New Folder')}</li>
<li className="dropdown-item" onClick={this.onCreateFileToggle}>{gettext('New File')}</li>
<li className="dropdown-divider"></li>
<li className="dropdown-item" onClick={this.onCreateMarkdownToggle}>{gettext('New Markdown File')}</li>
<li className="dropdown-item" onClick={this.onCreateExcelToggle}>{gettext('New Excel File')}</li>
<li className="dropdown-item" onClick={this.onCreatePPTToggle}>{gettext('New PowerPoint File')}</li>
<li className="dropdown-item" onClick={this.onCreateWordToggle}>{gettext('New Word File')}</li>
</ul>
)}
{this.state.isCreateFileDialogShow && ( {this.state.isCreateFileDialogShow && (
<ModalPortal> <ModalPortal>
<CreateFile <CreateFile

View File

@@ -14,6 +14,7 @@ import EditFileTagDialog from '../dialog/edit-filetag-dialog';
import ZipDownloadDialog from '../dialog/zip-download-dialog'; import ZipDownloadDialog from '../dialog/zip-download-dialog';
import Rename from '../dialog/rename-dirent'; import Rename from '../dialog/rename-dirent';
import LibSubFolderPermissionDialog from '../dialog/lib-sub-folder-permission-dialog'; import LibSubFolderPermissionDialog from '../dialog/lib-sub-folder-permission-dialog';
import ViewModeToolbar from './view-mode-toolbar';
import ModalPortal from '../modal-portal'; import ModalPortal from '../modal-portal';
import ItemDropdownMenu from '../dropdown-menu/item-dropdown-menu'; import ItemDropdownMenu from '../dropdown-menu/item-dropdown-menu';
@@ -36,6 +37,8 @@ const propTypes = {
onFilesTagChanged: PropTypes.func.isRequired, onFilesTagChanged: PropTypes.func.isRequired,
unSelectDirent: PropTypes.func.isRequired, unSelectDirent: PropTypes.func.isRequired,
updateDirent: PropTypes.func.isRequired, updateDirent: PropTypes.func.isRequired,
currentMode: PropTypes.string.isRequired,
switchViewMode: PropTypes.func.isRequired,
}; };
class MultipleDirOperationToolbar extends React.Component { class MultipleDirOperationToolbar extends React.Component {
@@ -331,23 +334,26 @@ class MultipleDirOperationToolbar extends React.Component {
return ( return (
<Fragment> <Fragment>
<div className="d-flex"> <div className="dir-operation">
<ButtonGroup className="flex-row group-operations"> <div className="d-flex">
<Button className="secondary group-op-item action-icon sf2-icon-move" title={gettext('Move')} onClick={this.onMoveToggle}></Button> <ButtonGroup className="flex-row group-operations">
<Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} onClick={this.onCopyToggle}></Button> <Button className="secondary group-op-item action-icon sf2-icon-move" title={gettext('Move')} onClick={this.onMoveToggle}></Button>
<Button className="secondary group-op-item action-icon sf2-icon-delete" title={gettext('Delete')} onClick={this.onItemsDelete}></Button> <Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} onClick={this.onCopyToggle}></Button>
<Button className="secondary group-op-item action-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemsDownload}></Button> <Button className="secondary group-op-item action-icon sf2-icon-delete" title={gettext('Delete')} onClick={this.onItemsDelete}></Button>
{this.props.selectedDirentList.length === 1 && <Button className="secondary group-op-item action-icon sf2-icon-download" title={gettext('Download')} onClick={this.onItemsDownload}></Button>
<ItemDropdownMenu {this.props.selectedDirentList.length === 1 &&
tagName={'button'} <ItemDropdownMenu
item={this.props.selectedDirentList[0]} tagName={'button'}
toggleClass={'fas fa-ellipsis-v dirents-more-menu'} item={this.props.selectedDirentList[0]}
onMenuItemClick={this.onMenuItemClick} toggleClass={'fas fa-ellipsis-v dirents-more-menu'}
getMenuList={this.getDirentMenuList} onMenuItemClick={this.onMenuItemClick}
/> getMenuList={this.getDirentMenuList}
} />
</ButtonGroup> }
</ButtonGroup>
</div>
</div> </div>
{Utils.isDesktop() && <ViewModeToolbar currentMode={this.props.currentMode} switchViewMode={this.props.switchViewMode} />}
{this.state.isMoveDialogShow && {this.state.isMoveDialogShow &&
<MoveDirentDialog <MoveDirentDialog
path={this.props.path} path={this.props.path}

View File

@@ -1,6 +1,5 @@
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Utils } from '../../utils/utils';
import { gettext } from '../../utils/constants'; import { gettext } from '../../utils/constants';
import CommonToolbar from '../../components/toolbar/common-toolbar'; import CommonToolbar from '../../components/toolbar/common-toolbar';
import ViewModeToolbar from '../../components/toolbar/view-mode-toolbar'; import ViewModeToolbar from '../../components/toolbar/view-mode-toolbar';
@@ -87,48 +86,49 @@ class LibContentToolbar extends React.Component {
<Fragment> <Fragment>
<div className="cur-view-toolbar"> <div className="cur-view-toolbar">
<span className="sf2-icon-menu hidden-md-up d-md-none side-nav-toggle" title={gettext('Side Nav Menu')} onClick={this.props.onSideNavMenuClick}></span> <span className="sf2-icon-menu hidden-md-up d-md-none side-nav-toggle" title={gettext('Side Nav Menu')} onClick={this.props.onSideNavMenuClick}></span>
<div className="dir-operation"> {this.props.isDirentSelected ?
{this.props.isDirentSelected ? <MultipleDirOperationToolbar
<MultipleDirOperationToolbar repoID={this.props.repoID}
repoID={this.props.repoID} path={this.props.path}
path={this.props.path} userPerm={this.props.userPerm}
userPerm={this.props.userPerm} repoEncrypted={this.props.repoEncrypted}
repoEncrypted={this.props.repoEncrypted} selectedDirentList={this.props.selectedDirentList}
selectedDirentList={this.props.selectedDirentList} direntList={this.props.direntList}
direntList={this.props.direntList} onItemsMove={this.props.onItemsMove}
onItemsMove={this.props.onItemsMove} onItemsCopy={this.props.onItemsCopy}
onItemsCopy={this.props.onItemsCopy} onItemsDelete={this.props.onItemsDelete}
onItemsDelete={this.props.onItemsDelete} onItemRename={this.props.onItemRename}
onItemRename={this.props.onItemRename} isRepoOwner={this.props.isRepoOwner}
isRepoOwner={this.props.isRepoOwner} currentRepoInfo={this.props.currentRepoInfo}
currentRepoInfo={this.props.currentRepoInfo} enableDirPrivateShare={this.props.enableDirPrivateShare}
enableDirPrivateShare={this.props.enableDirPrivateShare} updateDirent={this.props.updateDirent}
updateDirent={this.props.updateDirent} relatedFiles={this.props.relatedFiles}
relatedFiles={this.props.relatedFiles} unSelectDirent={this.props.unSelectDirent}
unSelectDirent={this.props.unSelectDirent} onFilesTagChanged={this.props.onFilesTagChanged}
onFilesTagChanged={this.props.onFilesTagChanged} showShareBtn={this.props.showShareBtn}
showShareBtn={this.props.showShareBtn} isGroupOwnedRepo={this.props.isGroupOwnedRepo}
isGroupOwnedRepo={this.props.isGroupOwnedRepo} showDirentDetail={this.props.showDirentDetail}
showDirentDetail={this.props.showDirentDetail} currentMode={this.props.currentMode}
/> : switchViewMode={this.props.switchViewMode}
<DirOperationToolBar /> :
path={this.props.path} <DirOperationToolBar
repoID={this.props.repoID} path={this.props.path}
repoName={this.props.repoName} repoID={this.props.repoID}
repoEncrypted={this.props.repoEncrypted} repoName={this.props.repoName}
direntList={this.props.direntList} repoEncrypted={this.props.repoEncrypted}
showShareBtn={this.props.showShareBtn} direntList={this.props.direntList}
enableDirPrivateShare={this.props.enableDirPrivateShare} showShareBtn={this.props.showShareBtn}
userPerm={this.props.userPerm} enableDirPrivateShare={this.props.enableDirPrivateShare}
isGroupOwnedRepo={this.props.isGroupOwnedRepo} userPerm={this.props.userPerm}
onAddFile={this.props.onAddFile} isGroupOwnedRepo={this.props.isGroupOwnedRepo}
onAddFolder={this.props.onAddFolder} onAddFile={this.props.onAddFile}
onUploadFile={this.props.onUploadFile} onAddFolder={this.props.onAddFolder}
onUploadFolder={this.props.onUploadFolder} onUploadFile={this.props.onUploadFile}
/> onUploadFolder={this.props.onUploadFolder}
} currentMode={this.props.currentMode}
</div> switchViewMode={this.props.switchViewMode}
{Utils.isDesktop() && <ViewModeToolbar currentMode={this.props.currentMode} switchViewMode={this.props.switchViewMode} />} />
}
</div> </div>
<CommonToolbar repoID={this.props.repoID} onSearchedClick={this.props.onSearchedClick} searchPlaceholder={gettext('Search files in this library')}/> <CommonToolbar repoID={this.props.repoID} onSearchedClick={this.props.onSearchedClick} searchPlaceholder={gettext('Search files in this library')}/>
</Fragment> </Fragment>

View File

@@ -1725,7 +1725,6 @@ class LibContentView extends React.Component {
return ( return (
<Fragment> <Fragment>
<div className="main-panel o-hidden"> <div className="main-panel o-hidden">
<div className="main-panel-north border-left-show"> <div className="main-panel-north border-left-show">
<LibContentToolbar <LibContentToolbar