From 66300cf07bd09c95a0f6ebbba492f5ebfeec7d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E9=A1=BA=E5=BC=BA?= Date: Wed, 24 Jun 2020 18:35:38 +0800 Subject: [PATCH] update readonly toolbar effect (#4605) --- .../toolbar/dir-operation-toolbar.js | 48 +++++++++---------- .../toolbar/multiple-dir-operation-toolbar.js | 18 +++---- frontend/src/css/toolbar.css | 1 + .../lib-content-view/lib-content-toolbar.js | 5 ++ 4 files changed, 39 insertions(+), 33 deletions(-) diff --git a/frontend/src/components/toolbar/dir-operation-toolbar.js b/frontend/src/components/toolbar/dir-operation-toolbar.js index 37728d7e0d..16cfd2cae4 100644 --- a/frontend/src/components/toolbar/dir-operation-toolbar.js +++ b/frontend/src/components/toolbar/dir-operation-toolbar.js @@ -162,10 +162,6 @@ class DirOperationToolbar extends React.Component { render() { let { path, repoName, userPerm } = this.props; - - if (userPerm !== 'rw' && userPerm !== 'admin') { - return ''; - } let itemType = path === '/' ? 'library' : 'dir'; let itemName = path == '/' ? repoName : Utils.getFolderName(path); @@ -197,28 +193,30 @@ class DirOperationToolbar extends React.Component { return ( -
-
- {content} + {(userPerm === 'rw' || userPerm === 'admin') && ( +
+
+ {content} +
+ {this.state.isUploadMenuShow && ( +
    +
  • {gettext('Upload Files')}
  • +
  • {gettext('Upload Folder')}
  • +
+ )} + {this.state.isCreateMenuShow && ( +
    +
  • {gettext('New Folder')}
  • +
  • {gettext('New File')}
  • +
  • +
  • {gettext('New Markdown File')}
  • +
  • {gettext('New Excel File')}
  • +
  • {gettext('New PowerPoint File')}
  • +
  • {gettext('New Word File')}
  • +
+ )}
- {this.state.isUploadMenuShow && ( -
    -
  • {gettext('Upload Files')}
  • -
  • {gettext('Upload Folder')}
  • -
- )} - {this.state.isCreateMenuShow && ( -
    -
  • {gettext('New Folder')}
  • -
  • {gettext('New File')}
  • -
  • -
  • {gettext('New Markdown File')}
  • -
  • {gettext('New Excel File')}
  • -
  • {gettext('New PowerPoint File')}
  • -
  • {gettext('New Word File')}
  • -
- )} -
+ )} {Utils.isDesktop() && } {this.state.isCreateFileDialogShow && ( diff --git a/frontend/src/components/toolbar/multiple-dir-operation-toolbar.js b/frontend/src/components/toolbar/multiple-dir-operation-toolbar.js index d5026bd954..42a33917da 100644 --- a/frontend/src/components/toolbar/multiple-dir-operation-toolbar.js +++ b/frontend/src/components/toolbar/multiple-dir-operation-toolbar.js @@ -327,20 +327,22 @@ class MultipleDirOperationToolbar extends React.Component { const dirent = this.props.selectedDirentList[0]; let direntPath = this.getDirentPath(dirent); - - if (userPerm !== 'rw' && userPerm !== 'admin') { - return ''; - } return (
- - - - + {(userPerm === 'rw' || userPerm === 'admin') && ( + + + + + + )} + {(userPerm === 'rw' || userPerm === 'admin' || userPerm === 'r') && ( + + )} {this.props.selectedDirentList.length === 1 &&
+ } + if (this.props.isViewFile) { return (