removed backspace functionality for team folder and sharedwithme homepage

This commit is contained in:
Čarodej
2022-03-15 11:21:14 +01:00
parent d0b4b729c9
commit dfeef6fdf8
22 changed files with 80 additions and 63 deletions

View File

@@ -48,7 +48,7 @@
@click.native="$shareFileOrFolder(currentFile)"
:title="sharingTitle"
icon="share"
v-if="!$isThisRoute($route, ['Public', 'RequestUpload', 'SharedWithMe'])"
v-if="!$isThisRoute(['Public', 'RequestUpload', 'SharedWithMe'])"
/>
<Option
@click.native="$deleteFileOrFolder(currentFile)"
@@ -57,7 +57,7 @@
class="menu-option"
/>
</OptionGroup>
<OptionGroup v-if="!$isThisRoute($route, ['RequestUpload'])">
<OptionGroup v-if="!$isThisRoute(['RequestUpload'])">
<Option @click.native="downloadItem" :title="$t('context_menu.download')" icon="download" />
</OptionGroup>
</PopoverItem>
@@ -79,7 +79,7 @@
<div class="ml-5">
<ToolbarButton
v-if="!$isThisRoute($route, ['RequestUpload'])"
v-if="!$isThisRoute(['RequestUpload'])"
@click.native="downloadItem"
source="download"
:action="$t('actions.download')"
@@ -165,7 +165,7 @@ export default {
return activeIndex
},
canShareItem() {
return this.$isThisRoute(this.$route, ['Files', 'RecentUploads', 'MySharedItems'])
return this.$isThisRoute(['Files', 'RecentUploads', 'MySharedItems'])
},
},
methods: {

View File

@@ -60,7 +60,7 @@
<!--File Controls-->
<div class="ml-5 flex items-center xl:ml-8">
<!--Team Heads-->
<PopoverWrapper v-if="$isThisRoute($route, ['TeamFolders', 'SharedWithMe'])">
<PopoverWrapper v-if="$isThisRoute(['TeamFolders', 'SharedWithMe'])">
<TeamMembersButton
@click.stop.native="showTeamFolderMenu"
size="32"
@@ -70,7 +70,7 @@
<PopoverItem name="team-folder" side="left">
<TeamFolderPreview />
<OptionGroup v-if="$isThisRoute($route, ['TeamFolders'])" :title="$t('Options')">
<OptionGroup v-if="$isThisRoute(['TeamFolders'])" :title="$t('Options')">
<Option
@click.native="$updateTeamFolder(teamFolder)"
:title="$t('Edit Members')"
@@ -83,7 +83,7 @@
/>
</OptionGroup>
<OptionGroup v-if="$isThisRoute($route, ['SharedWithMe'])" :title="$t('Options')">
<OptionGroup v-if="$isThisRoute(['SharedWithMe'])" :title="$t('Options')">
<Option
@click.native="$detachMeFromTeamFolder(teamFolder)"
:title="$t('Leave the Team Folder')"
@@ -105,7 +105,7 @@
:action="$t('actions.convert_into_team_folder')"
/>
<ToolbarButton
v-if="!$isThisRoute($route, ['SharedWithMe', 'Public'])"
v-if="!$isThisRoute(['SharedWithMe', 'Public'])"
@click.native="$shareFileOrFolder(clipboard[0])"
:class="{
'is-inactive': canShareInView,
@@ -213,41 +213,41 @@ export default {
return this.currentTeamFolder ? this.currentTeamFolder : this.clipboard[0]
},
isTeamFolderHomepage() {
return this.$isThisRoute(this.$route, ['TeamFolders']) && !this.$route.params.id
return this.$isThisRoute(['TeamFolders']) && !this.$route.params.id
},
isSharedWithMe() {
return this.$isThisRoute(this.$route, ['SharedWithMe'])
return this.$isThisRoute(['SharedWithMe'])
},
isSharedWithMeHomepage() {
return this.$isThisRoute(this.$route, ['SharedWithMe']) && !this.$route.params.id
return this.$isThisRoute(['SharedWithMe']) && !this.$route.params.id
},
canCreateFolder() {
return !this.$isThisRoute(this.$route, ['Files', 'Public', 'TeamFolders', 'SharedWithMe'])
return !this.$isThisRoute(['Files', 'Public', 'TeamFolders', 'SharedWithMe'])
},
canShowConvertToTeamFolder() {
return this.$isThisRoute(this.$route, ['Files', 'MySharedItems'])
return this.$isThisRoute(['Files', 'MySharedItems'])
},
canUploadInView() {
return !this.$isThisRoute(this.$route, ['Files', 'RecentUploads', 'Public', 'TeamFolders', 'SharedWithMe'])
return !this.$isThisRoute(['Files', 'RecentUploads', 'Public', 'TeamFolders', 'SharedWithMe'])
},
canUploadFolderInView() {
return !this.$isThisRoute(this.$route, ['Files', 'Public', 'TeamFolders', 'SharedWithMe'])
return !this.$isThisRoute(['Files', 'Public', 'TeamFolders', 'SharedWithMe'])
},
canDeleteInView() {
let routes = ['TeamFolders', 'SharedWithMe', 'RecentUploads', 'MySharedItems', 'Trash', 'Public', 'Files']
return !this.$isThisRoute(this.$route, routes) || this.clipboard.length === 0
return !this.$isThisRoute(routes) || this.clipboard.length === 0
},
canMoveInView() {
let routes = ['SharedWithMe', 'RecentUploads', 'MySharedItems', 'Public', 'Files', 'TeamFolders']
return !this.$isThisRoute(this.$route, routes) || this.clipboard.length === 0
return !this.$isThisRoute(routes) || this.clipboard.length === 0
},
canShareInView() {
let routes = ['TeamFolders', 'RecentUploads', 'MySharedItems', 'Public', 'Files']
return !this.$isThisRoute(this.$route, routes) || this.clipboard.length > 1 || this.clipboard.length === 0
return !this.$isThisRoute(routes) || this.clipboard.length > 1 || this.clipboard.length === 0
},
canCreateTeamFolder() {
return (
this.$isThisRoute(this.$route, ['MySharedItems', 'Files']) &&
this.$isThisRoute(['MySharedItems', 'Files']) &&
this.clipboard.length === 1 &&
this.clipboard[0].data.type === 'folder'
)

View File

@@ -38,7 +38,7 @@ export default {
ItemHandler,
},
computed: {
...mapGetters(['isVisibleSidebar', 'currentFolder', 'itemViewType', 'clipboard', 'entries', 'config']),
...mapGetters(['isVisibleSidebar', 'currentFolder', 'itemViewType', 'clipboard', 'entries', 'config', 'currentTeamFolder', 'user']),
draggedItems() {
// Set opacity for dragged items
if (!this.clipboard.includes(this.draggingId)) {
@@ -58,10 +58,27 @@ export default {
},
methods: {
deleteItems() {
// Prevent delete in SharedWithMe and TeamFolders homepage
if ((this.$isThisRoute(['SharedWithMe', 'TeamFolders']) && !this.$route.params.id)) return
// Prevent delete in SharedWithMe with visit privileges
if ((this.$isThisRoute(['SharedWithMe']) && ! this.canEdit())) return
if ((this.clipboard.length > 0 && this.$checkPermission('master')) || this.$checkPermission('editor')) {
this.$store.dispatch('deleteItem')
}
},
canEdit() {
if (this.currentTeamFolder && this.user) {
let member = this.currentTeamFolder.data.relationships.members.data.find(
(member) => member.data.id === this.user.data.id
)
return member.data.attributes.permission === 'can-edit'
}
return false
},
uploadDroppedItems(event) {
this.$uploadDraggedFiles(event, this.currentFolder.data.id)

View File

@@ -6,28 +6,28 @@
@click.native="goToFiles"
:title="$t('sidebar.home')"
icon="hard-drive"
:is-active="$isThisRoute($route, 'Files')"
:is-active="$isThisRoute('Files')"
:is-hover-disabled="true"
/>
<Option
@click.native="goToLatest"
:title="$t('menu.latest')"
icon="upload-cloud"
:is-active="$isThisRoute($route, 'RecentUploads')"
:is-active="$isThisRoute('RecentUploads')"
:is-hover-disabled="true"
/>
<Option
@click.native="goToShared"
:title="$t('sidebar.my_shared')"
icon="share"
:is-active="$isThisRoute($route, 'MySharedItems')"
:is-active="$isThisRoute('MySharedItems')"
:is-hover-disabled="true"
/>
<Option
@click.native="goToTrash"
:title="$t('menu.trash')"
icon="trash"
:is-active="$isThisRoute($route, 'Trash')"
:is-active="$isThisRoute('Trash')"
:is-hover-disabled="true"
/>
</OptionGroup>
@@ -36,14 +36,14 @@
@click.native="goToTeamFolders"
:title="$t('Team Folders')"
icon="users"
:is-active="$isThisRoute($route, 'TeamFolders')"
:is-active="$isThisRoute('TeamFolders')"
:is-hover-disabled="true"
/>
<Option
@click.native="goToSharedWithMe"
:title="$t('Shared with Me')"
icon="user-check"
:is-active="$isThisRoute($route, 'SharedWithMe')"
:is-active="$isThisRoute('SharedWithMe')"
:is-hover-disabled="true"
/>
</OptionGroup>

View File

@@ -158,7 +158,7 @@ import { mapGetters } from 'vuex'
},
canShowAuthor() {
return (
this.$isThisRoute(this.$route, ['SharedWithMe', 'TeamFolders']) &&
this.$isThisRoute(['SharedWithMe', 'TeamFolders']) &&
this.clipboard[0].data.type !== 'folder' &&
this.user.data.id !== this.clipboard[0].data.relationships.owner.data.id
)

View File

@@ -189,7 +189,7 @@ export default {
canEditName() {
return (
!this.$isMobile() &&
!this.$isThisRoute(this.$route, ['Trash', 'SharedSingleFile']) &&
!this.$isThisRoute(['Trash', 'SharedSingleFile']) &&
!this.$checkPermission('visitor')
)
},
@@ -200,13 +200,13 @@ export default {
},
canShowAuthor() {
return (
this.$isThisRoute(this.$route, ['SharedWithMe', 'TeamFolders']) &&
this.$isThisRoute(['SharedWithMe', 'TeamFolders']) &&
!this.isFolder &&
this.user.data.id !== this.entry.data.relationships.owner.data.id
)
},
canShowLinkIcon() {
return this.entry.data.relationships.shared && !this.$isThisRoute(this.$route, ['SharedSingleFile'])
return this.entry.data.relationships.shared && !this.$isThisRoute(['SharedSingleFile'])
},
canDrag() {
return !this.isDeleted && this.$checkPermission(['master', 'editor'])

View File

@@ -162,7 +162,7 @@ export default {
canEditName() {
return (
!this.$isMobile() &&
!this.$isThisRoute(this.$route, ['Trash']) &&
!this.$isThisRoute(['Trash']) &&
!this.$checkPermission('visitor') &&
!(this.sharedDetail && this.sharedDetail.attributes.type === 'file')
)

View File

@@ -6,7 +6,7 @@
<div class="relative flex items-center">
<TeamMembersButton
v-if="$isThisRoute($route, ['TeamFolders', 'SharedWithMe'])"
v-if="$isThisRoute(['TeamFolders', 'SharedWithMe'])"
size="28"
@click.stop.native="$showMobileMenu('team-menu')"
class="absolute right-9"

View File

@@ -54,7 +54,7 @@ export default {
computed: {
...mapGetters(['isVisibleNavigationBars', 'currentFolder', 'sharedDetail']),
isNotHomepage() {
if (this.$isThisRoute(this.$route, ['Public'])) {
if (this.$isThisRoute(['Public'])) {
return this.sharedDetail && this.sharedDetail.data.attributes.item_id !== this.$route.params.id
}

View File

@@ -60,7 +60,7 @@ export default {
events.$emit('emailsInputValues', this.emails)
},
removeLastEmail(event) {
// If is input empty and presse backspace remove last email from array
// If is input empty and press backspace remove last email from array
if (event.code === 'Backspace' && this.email === '') this.emails.pop()
},
handleEmail() {

View File

@@ -126,7 +126,7 @@ export default {
this.isLoadingTree = true
// Get folder tree and hide spinner
if (this.$isThisRoute(this.$route, ['SharedWithMe'])) {
if (this.$isThisRoute(['SharedWithMe'])) {
this.$store.dispatch('getTeamFolderTree').then(() => {
this.isLoadingTree = false
})

View File

@@ -119,7 +119,7 @@ export default {
canEditName() {
return (
!this.$isMobile() &&
!this.$isThisRoute(this.$route, ['Trash']) &&
!this.$isThisRoute(['Trash']) &&
!this.$checkPermission('visitor') &&
!(this.sharedDetail && this.sharedDetail.attributes.type === 'file')
)

View File

@@ -62,7 +62,7 @@
<!--Show tips-->
<div
v-if="isEmptyQuery && !activeFilter && !$isThisRoute($route, ['Public']) && isAdmin"
v-if="isEmptyQuery && !activeFilter && !$isThisRoute(['Public']) && isAdmin"
class="relative z-50 px-4 pb-4"
>
<CategoryName>
@@ -587,7 +587,7 @@ export default {
}
// Return commands for public page
if (this.$isThisRoute(this.$route, ['Public'])) {
if (this.$isThisRoute(['Public'])) {
return [].concat.apply([], [functionList])
}
@@ -779,7 +779,7 @@ export default {
openItem(file) {
// Show folder
if (file.data.type === 'folder') {
if (this.$isThisRoute(this.$route, ['Public'])) {
if (this.$isThisRoute(['Public'])) {
this.$router.push({
name: 'Public',
params: {

View File

@@ -168,7 +168,7 @@ export default {
axios
.post(route, payload)
.then((response) => {
let isTeamFoldersLocation = this.$isThisRoute(this.$route, ['TeamFolders'])
let isTeamFoldersLocation = this.$isThisRoute(['TeamFolders'])
// Redirect into newly created team folder
if (isTeamFoldersLocation && this.$route.params.id) {

View File

@@ -437,8 +437,8 @@ const FunctionHelpers = {
this.$router.push(locations[this.$router.currentRoute.name])
}
Vue.prototype.$isThisRoute = function (route, locations) {
return locations.includes(route.name)
Vue.prototype.$isThisRoute = function (locations) {
return locations.includes(router.currentRoute.name)
}
// TODO: not working correctly in share page

View File

@@ -33,7 +33,7 @@ const actions = {
})
// Update user settings
if (!Vue.prototype.$isThisRoute(router.currentRoute, ['Public'])) {
if (!Vue.prototype.$isThisRoute(['Public'])) {
Vue.prototype.$updateText('/user/settings', 'theme_mode', mode)
}
},

View File

@@ -80,7 +80,7 @@ const actions = {
if (item.type === 'folder') dispatch('getAppData')
if (Vue.prototype.$isThisRoute(router.currentRoute, ['Public'])) dispatch('getFolderTree')
if (Vue.prototype.$isThisRoute(['Public'])) dispatch('getFolderTree')
})
})
.catch(() => Vue.prototype.$isSomethingWrong())
@@ -272,7 +272,7 @@ const actions = {
restoreItem: ({ commit, getters }, item) => {
let itemToRestore = []
let items = [item]
let restoreToHome = Vue.prototype.$isThisRoute(router.currentRoute, ['Trash'])
let restoreToHome = Vue.prototype.$isThisRoute(['Trash'])
// If coming no selected item dont get items to restore from clipboard
if (!item) items = getters.clipboard

View File

@@ -90,7 +90,7 @@ const actions = {
// Remove item from file browser
if (
getters.currentFolder &&
Vue.prototype.$isThisRoute(router.currentRoute, ['MySharedItems'])
Vue.prototype.$isThisRoute(['MySharedItems'])
) {
commit('REMOVE_ITEM', item.data.id)
}

View File

@@ -215,7 +215,7 @@ export default {
return false
},
isTeamFolderHomepage() {
return this.$isThisRoute(this.$route, ['SharedWithMe']) && !this.$route.params.id
return this.$isThisRoute(['SharedWithMe']) && !this.$route.params.id
},
isFolder() {
return this.item && this.item.data.type === 'folder'

View File

@@ -270,7 +270,7 @@ export default {
return this.currentTeamFolder ? this.currentTeamFolder : this.clipboard[0]
},
isTeamFolderHomepage() {
return this.$isThisRoute(this.$route, ['TeamFolders']) && !this.$route.params.id
return this.$isThisRoute(['TeamFolders']) && !this.$route.params.id
},
isFolder() {
return this.item && this.item.data.type === 'folder'