Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ import { Resource, SpaceResource } from '@opencloud-eu/web-client'
import { useGettext } from 'vue3-gettext'
import { getSharedAncestorRoute } from '@opencloud-eu/web-pkg'
import { ResourceIcon } from '@opencloud-eu/web-pkg'
import { tagsHelper } from '../../../helpers/contextualHelpers'
import { useContextualHelpers } from '../../../composables/contextualHelpers'
import { ContextualHelper } from '@opencloud-eu/design-system/helpers'
import TagsSelect from './TagsSelect.vue'
import { WebDavDetails, CustomComponentTarget } from '@opencloud-eu/web-pkg'
Expand All @@ -165,6 +165,7 @@ const { resourceContentsText } = useResourceContents({ showSizeInformation: fals
const { loadPreview, previewsLoading } = useLoadPreview()
const { openSideBarPanel } = useSideBar()
const { getIndicators } = useResourceIndicators()
const { tagsHelper } = useContextualHelpers()

const language = useGettext()
const { $gettext, current: currentLanguage } = language
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ import {
useSpacesStore,
useConfigStore,
useSharesStore,
useUserStore
useUserStore,
$gettext
} from '@opencloud-eu/web-pkg'

import {
Expand All @@ -202,11 +203,6 @@ import ExpirationDateIndicator from '../../ExpirationDateIndicator.vue'
import { ContextualHelper } from '@opencloud-eu/design-system/helpers'
import CopyPrivateLink from '../../../../Shares/CopyPrivateLink.vue'

// just a dummy function to trick gettext tools
const $gettext = (str: string) => {
return str
}

type DropDownShouldOpenOptions = { open: boolean; search: string[] }

export type ShareRoleType = { id: string; label: string; longLabel: string }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ import {
UpdateLinkOptions,
useRouter
} from '@opencloud-eu/web-pkg'
import { shareViaLinkHelp, shareViaIndirectLinkHelp } from '../../../helpers/contextualHelpers'
import { useContextualHelpers } from '../../../composables/contextualHelpers'
import { isSpaceResource, LinkShare, Resource, SpaceResource } from '@opencloud-eu/web-client'
import ListItem from './Links/ListItem.vue'
import { isLocationSharesActive, useSharesStore } from '@opencloud-eu/web-pkg'
Expand All @@ -120,6 +120,7 @@ const { dispatchModal } = useModals()
const { removeResources } = useResourcesStore()
const { isPasswordEnforcedForLinkType } = useLinkTypes()
const { canShare } = useCanShare()
const { shareViaLinkHelp, shareViaIndirectLinkHelp } = useContextualHelpers()

const canCreateLinks = computed(() => {
if (!ability.can('create-all', 'PublicLink')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ import { textUtils } from '../../../helpers/textUtils'
import { isShareSpaceResource, ShareTypes } from '@opencloud-eu/web-client'
import InviteCollaboratorForm from './Collaborators/InviteCollaborator/InviteCollaboratorForm.vue'
import CollaboratorListItem from './Collaborators/ListItem.vue'
import { shareInviteCollaboratorHelp } from '../../../helpers/contextualHelpers'
import { useContextualHelpers } from '../../../composables/contextualHelpers'
import { computed, defineComponent, inject, ref, Ref, unref } from 'vue'
import {
isProjectSpaceResource,
Expand Down Expand Up @@ -126,6 +126,7 @@ export default defineComponent({
const { dispatchModal } = useModals()
const { canShare } = useCanShare()
const { showMessage, showErrorMessage } = useMessages()
const { shareInviteCollaboratorHelp } = useContextualHelpers()

const resourcesStore = useResourcesStore()
const { removeResources, getAncestorById } = resourcesStore
Expand Down Expand Up @@ -190,6 +191,12 @@ export default defineComponent({
return unref(collaboratorShares).sort(collaboratorsComparator)
})

const inviteCollaboratorHelp = computed(() =>
shareInviteCollaboratorHelp({
configStore
})
)

return {
addShare,
deleteShare,
Expand All @@ -212,17 +219,12 @@ export default defineComponent({
canShare,
showMessage,
showErrorMessage,
inviteCollaboratorHelp,
fileSideBarSharesPanelSharedWithTopExtensionPoint,
fileSideBarSharesPanelSharedWithBottomExtensionPoint
}
},
computed: {
inviteCollaboratorHelp() {
return shareInviteCollaboratorHelp({
configStore: this.configStore
})
},

helpersEnabled() {
return this.configOptions.contextHelpers
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ import {
useUserStore
} from '@opencloud-eu/web-pkg'
import { computed, inject, nextTick, ref, Ref, unref, useTemplateRef, watch } from 'vue'
import { shareSpaceAddMemberHelp } from '../../../helpers/contextualHelpers'
import { useContextualHelpers } from '../../../composables/contextualHelpers'
import { ProjectSpaceResource, CollaboratorShare } from '@opencloud-eu/web-client'
import { useClientService } from '@opencloud-eu/web-pkg'
import Fuse from 'fuse.js'
Expand All @@ -119,6 +119,7 @@ const { showMessage, showErrorMessage } = useMessages()
const router = useRouter()
const { $gettext } = useGettext()
const configStore = useConfigStore()
const { shareSpaceAddMemberHelp } = useContextualHelpers()

const { user } = storeToRefs(userStore)

Expand Down Expand Up @@ -175,9 +176,7 @@ const helpersEnabled = computed(() => {
canShare({ space: unref(resource), resource: unref(resource) })
)
})
const spaceAddMemberHelp = computed(() => {
return shareSpaceAddMemberHelp({ configStore: configStore })
})
const spaceAddMemberHelp = computed(() => shareSpaceAddMemberHelp({ configStore }))
const hasCollaborators = computed(() => {
return unref(spaceMembers).length > 0
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './useContextualHelpers'
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import { omit } from 'lodash-es'
import { ContextualHelperData } from '@opencloud-eu/design-system/helpers'
import { ConfigStore } from '@opencloud-eu/web-pkg'
import { useGettext } from 'vue3-gettext'

interface ContextualHelperOptions {
configStore: ConfigStore
}

const filterContextHelper = (
data: ContextualHelperData,
options?: ContextualHelperOptions
): ContextualHelperData => {
if (options.configStore.options.contextHelpersReadMore === false) {
return omit(data, 'readMoreLink')
}
return data
}

export function useContextualHelpers() {
const { $gettext } = useGettext()

const shareInviteCollaboratorHelp = (options: ContextualHelperOptions) =>
filterContextHelper(
{
title: $gettext('Share with people'),
text: $gettext(
'Use the input field to search for users and groups. Select them to share the item.'
),
list: [
{ text: $gettext('Subfolders'), headline: true },
{
text: $gettext(
'If you share a folder, all of its contents and subfolders will be shared as well.'
)
},
{ text: $gettext('Notification'), headline: true },
{
text: $gettext(
'People you share resources with will be notified via email or in-app notification.'
)
},
{ text: $gettext('Incognito'), headline: true },
{
text: $gettext('People you share resources with can not see who else has access.')
},
{ text: $gettext('"via folder"'), headline: true },
{
text: $gettext(
'The "via folder" is shown next to a share, if access has already been given via a parent folder. Click on the "via folder" to edit the share on its parent folder.'
)
}
],
readMoreLink: 'https://docs.opencloud.eu/docs/user/sharing'
},
options
)

const shareSpaceAddMemberHelp = (options: ContextualHelperOptions) =>
filterContextHelper(
{
title: $gettext('Add members to this Space'),
text: $gettext('Enter a name to add people or groups as members to this Space.'),
list: [
{ text: $gettext('Member capabilities'), headline: true },
{
text: $gettext(
'Members are able to see who has access to this space and access all files in this space. Read or write permissions can be set by assigning a role.'
)
},
{ text: $gettext('Space manager capabilities'), headline: true },
{
text: $gettext(
'Members with the Manager role are able to edit all properties and content of a Space, such as adding or removing members, sharing subfolders with non-members, or creating links to share.'
)
}
],
readMoreLink: 'https://docs.opencloud.eu/docs/user/sharing'
},
options
)

const shareViaLinkHelp = (options: ContextualHelperOptions) =>
filterContextHelper(
{
title: $gettext('Choose how access is granted'),
list: [
{
text: $gettext(
'No login required. Everyone with the link can access. If you share this link with people from the list "Invited people", they need to login so that their individual assigned permissions can take effect. If they are not logged-in, the permissions of the link take effect.'
)
}
],
readMoreLink: 'https://docs.opencloud.eu/docs/user/sharing'
},
options
)

const shareViaIndirectLinkHelp = (options: ContextualHelperOptions) =>
filterContextHelper(
{
title: $gettext('What are indirect links?'),
text: $gettext('Indirect links are links giving access by a parent folder.'),
list: [
{
text: $gettext('How to edit indirect links'),
headline: true
},
{
text: $gettext(
'Indirect links can only be edited in their parent folder. Click on the folder icon below the link to navigate to the parent folder.'
)
}
],
readMoreLink: 'https://docs.opencloud.eu/docs/user/sharing'
},
options
)

const tagsHelper = (options: ContextualHelperOptions) =>
filterContextHelper(
{
title: $gettext('Who can view tags?'),
list: [
{
text: $gettext(
'Everyone who can view the file can view its tags. Likewise, everyone who can edit the file can edit its tags.'
)
}
]
},
options
)

return {
shareInviteCollaboratorHelp,
shareSpaceAddMemberHelp,
shareViaLinkHelp,
shareViaIndirectLinkHelp,
tagsHelper
}
}
Loading