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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Instead of setting inline styles via JS, the resizer now simply changes a CSS variable. Thus we get rid of that ugly pattern of passing the expected style through to the component. We can now handle CSS in the actual CSS files (where it belongs). Further, we now gain more flexibility in the CSS and can for example define a flexible Grid for the new split screen.
Henriette Darge917238aa1306
diff --git a/app/components/work_packages/split_view_component.html.erb b/app/components/work_packages/split_view_component.html.erbindex acc03f9bbe2..a978b875dd7 100644--- a/app/components/work_packages/split_view_component.html.erb+++ b/app/components/work_packages/split_view_component.html.erb@@ -19,7 +19,6 @@inputs: {work_package_id: params[:work_package_id] || @work_package.id,resizerClass: "op-work-package-split-view",- resizeStyle: "width",activeTab: @tab}enddiff --git a/app/components/work_packages/split_view_component.sass b/app/components/work_packages/split_view_component.sassindex 7aad3bdcbeb..87e22c19c85 100644--- a/app/components/work_packages/split_view_component.sass+++ b/app/components/work_packages/split_view_component.sass@@ -1,6 +1,6 @@.op-work-package-split-viewheight: 100%- width: 550px+ min-width: 550pxjustify-content: space-aroundborder-left: 1px solid var(--borderColor-muted)diff --git a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view-entry.component.ts b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view-entry.component.tsindex 43a3942d7d9..3ed93189d8d 100644--- a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view-entry.component.ts+++ b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view-entry.component.ts@@ -43,7 +43,6 @@ import { populateInputsFromDataset } from 'core-app/shared/components/dataset-in[workPackageId]="workPackageId"[activeTab]="activeTab"[showTabs]="false"- [resizeStyle]="resizeStyle"[resizerClass]="resizerClass"></op-wp-split-view>`,@@ -53,7 +52,6 @@ export class WorkPackageSplitViewEntryComponent {@Input() workPackageId:string;@Input() activeTab:string;@Input() resizerClass:string;- @Input() resizeStyle:string;constructor(readonly elementRef:ElementRef) {populateInputsFromDataset(this);diff --git a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.tsindex 6f672428da8..d1fb67ad878 100644--- a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts+++ b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts@@ -76,7 +76,6 @@ export class WorkPackageSplitViewComponent extends WorkPackageSingleViewBase imp@Input() activeTab?:string;@Input() resizerClass = 'work-packages-partitioned-page--content-right';- @Input() resizeStyle:'flexBasis'|'width' = 'flexBasis';constructor(public injector:Injector,diff --git a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.htmlindex 7342cf38728..e3adad05d23 100644--- a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html+++ b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html@@ -69,7 +69,6 @@<div class="work-packages--details--resizer hidden-for-mobile hide-when-print"><wp-resizer [elementClass]="resizerClass"- [resizeStyle]="resizeStyle"[localStorageKey]="'openProject-splitViewFlexBasis'"></wp-resizer></div></div>diff --git a/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts b/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.tsindex 75d7426a33e..a6b6f283df3 100644--- a/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts+++ b/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts@@ -29,7 +29,6 @@import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core';import { debounceTime, distinctUntilChanged } from 'rxjs/operators';import { TransitionService } from '@uirouter/core';-import { BrowserDetector } from 'core-app/core/browser/browser-detector.service';import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { ResizeDelta } from 'core-app/shared/components/resizer/resizer.component';import { fromEvent } from 'rxjs';@@ -56,8 +55,6 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A@Input() localStorageKey:string;- @Input() resizeStyle:'flexBasis'|'width' = 'flexBasis';-private resizingElement:HTMLElement;private elementWidth:number;@@ -67,7 +64,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, Aprivate resizer:HTMLElement;// Min-width this element is allowed to have- private elementMinWidth = 530;+ private elementMinWidth = 550;public moving = false;@@ -77,7 +74,6 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, Areadonly toggleService:MainMenuToggleService,private elementRef:ElementRef,readonly $transitions:TransitionService,- readonly browserDetector:BrowserDetector,) {super();}@@ -88,7 +84,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A// to still work in case an element is duplicated by Angular.const elements = document.getElementsByClassName(this.elementClass);this.resizingElement = <HTMLElement>elements[elements.length - 1];-+if (!this.resizingElement) {return;}@@ -106,7 +102,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, Athis.elementWidth = this.resizingElement.parentElement.offsetWidth / 2;}- this.resizingElement.style[this.resizeStyle] = `${this.elementWidth}px`;+ this.setWidthVariable(this.elementWidth);// Add event listenerthis.element = this.elementRef.nativeElement;@@ -142,7 +138,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, Asuper.ngOnDestroy();// Reset the style when killing this directive, otherwise the style remainsif (this.resizingElement) {- this.resizingElement.style[this.resizeStyle] = '';+ this.setWidthVariable(this.elementMinWidth);}}@@ -193,7 +189,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, Athis.applyColumnLayout();// Set new width- this.resizingElement.style[this.resizeStyle] = `${newValue}px`;+ this.setWidthVariable(newValue);}private parseLocalStorageValue():number|undefined {@@ -222,4 +218,8 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, Athis.resizer.classList.remove('-error-font');}}++ private setWidthVariable(value:number):void {+ document.documentElement.style.setProperty("--split-screen-width", `${value}px`);+ }}diff --git a/frontend/src/global_styles/layout/_base.sass b/frontend/src/global_styles/layout/_base.sassindex 28b84ef6f32..08da9c9412e 100644--- a/frontend/src/global_styles/layout/_base.sass+++ b/frontend/src/global_styles/layout/_base.sass@@ -88,9 +88,11 @@ $right-space: 16px$bottom-space: 10px$left-space: 16px+$left-side-min-width: 300px+#contentdisplay: grid- grid-template-columns: 1fr auto+ grid-template-columns: minmax($left-side-min-width, 1fr) autogrid-template-rows: auto 1frgrid-template-areas: "header bodyRight" "body bodyRight"padding: 0@@ -102,6 +104,11 @@ $left-space: 16pxz-index: 10background-color: var(--body-background)+ // Basically if the content-BodyRight is filled:+ // Apply the user-defined split screen width but be able to shrink in case the screen is not wide enough+ &:has(#content-bodyRight > *)+ grid-template-columns: minmax($left-side-min-width, 1fr) minmax(550px, var(--split-screen-width))+&.content--splitoverflow: hiddendiff --git a/frontend/src/global_styles/layout/work_packages/_details_view.sass b/frontend/src/global_styles/layout/work_packages/_details_view.sassindex 6c387a04345..bd2e9c6871b 100644--- a/frontend/src/global_styles/layout/work_packages/_details_view.sass+++ b/frontend/src/global_styles/layout/work_packages/_details_view.sass@@ -39,7 +39,7 @@ body.router--work-packages-partitioned-split-view-newpadding: 0// Will eventually be overridden by the resizer- flex-basis: 580px+ flex-basis: var(--split-screen-width).work-packages--detailsheight: 100%diff --git a/frontend/src/global_styles/openproject/_variable_defaults.scss b/frontend/src/global_styles/openproject/_variable_defaults.scssindex ed624748e03..de68f9d4092 100644--- a/frontend/src/global_styles/openproject/_variable_defaults.scss+++ b/frontend/src/global_styles/openproject/_variable_defaults.scss@@ -131,4 +131,5 @@--link-text-decoration: none;--type-form-conf-attribute--background: var(--gray-light);--select-arrow-bg-color-url: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");+ --split-screen-width: 550px;}