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

[#43226] removed margin if section has no header

Eric Schubert6fdf20da9c94
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts
index 79fae76d72e..9a04c78930c 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts
@@ -27,13 +27,14 @@
//++
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
+import { combineLatest, Observable } from 'rxjs';
+import { catchError, map } from 'rxjs/operators';
+
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { HookService } from 'core-app/features/plugins/hook-service';
-import { Observable } from 'rxjs';
import { CurrentUserService } from 'core-app/core/current-user/current-user.service';
import { StoragesResourceService } from 'core-app/core/state/storages/storages.service';
-import { catchError } from 'rxjs/operators';
import { IStorage } from 'core-app/core/state/storages/storage.model';
import { ProjectsResourceService } from 'core-app/core/state/projects/projects.service';
import { ToastService } from 'core-app/shared/components/toaster/toast.service';
@@ -57,7 +58,7 @@ export class WorkPackageFilesTabComponent implements OnInit {
},
};
- canViewFileLinks$:Observable<boolean>;
+ showAttachmentHeader$:Observable<boolean>;
storages$:Observable<IStorage[]>;
@@ -77,7 +78,7 @@ export class WorkPackageFilesTabComponent implements OnInit {
return;
}
- this.canViewFileLinks$ = this
+ const canViewFileLinks = this
.currentUserService
.hasCapabilities$('file_links/view', project.id);
@@ -90,5 +91,14 @@ export class WorkPackageFilesTabComponent implements OnInit {
throw error;
}),
);
+
+ this.showAttachmentHeader$ = combineLatest(
+ [
+ this.storages$,
+ canViewFileLinks,
+ ],
+ ).pipe(
+ map(([storages, viewPermission]) => storages.length > 0 && viewPermission),
+ );
}
}
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
index 831513e9b87..a261799ee57 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
@@ -3,10 +3,11 @@
>
<section
class="op-tab-content--tab-section"
+ [ngClass]="{ 'op-tab-content--tab-section_no-header': (showAttachmentHeader$ | async) === false }"
data-qa-selector="op-tab-content--tab-section"
>
<div
- *ngIf="canViewFileLinks$ | async"
+ *ngIf="showAttachmentHeader$ | async"
class="op-tab-content--header"
>
<span class="spot-icon spot-icon_attachment op-files-tab--icon op-files-tab--icon_clip"></span>
diff --git a/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass b/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass
index 5f0469382e3..760888fbb5e 100644
--- a/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass
+++ b/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass
@@ -28,15 +28,19 @@
.op-tab-content
&--container
- .spot-list:not(:last-child)
- margin-bottom: $spot-spacing-0-75
-
.op-files-tab--storage-info-box:not(:last-child)
margin-bottom: $spot-spacing-1
&--tab-section
margin-bottom: $spot-spacing-2
+ &_no-header
+ .op-files-tab--file-upload
+ margin-top: 0
+
+ .op-files-tab--file-list .op-files-tab--file-list-item:first-child
+ margin-top: 0
+
&--header
border-bottom: 1px solid #ddd
padding-bottom: $spot-spacing-0-75