Skip to content

Commit

Permalink
Fix Personal vs All files title in location picker
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Mar 28, 2022
1 parent 07282d7 commit ae2eb0c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
6 changes: 3 additions & 3 deletions packages/web-app-files/src/components/AppBar/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default {
return []
}
const personalRouteName = this.hasSpaces
const personalRouteTitle = this.hasSpaces
? this.$gettext('Personal')
: this.$gettext('All files')
Expand All @@ -200,7 +200,7 @@ export default {
to: '/files/trash'
},
{
text: personalRouteName,
text: personalRouteTitle,
onClick: () => bus.publish('app.files.list.load')
}
]
Expand Down Expand Up @@ -243,7 +243,7 @@ export default {
if (acc.length) {
if (this.isPersonalLocation) {
acc[0].text = personalRouteName
acc[0].text = personalRouteTitle
acc[0].to = acc[0].to + '/'
} else if (this.isSpacesProjectLocation || this.isSpacesProjectsLocation) {
acc[0] = {
Expand Down
17 changes: 14 additions & 3 deletions packages/web-app-files/src/views/LocationPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ import { DavProperties } from 'web-pkg/src/constants'
import { createLocationPublic, createLocationSpaces } from '../router'
import { buildWebDavFilesPath, buildWebDavSpacesPath } from '../helpers/resources'
import { useResourcesViewDefaults } from '../composables'
import { useCapabilitySpacesEnabled } from 'web-pkg/src/composables'
export default {
metaInfo() {
Expand Down Expand Up @@ -160,7 +161,8 @@ export default {
}).restartable()
return {
...useResourcesViewDefaults({ loadResourcesTask })
...useResourcesViewDefaults({ loadResourcesTask }),
hasSpaces: useCapabilitySpacesEnabled()
}
},
Expand All @@ -180,11 +182,17 @@ export default {
...mapState(['user']),
title() {
const personalRouteTitle = this.hasSpaces
? this.$gettext('Personal')
: this.$gettext('All files')
const target =
basename(this.target) || personalRouteTitle
? this.$gettext('Personal')
: this.$gettext('All files')
const translated =
this.currentAction === batchActions.move
? this.$gettext('Move into »%{ target }«')
: this.$gettext('Copy into »%{ target }«')
const target = basename(this.target) || this.$gettext('Personal')
return this.$gettextInterpolate(translated, { target })
},
Expand Down Expand Up @@ -227,7 +235,10 @@ export default {
breadcrumbs.push(this.createBreadcrumbNode(i + 1, pathSegments[i], itemPath))
}
} else {
breadcrumbs.push(this.createBreadcrumbNode(0, this.$gettext('Personal'), '/'))
const personalRouteTitle = this.hasSpaces
? this.$gettext('Personal')
: this.$gettext('All files')
breadcrumbs.push(this.createBreadcrumbNode(0, personalRouteTitle, '/'))
for (let i = 0; i < pathSegments.length; i++) {
const itemPath = join.apply(null, pathSegments.slice(0, i + 1))
breadcrumbs.push(this.createBreadcrumbNode(i + 1, pathSegments[i], itemPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createFile, getStore, localVue } from './views.setup.js'
import LocationPicker from '@files/src/views/LocationPicker.vue'
import { mount, RouterLinkStub, shallowMount } from '@vue/test-utils'
import { createLocationOperations } from '../../../src/router'
import omit from 'lodash-es/omit'

const component = { ...LocationPicker, mounted: jest.fn() }

Expand Down Expand Up @@ -134,9 +135,8 @@ describe('LocationPicker', () => {
const breadcrumbItems = wrapper.find(breadcrumbStub).props().items

expect(breadcrumbItems.length).toBe(3)
expect(breadcrumbItems[0]).toMatchObject({
expect(omit(breadcrumbItems[0], ['text'])).toMatchObject({
index: 0,
text: 'Personal',
to: {
name: route.name,
params: { action: route.params.action, item: '/' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ exports[`LocationPicker files app bar should show location picker selection info

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 2`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 3`] = `<h1 class="location-picker-selection-info oc-mb">Move into »child«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 3`] = `<h1 class="location-picker-selection-info oc-mb">Move into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 4`] = `<h1 class="location-picker-selection-info oc-mb">Move into »parent«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 4`] = `<h1 class="location-picker-selection-info oc-mb">Move into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 5`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »child«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 5`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 6`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »parent«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 6`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 7`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »टेश्ट«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 7`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 8`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »child«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 8`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 9`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »child«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 9`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 10`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »child«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 10`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 11`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »टेश्ट फोल्डर«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 11`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 12`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »456«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 12`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »Personal«</h1>`;

exports[`LocationPicker files app bar should show location picker selection info according to route action and item 13`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »🔥«</h1>`;
exports[`LocationPicker files app bar should show location picker selection info according to route action and item 13`] = `<h1 class="location-picker-selection-info oc-mb">Copy into »Personal«</h1>`;

exports[`LocationPicker files view when the view is not loading anymore should show no content message if active files length is less than one 1`] = `<no-content-message-stub icon="folder" id="files-location-picker-empty" class="files-empty"></no-content-message-stub>`;

Expand Down

0 comments on commit ae2eb0c

Please sign in to comment.