Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): EditDescriptionOnly field to display additional text in forms #1945

Merged
merged 2 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/app/core/config/config-fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,10 @@ export const defaultJsonConfig = {
"config": {
"cols": [
["health_bloodGroup"],
["health_lastDentalCheckup"]
[
{ "id": "_description_health", "edit": "EditDescriptionOnly", "label": $localize`:description section:Health checkups are to be done regularly, at least every 6 months according to the program guidelines.`},
"health_lastDentalCheckup"
]
]
}
},
Expand Down
19 changes: 13 additions & 6 deletions src/app/core/core-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const coreComponents: ComponentTuple[] = [
"Form",
() =>
import("./entity-components/entity-details/form/form.component").then(
(c) => c.FormComponent
(c) => c.FormComponent,
),
],
[
Expand Down Expand Up @@ -113,6 +113,13 @@ export const coreComponents: ComponentTuple[] = [
"./entity-components/entity-utils/dynamic-form-components/edit-number/edit-number.component"
).then((c) => c.EditNumberComponent),
],
[
"EditDescriptionOnly",
() =>
import(
"./entity-components/entity-utils/dynamic-form-components/edit-description-only/edit-description-only.component"
).then((c) => c.EditDescriptionOnlyComponent),
],
[
"DisplayCheckmark",
() =>
Expand Down Expand Up @@ -173,21 +180,21 @@ export const coreComponents: ComponentTuple[] = [
"UserSecurity",
() =>
import("./user/user-security/user-security.component").then(
(c) => c.UserSecurityComponent
(c) => c.UserSecurityComponent,
),
],
[
"Dashboard",
() =>
import("./dashboard/dashboard/dashboard.component").then(
(c) => c.DashboardComponent
(c) => c.DashboardComponent,
),
],
[
"EntityList",
() =>
import("./entity-components/entity-list/entity-list.component").then(
(c) => c.EntityListComponent
(c) => c.EntityListComponent,
),
],
[
Expand All @@ -205,14 +212,14 @@ export const coreComponents: ComponentTuple[] = [
"ConfigImport",
() =>
import("./config-setup/config-import/config-import.component").then(
(c) => c.ConfigImportComponent
(c) => c.ConfigImportComponent,
),
],
[
"MarkdownPage",
() =>
import("./markdown-page/markdown-page/markdown-page.component").then(
(c) => c.MarkdownPageComponent
(c) => c.MarkdownPageComponent,
),
],
[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { EditDescriptionOnlyComponent } from "./edit-description-only.component";

describe("EditDescriptionOnlyComponent", () => {
let component: EditDescriptionOnlyComponent;
let fixture: ComponentFixture<EditDescriptionOnlyComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [EditDescriptionOnlyComponent],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(EditDescriptionOnlyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it("should create", () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Component, Input } from "@angular/core";
import { DynamicComponent } from "../../../../view/dynamic-components/dynamic-component.decorator";
import { FormFieldConfig } from "../../../entity-form/entity-form/FormConfig";

@DynamicComponent("EditDescriptionOnly")
@Component({
selector: "app-edit-description-only",
template: "{{formFieldConfig?.label}}",
standalone: true,
})
export class EditDescriptionOnlyComponent {
@Input() formFieldConfig: FormFieldConfig;
}