mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 18:29:23 +00:00
[library content view] move 'share' into the dropdown menu for each folder/file item (#7508)
This commit is contained in:
@@ -307,9 +307,7 @@ class DirentListItem extends React.Component {
|
|||||||
this.props.onItemDelete(this.state.dirent);
|
this.props.onItemDelete(this.state.dirent);
|
||||||
};
|
};
|
||||||
|
|
||||||
onItemShare = (e) => {
|
onItemShare = () => {
|
||||||
e.preventDefault();
|
|
||||||
e.nativeEvent.stopImmediatePropagation(); // for document event
|
|
||||||
this.setState({ isShareDialogShow: !this.state.isShareDialogShow });
|
this.setState({ isShareDialogShow: !this.state.isShareDialogShow });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -344,7 +342,7 @@ class DirentListItem extends React.Component {
|
|||||||
this.onItemDownload(event);
|
this.onItemDownload(event);
|
||||||
break;
|
break;
|
||||||
case 'Share':
|
case 'Share':
|
||||||
this.onItemShare(event);
|
this.onItemShare();
|
||||||
break;
|
break;
|
||||||
case 'Delete':
|
case 'Delete':
|
||||||
this.onItemDelete(event);
|
this.onItemDelete(event);
|
||||||
@@ -723,7 +721,7 @@ class DirentListItem extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
renderItemOperation = () => {
|
renderItemOperation = () => {
|
||||||
let { currentRepoInfo, selectedDirentList } = this.props;
|
let { selectedDirentList } = this.props;
|
||||||
let dirent = this.state.dirent;
|
let dirent = this.state.dirent;
|
||||||
let canDownload = true;
|
let canDownload = true;
|
||||||
let canDelete = true;
|
let canDelete = true;
|
||||||
@@ -734,9 +732,6 @@ class DirentListItem extends React.Component {
|
|||||||
canDelete = permission.delete;
|
canDelete = permission.delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dev.seafile.com/seahub/lib/d6f300e7-bb2b-4722-b83e-cf45e370bfbc/file/seaf-server%20%E5%8A%9F%E8%83%BD%E8%AE%BE%E8%AE%A1/%E6%9D%83%E9%99%90%E7%9B%B8%E5%85%B3/%E8%B5%84%E6%96%99%E5%BA%93%E6%9D%83%E9%99%90%E8%A7%84%E8%8C%83.md
|
|
||||||
let showShareBtn = Utils.isHasPermissionToShare(currentRepoInfo, dirent.permission, dirent);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{selectedDirentList.length > 1 ?
|
{selectedDirentList.length > 1 ?
|
||||||
@@ -746,9 +741,6 @@ class DirentListItem extends React.Component {
|
|||||||
{(dirent.permission === 'rw' || dirent.permission === 'r' || (isCustomPermission && canDownload)) && (
|
{(dirent.permission === 'rw' || dirent.permission === 'r' || (isCustomPermission && canDownload)) && (
|
||||||
<a href="#" className="op-icon sf3-font sf3-font-download1" title={gettext('Download')} role="button" aria-label={gettext('Download')} onClick={this.onItemDownload}></a>
|
<a href="#" className="op-icon sf3-font sf3-font-download1" title={gettext('Download')} role="button" aria-label={gettext('Download')} onClick={this.onItemDownload}></a>
|
||||||
)}
|
)}
|
||||||
{showShareBtn && (
|
|
||||||
<a href="#" className="op-icon sf3-font-share sf3-font" title={gettext('Share')} role="button" aria-label={gettext('Share')} onClick={this.onItemShare}></a>
|
|
||||||
)}
|
|
||||||
{(dirent.permission === 'rw' || dirent.permission === 'cloud-edit' || (isCustomPermission && canDelete)) && (
|
{(dirent.permission === 'rw' || dirent.permission === 'cloud-edit' || (isCustomPermission && canDelete)) && (
|
||||||
<a href="#" className="op-icon sf3-font-delete1 sf3-font" title={gettext('Delete')} role="button" aria-label={gettext('Delete')} onClick={this.onItemDelete}></a>
|
<a href="#" className="op-icon sf3-font-delete1 sf3-font" title={gettext('Delete')} role="button" aria-label={gettext('Delete')} onClick={this.onItemDelete}></a>
|
||||||
)}
|
)}
|
||||||
@@ -769,9 +761,6 @@ class DirentListItem extends React.Component {
|
|||||||
{(dirent.permission === 'rw' || dirent.permission === 'r' || (isCustomPermission && canDownload)) && (
|
{(dirent.permission === 'rw' || dirent.permission === 'r' || (isCustomPermission && canDownload)) && (
|
||||||
<a href="#" className="op-icon sf3-font sf3-font-download1" title={gettext('Download')} role="button" aria-label={gettext('Download')} onClick={this.onItemDownload}></a>
|
<a href="#" className="op-icon sf3-font sf3-font-download1" title={gettext('Download')} role="button" aria-label={gettext('Download')} onClick={this.onItemDownload}></a>
|
||||||
)}
|
)}
|
||||||
{showShareBtn && (
|
|
||||||
<a href="#" className="op-icon sf3-font-share sf3-font" title={gettext('Share')} role="button" aria-label={gettext('Share')} onClick={this.onItemShare}></a>
|
|
||||||
)}
|
|
||||||
{(dirent.permission === 'rw' || dirent.permission === 'cloud-edit' || (isCustomPermission && canDelete)) && (
|
{(dirent.permission === 'rw' || dirent.permission === 'cloud-edit' || (isCustomPermission && canDelete)) && (
|
||||||
<a href="#" className="op-icon sf3-font-delete1 sf3-font" title={gettext('Delete')} role="button" aria-label={gettext('Delete')} onClick={this.onItemDelete}></a>
|
<a href="#" className="op-icon sf3-font-delete1 sf3-font" title={gettext('Delete')} role="button" aria-label={gettext('Delete')} onClick={this.onItemDelete}></a>
|
||||||
)}
|
)}
|
||||||
|
@@ -494,10 +494,6 @@ export const Utils = {
|
|||||||
list.push(DOWNLOAD);
|
list.push(DOWNLOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent)) {
|
|
||||||
list.push(SHARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (permission == 'rw' || permission == 'cloud-edit') {
|
if (permission == 'rw' || permission == 'cloud-edit') {
|
||||||
list.push(DELETE, 'Divider');
|
list.push(DELETE, 'Divider');
|
||||||
}
|
}
|
||||||
@@ -507,6 +503,10 @@ export const Utils = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent)) {
|
||||||
|
list.push(SHARE);
|
||||||
|
}
|
||||||
|
|
||||||
if (permission == 'rw' || permission == 'cloud-edit') {
|
if (permission == 'rw' || permission == 'cloud-edit') {
|
||||||
list.push(RENAME, MOVE);
|
list.push(RENAME, MOVE);
|
||||||
}
|
}
|
||||||
@@ -561,10 +561,6 @@ export const Utils = {
|
|||||||
list.push(DOWNLOAD);
|
list.push(DOWNLOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent)) {
|
|
||||||
list.push(SHARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (permission == 'rw' || permission == 'cloud-edit') {
|
if (permission == 'rw' || permission == 'cloud-edit') {
|
||||||
if (!dirent.is_locked || (dirent.is_locked && dirent.locked_by_me)) {
|
if (!dirent.is_locked || (dirent.is_locked && dirent.locked_by_me)) {
|
||||||
list.push(DELETE);
|
list.push(DELETE);
|
||||||
@@ -580,6 +576,10 @@ export const Utils = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Utils.isHasPermissionToShare(currentRepoInfo, permission, dirent)) {
|
||||||
|
list.push(SHARE);
|
||||||
|
}
|
||||||
|
|
||||||
if (permission == 'rw' || permission == 'cloud-edit') {
|
if (permission == 'rw' || permission == 'cloud-edit') {
|
||||||
if (!dirent.is_locked || (dirent.is_locked && dirent.locked_by_me)) {
|
if (!dirent.is_locked || (dirent.is_locked && dirent.locked_by_me)) {
|
||||||
list.push(RENAME, MOVE);
|
list.push(RENAME, MOVE);
|
||||||
|
Reference in New Issue
Block a user