Web: Files: Home: Added file download to context menu
This commit is contained in:
parent
7403859096
commit
55bda7f2f4
@ -157,7 +157,13 @@ class SectionBodyContent extends React.PureComponent {
|
|||||||
return fetchFolder(folderId, store.dispatch);
|
return fetchFolder(folderId, store.dispatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClickDownload = (item) => {
|
||||||
|
return window.open(item.webUrl, "_blank");
|
||||||
|
}
|
||||||
|
|
||||||
getFilesContextOptions = (item, viewer) => {
|
getFilesContextOptions = (item, viewer) => {
|
||||||
|
const isFile = !!item.fileExst;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
key: "sharing-settings",
|
key: "sharing-settings",
|
||||||
@ -165,6 +171,14 @@ class SectionBodyContent extends React.PureComponent {
|
|||||||
onClick: () => { },
|
onClick: () => { },
|
||||||
disabled: true
|
disabled: true
|
||||||
},
|
},
|
||||||
|
isFile
|
||||||
|
? {
|
||||||
|
key: "send-by-email",
|
||||||
|
label: "Send by e-mail",
|
||||||
|
onClick: () => { },
|
||||||
|
disabled: true
|
||||||
|
}
|
||||||
|
: null,
|
||||||
{
|
{
|
||||||
key: "link-for-portal-users",
|
key: "link-for-portal-users",
|
||||||
label: "Link for portal users",
|
label: "Link for portal users",
|
||||||
@ -175,12 +189,22 @@ class SectionBodyContent extends React.PureComponent {
|
|||||||
key: "sep",
|
key: "sep",
|
||||||
isSeparator: true
|
isSeparator: true
|
||||||
},
|
},
|
||||||
{
|
isFile
|
||||||
key: "download",
|
? {
|
||||||
label: "Download",
|
key: "edit",
|
||||||
onClick: () => { },
|
label: "Edit",
|
||||||
disabled: true
|
onClick: () => { },
|
||||||
},
|
disabled: true
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
isFile
|
||||||
|
? {
|
||||||
|
key: "download",
|
||||||
|
label: "Download",
|
||||||
|
onClick: this.onClickDownload.bind(this, item),
|
||||||
|
disabled: false
|
||||||
|
}
|
||||||
|
: null,
|
||||||
{
|
{
|
||||||
key: "rename",
|
key: "rename",
|
||||||
label: "Rename",
|
label: "Rename",
|
||||||
@ -461,7 +485,7 @@ class SectionBodyContent extends React.PureComponent {
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EmptyFolderContainer
|
<EmptyFolderContainer
|
||||||
headerText={t("Filter")}
|
headerText={t("Filter")}
|
||||||
@ -469,7 +493,7 @@ class SectionBodyContent extends React.PureComponent {
|
|||||||
descriptionText={descriptionText}
|
descriptionText={descriptionText}
|
||||||
imageSrc="images/empty_screen_filter.png"
|
imageSrc="images/empty_screen_filter.png"
|
||||||
buttons={buttons}
|
buttons={buttons}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,50 +537,50 @@ class SectionBodyContent extends React.PureComponent {
|
|||||||
parentId === 0 ? (
|
parentId === 0 ? (
|
||||||
this.renderEmptyRootFolderContainer()
|
this.renderEmptyRootFolderContainer()
|
||||||
) : (
|
) : (
|
||||||
this.renderEmptyFolderContainer()
|
this.renderEmptyFolderContainer()
|
||||||
)
|
)
|
||||||
) : items.length === 0 ? (
|
) : items.length === 0 ? (
|
||||||
this.renderEmptyFilterContainer()
|
this.renderEmptyFilterContainer()
|
||||||
) : (
|
) : (
|
||||||
<RowContainer useReactWindow={false}>
|
<RowContainer useReactWindow={false}>
|
||||||
{items.map((item) => {
|
{items.map((item) => {
|
||||||
const isEdit =
|
const isEdit =
|
||||||
fileAction.type &&
|
fileAction.type &&
|
||||||
(editingId === item.id || item.id === -1) &&
|
(editingId === item.id || item.id === -1) &&
|
||||||
item.fileExst === fileAction.extension;
|
item.fileExst === fileAction.extension;
|
||||||
const contextOptions = this.getFilesContextOptions(
|
const contextOptions = this.getFilesContextOptions(
|
||||||
item,
|
item,
|
||||||
viewer
|
viewer
|
||||||
).filter((o) => o);
|
).filter((o) => o);
|
||||||
const contextOptionsProps =
|
const contextOptionsProps =
|
||||||
!contextOptions.length || isEdit ? {} : { contextOptions };
|
!contextOptions.length || isEdit ? {} : { contextOptions };
|
||||||
const checked = isFileSelected(selection, item.id, item.parentId);
|
const checked = isFileSelected(selection, item.id, item.parentId);
|
||||||
const checkedProps = /* isAdmin(viewer) */ isEdit ? {} : { checked };
|
const checkedProps = /* isAdmin(viewer) */ isEdit ? {} : { checked };
|
||||||
const element = this.getItemIcon(item, isEdit);
|
const element = this.getItemIcon(item, isEdit);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SimpleFilesRow
|
<SimpleFilesRow
|
||||||
key={item.id}
|
key={item.id}
|
||||||
data={item}
|
data={item}
|
||||||
element={element}
|
element={element}
|
||||||
onSelect={this.onContentRowSelect}
|
onSelect={this.onContentRowSelect}
|
||||||
editing={editingId}
|
editing={editingId}
|
||||||
{...checkedProps}
|
{...checkedProps}
|
||||||
{...contextOptionsProps}
|
{...contextOptionsProps}
|
||||||
needForUpdate={this.needForUpdate}
|
needForUpdate={this.needForUpdate}
|
||||||
>
|
>
|
||||||
<FilesRowContent
|
<FilesRowContent
|
||||||
item={item}
|
item={item}
|
||||||
viewer={viewer}
|
viewer={viewer}
|
||||||
culture={settings.culture}
|
culture={settings.culture}
|
||||||
onEditComplete={this.onEditComplete.bind(this, item)}
|
onEditComplete={this.onEditComplete.bind(this, item)}
|
||||||
onLoading={onLoading}
|
onLoading={onLoading}
|
||||||
/>
|
/>
|
||||||
</SimpleFilesRow>
|
</SimpleFilesRow>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</RowContainer>
|
</RowContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user