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
feat[#47150] Define `op-static-attribute-help-text` ng component
Kabiru Mwenjaaed2b04c5420
diff --git a/frontend/src/app/core/setup/global-dynamic-components.const.ts b/frontend/src/app/core/setup/global-dynamic-components.const.tsindex 0062e4f1656..02345e1a580 100644--- a/frontend/src/app/core/setup/global-dynamic-components.const.ts+++ b/frontend/src/app/core/setup/global-dynamic-components.const.ts@@ -220,10 +220,12 @@ import {opBasicSingleDatePickerSelector,} from 'core-app/shared/components/datepicker/basic-single-date-picker/basic-single-date-picker.component';import { SpotDropModalPortalComponent, spotDropModalPortalComponentSelector } from 'core-app/spot/components/drop-modal/drop-modal-portal.component';+import { StaticAttributeHelpTextComponent, staticAttributeHelpTextSelector } from 'core-app/shared/components/attribute-help-texts/static-attribute-help-text.component';export const globalDynamicComponents:OptionalBootstrapDefinition[] = [{ selector: appBaseSelector, cls: ApplicationBaseComponent },{ selector: attributeHelpTextSelector, cls: AttributeHelpTextComponent },+ { selector: staticAttributeHelpTextSelector, cls: StaticAttributeHelpTextComponent },{ selector: wpEmbeddedTableMacroSelector, cls: EmbeddedTablesMacroComponent, embeddable: true },{ selector: colorsAutocompleterSelector, cls: ColorsAutocompleterComponent },{ selector: zenModeComponentSelector, cls: ZenModeButtonComponent },diff --git a/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.module.ts b/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.module.tsindex 8b20a555941..72698b572a1 100644--- a/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.module.ts+++ b/frontend/src/app/shared/components/attribute-help-texts/attribute-help-text.module.ts@@ -1,11 +1,13 @@-import { NgModule } from '@angular/core';import { CommonModule } from '@angular/common';-import { OpenprojectModalModule } from 'core-app/shared/components/modal/modal.module';+import { NgModule } from '@angular/core';import { OpenprojectAttachmentsModule } from 'core-app/shared/components/attachments/openproject-attachments.module';import { IconModule } from 'core-app/shared/components/icon/icon.module';+import { OpenprojectModalModule } from 'core-app/shared/components/modal/modal.module';import { AttributeHelpTextComponent } from './attribute-help-text.component';import { AttributeHelpTextModalComponent } from './attribute-help-text.modal';+import { StaticAttributeHelpTextComponent } from './static-attribute-help-text.component';+import { StaticAttributeHelpTextModalComponent } from './static-attribute-help-text.modal';@NgModule({imports: [@@ -17,11 +19,14 @@ import { AttributeHelpTextModalComponent } from './attribute-help-text.modal';declarations: [AttributeHelpTextComponent,AttributeHelpTextModalComponent,+ StaticAttributeHelpTextComponent,+ StaticAttributeHelpTextModalComponent],providers: [],exports: [AttributeHelpTextComponent,+ StaticAttributeHelpTextComponent],})export class AttributeHelpTextModule {}diff --git a/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.component.html b/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.component.htmlnew file mode 100644index 00000000000..13d5360b320--- /dev/null+++ b/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.component.html@@ -0,0 +1,11 @@+<div+ class="spot-link help-text--entry"+ [title]="text.open_dialog"+ (click)="handleClick($event)"+ (keydown.enter)="handleClick($event)"+ (keydown.space)="handleClick($event)"+ role="button"+ tabindex="0"+>+ <op-icon icon-classes="icon3 icon-help1"></op-icon>+</div>diff --git a/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.component.ts b/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.component.tsnew file mode 100644index 00000000000..317ea961a14--- /dev/null+++ b/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.component.ts@@ -0,0 +1,73 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2023 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 {+ ChangeDetectionStrategy,+ ChangeDetectorRef,+ Component,+ ElementRef,+ Injector,+ Input+} from '@angular/core';+import { I18nService } from 'core-app/core/i18n/i18n.service';+import { populateInputsFromDataset } from 'core-app/shared/components/dataset-inputs';+import { OpModalService } from 'core-app/shared/components/modal/modal.service';+import { StaticAttributeHelpTextModalComponent } from './static-attribute-help-text.modal';++export const staticAttributeHelpTextSelector = 'op-static-attribute-help-text';++@Component({+ selector: staticAttributeHelpTextSelector,+ changeDetection: ChangeDetectionStrategy.OnPush,+ templateUrl: './static-attribute-help-text.component.html',+})+export class StaticAttributeHelpTextComponent {+ // Attribute pass the modal title and content+ @Input() public title: string;+ @Input() public content: string;++ readonly text = {+ open_dialog: this.I18n.t('js.help_texts.show_modal'),+ };++ constructor(+ readonly elementRef: ElementRef,+ protected opModalService: OpModalService,+ protected cdRef: ChangeDetectorRef,+ protected injector: Injector,+ protected I18n: I18nService,+ ) {+ populateInputsFromDataset(this);+ }++ public handleClick(event: Event): void {+ this.opModalService.show(StaticAttributeHelpTextModalComponent, this.injector, { title: this.title, content: this.content });++ event.preventDefault();+ }+}diff --git a/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.modal.html b/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.modal.htmlnew file mode 100644index 00000000000..eff00ee6400--- /dev/null+++ b/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.modal.html@@ -0,0 +1,32 @@+<div+ class="spot-modal attribute-help-text--modal loading-indicator--location"+ data-indicator-name="modal"+>+ <div+ class="spot-modal--header"+ data-qa-selector="attribute-help-text--header"+ >+ <span class="spot-icon spot-icon_help1"></span>+ <span class="attribute-help-text--header-text"+ [textContent]="title"></span>+ </div>++ <div class="spot-modal--body spot-container">+ <div+ class="op-uc-container op-uc-container__no-permalinks"+ [textContent]="content"+ ></div>+ </div>++ <div class="spot-action-bar hidden-for-mobile">+ <div class="spot-action-bar--right">+ <button+ type="button"+ class="button spot-action-bar--action spot-modal--cancel-button"+ (click)="closeMe()"+ >+ {{ text.close }}+ </button>+ </div>+ </div>+</div>diff --git a/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.modal.ts b/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.modal.tsnew file mode 100644index 00000000000..66b72257d03--- /dev/null+++ b/frontend/src/app/shared/components/attribute-help-texts/static-attribute-help-text.modal.ts@@ -0,0 +1,61 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2023 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 {+ ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Inject, OnInit,+} from '@angular/core';+import { I18nService } from 'core-app/core/i18n/i18n.service';+import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';+import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';+import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';++@Component({+ templateUrl: './static-attribute-help-text.modal.html',+ changeDetection: ChangeDetectionStrategy.OnPush,+})+export class StaticAttributeHelpTextModalComponent extends OpModalComponent implements OnInit {+ readonly text = {+ close: this.I18n.t('js.button_close'),+ };++ public title:string = this.locals.title!;+ public content:string = this.locals.content!;++ constructor(+ @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,+ readonly I18n:I18nService,+ readonly cdRef:ChangeDetectorRef,+ readonly elementRef:ElementRef,+ ) {+ super(locals, cdRef, elementRef);+ }++ ngOnInit() {+ super.ngOnInit();+ }+}diff --git a/modules/storages/app/views/storages/project_settings/_form.html.erb b/modules/storages/app/views/storages/project_settings/_form.html.erbindex 42921e3655a..fc5f5a3b54e 100644--- a/modules/storages/app/views/storages/project_settings/_form.html.erb+++ b/modules/storages/app/views/storages/project_settings/_form.html.erb@@ -13,7 +13,15 @@</div><div class="form--field -required">- <label class="form--label -bold">Project folder</label>+ <%= styled_label_tag :project_folder_mode, class: "-bold" do %>+ <%= t(:"storages.label_project_folder") %>+ <%= angular_component_tag 'op-static-attribute-help-text',+ inputs: {+ title: "Title",+ content: "Lorem ipsum sit ajsakjdkassjd asdjkasjd",+ }+ %>+ <% end %><div class="form--field-container -horizontal"><%= f.label :project_folder_mode, class: "form--label-with-radio-button" do %><%= f.radio_button :project_folder_mode, 'inactive', no_label: true %>diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex ff66df59803..98676ab7d75 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -90,6 +90,7 @@ en:label_oauth_application_details: "OAuth application details"label_oauth_client_details: "OAuth client details"label_provider_type: "Provider type"+ label_project_folder: "Project folder"label_new_storage: "New storage"label_existing_manual_folder: "Existing folder with manually managed permissions"label_no_specific_folder: "No specific folder"