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

have no result text and checklists for project description widget

ulfertsbb64b82367e1
diff --git a/frontend/src/app/modules/grids/grid/page/grid-page.component.ts b/frontend/src/app/modules/grids/grid/page/grid-page.component.ts
index 3f843058d9a..cf69194e0f0 100644
--- a/frontend/src/app/modules/grids/grid/page/grid-page.component.ts
+++ b/frontend/src/app/modules/grids/grid/page/grid-page.component.ts
@@ -12,14 +12,14 @@ export abstract class GridPageComponent implements OnInit {
public text = { title: this.i18n.t(`js.${this.i18nNamespace()}.label`),
html_title: this.i18n.t(`js.${this.i18nNamespace()}.label`) };
- protected constructor(readonly gridInitialization:GridInitializationService,
- // not used in the base class but will be used throughout the subclasses
- readonly pathHelper:PathHelperService,
- readonly currentProject:CurrentProjectService,
- readonly i18n:I18nService,
- readonly title:Title,
- readonly addWidget:GridAddWidgetService,
- readonly areas:GridAreaService) {}
+ constructor(readonly gridInitialization:GridInitializationService,
+ // not used in the base class but will be used throughout the subclasses
+ readonly pathHelper:PathHelperService,
+ readonly currentProject:CurrentProjectService,
+ readonly i18n:I18nService,
+ readonly title:Title,
+ readonly addWidget:GridAddWidgetService,
+ readonly areas:GridAreaService) {}
public grid:GridResource;
diff --git a/frontend/src/app/modules/grids/widgets/project-description/project-description.component.html b/frontend/src/app/modules/grids/widgets/project-description/project-description.component.html
index e6cf6624d82..1a23b6a1cfa 100644
--- a/frontend/src/app/modules/grids/widgets/project-description/project-description.component.html
+++ b/frontend/src/app/modules/grids/widgets/project-description/project-description.component.html
@@ -8,5 +8,11 @@
</widget-menu>
</widget-header>
-<div class="grid--widget-content"
- [innerHTML]="description" ></div>
+<div class="grid--widget-content">
+ <div *ngIf="hasDescription"
+ [innerHTML]="description">
+ </div>
+ <no-results *ngIf="!hasDescription && isLoaded"
+ [title]="text.noResults">
+ </no-results>
+</div>
diff --git a/frontend/src/app/modules/grids/widgets/project-description/project-description.component.ts b/frontend/src/app/modules/grids/widgets/project-description/project-description.component.ts
index b1de00b4bf0..b00320743fb 100644
--- a/frontend/src/app/modules/grids/widgets/project-description/project-description.component.ts
+++ b/frontend/src/app/modules/grids/widgets/project-description/project-description.component.ts
@@ -31,17 +31,23 @@ import {AbstractWidgetComponent} from "app/modules/grids/widgets/abstract-widget
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {CurrentProjectService} from "core-components/projects/current-project.service";
import {ProjectCacheService} from "core-components/projects/project-cache.service";
+import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
@Component({
templateUrl: './project-description.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class WidgetProjectDescriptionComponent extends AbstractWidgetComponent implements OnInit {
- public description:string;
+ public description:SafeHtml;
+
+ public text = {
+ noResults: this.i18n.t('js.grid.widgets.project_description.no_results'),
+ };
constructor(protected readonly i18n:I18nService,
protected readonly injector:Injector,
protected readonly projectCache:ProjectCacheService,
+ protected readonly sanitization:DomSanitizer,
protected readonly currentProject:CurrentProjectService,
protected readonly cdr:ChangeDetectorRef) {
super(i18n, injector);
@@ -55,11 +61,19 @@ export class WidgetProjectDescriptionComponent extends AbstractWidgetComponent i
this
.loadCurrentProject()
.then(project => {
- this.description = project.description.html;
+ this.description = this.sanitization.bypassSecurityTrustHtml(project.description.html);
this.cdr.detectChanges();
});
}
+ public get hasDescription() {
+ return this.isLoaded && this.description;
+ }
+
+ public get isLoaded() {
+ return this.projectCache.state(this.currentProject.id as string).value;
+ }
+
private loadCurrentProject() {
return this.projectCache.require(this.currentProject.id as string);
}
diff --git a/modules/grids/config/locales/js-en.yml b/modules/grids/config/locales/js-en.yml
index 13d2d2c65c6..6ab02332c47 100644
--- a/modules/grids/config/locales/js-en.yml
+++ b/modules/grids/config/locales/js-en.yml
@@ -21,6 +21,7 @@ en:
no_results: 'Nothing new to report.'
project_description:
title: 'Project description'
+ no_results: 'No description has been written yet.'
project_details:
title: 'Project details'
subprojects: