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
Rework Overviews page using Primer's Layout
Alexander Brandon Coles202cc016301a
diff --git a/frontend/src/app/features/dashboards/dashboard/dashboard.component.ts b/frontend/src/app/features/dashboards/dashboard/dashboard.component.tsindex 0945bb0dd6c..017b6143cd1 100644--- a/frontend/src/app/features/dashboards/dashboard/dashboard.component.ts+++ b/frontend/src/app/features/dashboards/dashboard/dashboard.component.ts@@ -10,10 +10,6 @@ import { GRID_PROVIDERS } from 'core-app/shared/components/grids/grid/grid.compostandalone: false,})export class DashboardComponent extends GridPageComponent {- protected i18nNamespace():string {- return 'dashboards';- }-protected gridScopePath():string {return this.pathHelper.projectDashboardsPath(this.currentProject.identifier!);}diff --git a/frontend/src/app/features/my-page/my-page.component.ts b/frontend/src/app/features/my-page/my-page.component.tsindex bfee1558577..dc1308418b5 100644--- a/frontend/src/app/features/my-page/my-page.component.ts+++ b/frontend/src/app/features/my-page/my-page.component.ts@@ -10,16 +10,6 @@ import { GridPageComponent } from 'core-app/shared/components/grids/grid/page/grstandalone: false,})export class MyPageComponent extends GridPageComponent {- showToolbar = false;-- protected setHtmlTitle() {- // Done in rails- }-- protected i18nNamespace():string {- return 'my_page';- }-protected gridScopePath():string {return this.pathHelper.myPagePath();}diff --git a/frontend/src/app/features/overview/overview.component.ts b/frontend/src/app/features/overview/overview.component.tsindex 2c505137763..05917e40d04 100644--- a/frontend/src/app/features/overview/overview.component.ts+++ b/frontend/src/app/features/overview/overview.component.ts@@ -39,44 +39,6 @@ import { GRID_PROVIDERS } from 'core-app/shared/components/grids/grid/grid.compostandalone: false,})export class OverviewComponent extends GridPageComponent {- showToolbar = false;-- protected i18nNamespace():string {- return 'overviews';- }-- protected isTurboFrameSidebarEnabled():boolean {- return this.isCustomFieldsSidebarEnabled() || this.isLifeCycleSidebarEnabled();- }-- protected isCustomFieldsSidebarEnabled():boolean {- const customFieldsSidebarEnabledTag:HTMLMetaElement|null = document.querySelector('meta[name="custom_fields_sidebar_enabled"]');-- return customFieldsSidebarEnabledTag?.dataset.enabled === 'true';- }-- protected isLifeCycleSidebarEnabled():boolean {- const lifeCycleSidebarEnabledTag:HTMLMetaElement|null = document.querySelector('meta[name="life_cycle_sidebar_enabled"]');-- return lifeCycleSidebarEnabledTag?.dataset.enabled === 'true';- }-- protected lifeCycleSidebarSrc():string {- return `${this.pathHelper.staticBase}/projects/${this.currentProject.identifier ?? ''}/project_life_cycle_sidebar`;- }-- protected lifeCycleSidebarId():string {- return 'project-life-cycle-sidebar';- }-- protected projectCustomFieldsSidebarSrc():string {- return `${this.pathHelper.staticBase}/projects/${this.currentProject.identifier ?? ''}/project_custom_fields_sidebar`;- }-- protected projectCustomFieldsSidebarId():string {- return 'project-custom-fields-sidebar';- }-protected gridScopePath():string {return this.pathHelper.projectPath(this.currentProject.identifier ?? '');}diff --git a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.html b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.htmlindex 48c59540ac2..123a1d8e0f3 100644--- a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.html+++ b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.html@@ -1,59 +1 @@-<div class="op-grid-page">- <div *ngIf="showToolbar"- class="toolbar op-grid-page--toolbar-container">- <div class="op-grid-page--title-container title-container">- <h2 [textContent]="text.title"></h2>- </div>-- <ul class="op-grid-page--toolbar-items toolbar-items hidden-for-mobile">- <li class="toolbar-item hidden-for-tablet">- <opce-zen-mode-toggle-button></opce-zen-mode-toggle-button>- </li>- </ul>- </div>-- <!-- copied css classes from primer to have a UX behaviour consistent with other pages having a sidebar -->- <div class="Layout Layout--flowRow-until-md Layout--sidebarPosition-end Layout--sidebarPosition-flowRow-start Layout--sidebar-narrow" *ngIf="isTurboFrameSidebarEnabled()">- <div class="Layout-main">- <grid *ngIf="grid" [grid]="grid"></grid>- </div>- <div class="Layout-sidebar">- <turbo-frame- *ngIf="isLifeCycleSidebarEnabled()"- [src]="lifeCycleSidebarSrc()"- [id]="lifeCycleSidebarId()"- >- <op-content-loader viewBox="0 0 100 100">- <svg:rect x="0" y="0" width="70" height="5" rx="1" />-- <svg:rect x="75" y="0" width="25" height="5" rx="1" />-- <svg:rect x="0" y="10" width="100" height="8" rx="1" />-- <svg:rect x="0" y="25" width="100" height="12" rx="1" />- </op-content-loader>- </turbo-frame>-- <turbo-frame- *ngIf="isCustomFieldsSidebarEnabled()"- [src]="projectCustomFieldsSidebarSrc()"- [id]="projectCustomFieldsSidebarId()"- >- <op-content-loader viewBox="0 0 100 100">- <svg:rect x="0" y="0" width="70" height="5" rx="1" />-- <svg:rect x="75" y="0" width="25" height="5" rx="1" />-- <svg:rect x="0" y="10" width="100" height="8" rx="1" />-- <svg:rect x="0" y="25" width="100" height="12" rx="1" />- </op-content-loader>- </turbo-frame>- </div>- </div>-- <div *ngIf="!isTurboFrameSidebarEnabled()">- <grid *ngIf="grid" [grid]="grid"></grid>- </div>--</div>+<grid *ngIf="grid" [grid]="grid"></grid>diff --git a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.ts b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.tsindex 3c18fe5ac32..e9314ca4812 100644--- a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.ts+++ b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.ts@@ -1,5 +1,4 @@import { ChangeDetectorRef, Directive, OnDestroy, OnInit, Renderer2 } from '@angular/core';-import { I18nService } from 'core-app/core/i18n/i18n.service';import { GridInitializationService } from 'core-app/shared/components/grids/grid/initialization.service';import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';import { GridResource } from 'core-app/features/hal/resources/grid-resource';@@ -7,25 +6,15 @@ import { GridAddWidgetService } from 'core-app/shared/components/grids/grid/add-import { GridAreaService } from 'core-app/shared/components/grids/grid/area.service';import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';import { ConfigurationService } from 'core-app/core/config/configuration.service';-import { OpTitleService } from 'core-app/core/html/op-title.service';@Directive()export abstract class GridPageComponent implements OnInit, OnDestroy {- public text = {- title: this.i18n.t(`js.${this.i18nNamespace()}.label`),- html_title: this.i18n.t(`js.${this.i18nNamespace()}.label`),- };-- public showToolbar = true;-constructor(readonly gridInitialization:GridInitializationService,// not used in the base class but will be used throughout the subclassesreadonly pathHelper:PathHelperService,readonly currentProject:CurrentProjectService,- readonly i18n:I18nService,readonly cdRef:ChangeDetectorRef,- readonly title:OpTitleService,readonly addWidget:GridAddWidgetService,readonly renderer:Renderer2,readonly areas:GridAreaService,@@ -34,11 +23,6 @@ export abstract class GridPageComponent implements OnInit, OnDestroy {public grid:GridResource;- protected isTurboFrameSidebarEnabled():boolean {- // may be overridden by subclasses- return false;- }-ngOnInit() {this.renderer.addClass(document.body, 'widget-grid-layout');this@@ -48,19 +32,11 @@ export abstract class GridPageComponent implements OnInit, OnDestroy {this.grid = grid;this.cdRef.detectChanges();});-- this.setHtmlTitle();}ngOnDestroy():void {this.renderer.removeClass(document.body, 'widget-grid-layout');}- protected setHtmlTitle() {- this.title.setFirstPart(this.text.html_title);- }-- protected abstract i18nNamespace():string;-protected abstract gridScopePath():string;}diff --git a/modules/overviews/app/views/overviews/overviews/show.html.erb b/modules/overviews/app/views/overviews/overviews/show.html.erbindex 819170f9555..490bb0af7cd 100644--- a/modules/overviews/app/views/overviews/overviews/show.html.erb+++ b/modules/overviews/app/views/overviews/overviews/show.html.erb@@ -1,8 +1,3 @@-<% content_for :header_tags do %>- <meta name="custom_fields_sidebar_enabled" data-enabled="<%= @custom_fields_sidebar_enabled %>">- <meta name="life_cycle_sidebar_enabled" data-enabled="<%= @life_cycle_sidebar_enabled %>">-<% end -%>-<%=render(Primer::OpenProject::PageHeader.new) do |header|header.with_title(variant: :medium) { t("overviews.label") }@@ -74,4 +69,32 @@end%>-<%= angular_component_tag "opce-overview" %>+<%=+ if @custom_fields_sidebar_enabled || @life_cycle_sidebar_enabled+ render(Primer::Alpha::Layout.new) do |component|+ component.with_main do+ angular_component_tag "opce-overview"+ end++ component.with_sidebar(width: :narrow, col_placement: :end) do+ if @life_cycle_sidebar_enabled+ concat(+ turbo_frame_tag "project-life-cycle-sidebar", src: project_life_cycle_sidebar_path(@project) do+ image_tag("loading_indicator.svg")+ end+ )+ end++ if @custom_fields_sidebar_enabled+ concat(+ turbo_frame_tag "project-custom-fields-sidebar", src: project_custom_fields_sidebar_path(@project) do+ image_tag("loading_indicator.svg")+ end+ )+ end+ end+ end+ else+ angular_component_tag "opce-overview"+ end+%>