mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 17:33:18 +00:00
[share dialog] 'share link' panel: improvement(added 'copy' & used icons instead of text for 'details') for link items in the list (#5424)
This commit is contained in:
@@ -199,8 +199,8 @@ class ShareLinkPanel extends React.Component {
|
|||||||
<tr>
|
<tr>
|
||||||
<th width="28%">{gettext('Link')}</th>
|
<th width="28%">{gettext('Link')}</th>
|
||||||
<th width="30%">{gettext('Permission')}</th>
|
<th width="30%">{gettext('Permission')}</th>
|
||||||
<th width="30%">{gettext('Expiration')}</th>
|
<th width="28%">{gettext('Expiration')}</th>
|
||||||
<th width="12%"></th>
|
<th width="14%"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@@ -47,14 +47,12 @@ class LinkDetails extends React.Component {
|
|||||||
const { sharedLinkInfo } = this.props;
|
const { sharedLinkInfo } = this.props;
|
||||||
copy(sharedLinkInfo.link);
|
copy(sharedLinkInfo.link);
|
||||||
toaster.success(gettext('Share link is copied to the clipboard.'));
|
toaster.success(gettext('Share link is copied to the clipboard.'));
|
||||||
this.props.closeShareDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onCopyDownloadLink = () => {
|
onCopyDownloadLink = () => {
|
||||||
const { sharedLinkInfo } = this.props;
|
const { sharedLinkInfo } = this.props;
|
||||||
copy(`${sharedLinkInfo.link}?dl=1`);
|
copy(`${sharedLinkInfo.link}?dl=1`);
|
||||||
toaster.success(gettext('Direct download link is copied to the clipboard.'));
|
toaster.success(gettext('Direct download link is copied to the clipboard.'));
|
||||||
this.props.closeShareDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleStoredPasswordVisible = () => {
|
toggleStoredPasswordVisible = () => {
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import copy from 'copy-to-clipboard';
|
||||||
|
import toaster from '../toast';
|
||||||
import { isPro, gettext } from '../../utils/constants';
|
import { isPro, gettext } from '../../utils/constants';
|
||||||
import ShareLinkPermissionEditor from '../../components/select-editor/share-link-permission-editor';
|
import ShareLinkPermissionEditor from '../../components/select-editor/share-link-permission-editor';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
@@ -37,6 +39,13 @@ class LinkItem extends React.Component {
|
|||||||
return link.slice(0, 9) + '...' + link.slice(length-5);
|
return link.slice(0, 9) + '...' + link.slice(length-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copyLink = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const { item } = this.props;
|
||||||
|
copy(item.link);
|
||||||
|
toaster.success(gettext('Share link is copied to the clipboard.'));
|
||||||
|
}
|
||||||
|
|
||||||
viewDetails = (e) => {
|
viewDetails = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.props.showLinkDetails(this.props.item);
|
this.props.showLinkDetails(this.props.item);
|
||||||
@@ -65,7 +74,8 @@ class LinkItem extends React.Component {
|
|||||||
{expire_date ? moment(expire_date).format('YYYY-MM-DD HH:mm') : '--'}
|
{expire_date ? moment(expire_date).format('YYYY-MM-DD HH:mm') : '--'}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="#" role="button" onClick={this.viewDetails} className={isItemOpVisible ? '' : 'invisible'}>{gettext('Details')}</a>
|
<a href="#" role="button" onClick={this.copyLink} className={`sf2-icon-copy action-icon ${isItemOpVisible ? '' : 'invisible'}`} title={gettext('Copy')} aria-label={gettext('Copy')}></a>
|
||||||
|
<a href="#" role="button" onClick={this.viewDetails} className={`fas fa-info-circle font-weight-bold action-icon ${isItemOpVisible ? '' : 'invisible'}`} title={gettext('Details')} aria-label={gettext('Details')}></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user