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
Extract AbstractTurboWidgetComponent class
Alexander Brandon Coles0437f9303e7a
diff --git a/frontend/src/app/shared/components/grids/widgets/abstract-turbo-widget.component.ts b/frontend/src/app/shared/components/grids/widgets/abstract-turbo-widget.component.tsnew file mode 100644index 00000000000..32ed255f1a2--- /dev/null+++ b/frontend/src/app/shared/components/grids/widgets/abstract-turbo-widget.component.ts@@ -0,0 +1,50 @@+//-- copyright+// OpenProject is an open source project management software.+// Copyright (C) the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//++++import { Directive, inject } from '@angular/core';+import { AbstractWidgetComponent } from 'core-app/shared/components/grids/widgets/abstract-widget.component';+import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';++@Directive()+export abstract class AbstractTurboWidgetComponent extends AbstractWidgetComponent {+ protected readonly currentProject = inject(CurrentProjectService);+ protected readonly pathHelper = inject(PathHelperService);++ abstract readonly frameId:string;+ abstract readonly name:string;++ protected get src():string|null {+ if (!this.currentProject.identifier) return null;+ return this.pathHelper.projectWidgetPath(this.currentProject.identifier, this.name);+ }++ public override get isEditable():boolean {+ return false;+ }+}diff --git a/frontend/src/app/shared/components/grids/widgets/project-status-beta/project-status-beta.component.ts b/frontend/src/app/shared/components/grids/widgets/project-status-beta/project-status-beta.component.tsindex 6cf936ea19a..09e57292acb 100644--- a/frontend/src/app/shared/components/grids/widgets/project-status-beta/project-status-beta.component.ts+++ b/frontend/src/app/shared/components/grids/widgets/project-status-beta/project-status-beta.component.ts@@ -26,31 +26,15 @@// See COPYRIGHT and LICENSE files for more details.//++-import { ChangeDetectionStrategy, Component, inject } from '@angular/core';-import { AbstractWidgetComponent } from 'core-app/shared/components/grids/widgets/abstract-widget.component';-import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';-import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';--const WIDGET_FRAME_ID = 'overviews-widgets-project-status-component';-const WIDGET_NAME = 'project_status';+import { ChangeDetectionStrategy, Component } from '@angular/core';+import { AbstractTurboWidgetComponent } from 'core-app/shared/components/grids/widgets/abstract-turbo-widget.component';@Component({templateUrl: './project-status-beta.component.html',changeDetection: ChangeDetectionStrategy.OnPush,standalone: false,})-export class WidgetProjectStatusBetaComponent extends AbstractWidgetComponent {- protected readonly currentProject = inject(CurrentProjectService);- protected readonly pathHelper = inject(PathHelperService);-- frameId = WIDGET_FRAME_ID;-- get src():string|null {- if (!this.currentProject.identifier) return null;- return this.pathHelper.projectWidgetPath(this.currentProject.identifier, WIDGET_NAME);- }-- public override get isEditable():boolean {- return false;- }+export class WidgetProjectStatusBetaComponent extends AbstractTurboWidgetComponent {+ override frameId = 'overviews-widgets-project-status-component';+ override name = 'project_status';}