Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#43655] added tooltip for files in location picker (#11985)

Eric Schubert945d1cedb62b
diff --git a/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts b/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts
index 46f7e34c662..68b55b617e9 100644
--- a/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts
+++ b/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts
@@ -27,7 +27,11 @@
//++
import {
- ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Inject,
+ ChangeDetectionStrategy,
+ ChangeDetectorRef,
+ Component,
+ ElementRef,
+ Inject,
} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
@@ -63,6 +67,7 @@ export class LocationPickerModalComponent extends FilePickerBaseModalComponent {
},
tooltip: {
directory_not_writeable: this.i18n.t('js.storages.files.directory_not_writeable'),
+ file_not_selectable: this.i18n.t('js.storages.files.file_not_selectable_location'),
},
};
@@ -108,12 +113,18 @@ export class LocationPickerModalComponent extends FilePickerBaseModalComponent {
!isDirectory(file),
index === 0,
this.enterDirectoryCallback(file),
- this.isDirectoryWithoutWritePermission(file) ? this.text.tooltip.directory_not_writeable : undefined,
+ this.tooltip(file),
undefined,
);
}
- private isDirectoryWithoutWritePermission(file:IStorageFile):boolean {
- return isDirectory(file) && !file.permissions.some((permission) => permission === 'writeable');
+ private tooltip(file:IStorageFile):string|undefined {
+ if (isDirectory(file)) {
+ return file.permissions.some((permission) => permission === 'writeable')
+ ? undefined
+ : this.text.tooltip.directory_not_writeable;
+ }
+
+ return this.text.tooltip.file_not_selectable;
}
}
diff --git a/modules/storages/config/locales/js-en.yml b/modules/storages/config/locales/js-en.yml
index cbc47f88f6a..949bc76307d 100644
--- a/modules/storages/config/locales/js-en.yml
+++ b/modules/storages/config/locales/js-en.yml
@@ -31,6 +31,7 @@ en:
files:
directory_not_writeable: "You do not have to permission to add files to this folder."
dragging_many_files: "The upload to %{storageType} supports only one file at once."
+ file_not_selectable_location: "Selecting a file is not possible in the process of choosing a location."
file_links:
empty: >