-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Admin UI): manage related public forms directly from Admin Entity…
… view (#2740) closes #2708 --------- Co-authored-by: Sebastian Leidig <[email protected]>
- Loading branch information
Showing
10 changed files
with
95 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/app/core/admin/admin-entity-public-forms/admin-entity-public-forms-component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class="hint-banner" i18n> | ||
You can share the link to a "Public Form" with people who do not have an | ||
account or embed it in your website. People can submit new records through | ||
this form without logging in. For example, you can let participants | ||
self-register this way and then review their data later. | ||
</div> | ||
|
||
<app-view-title [disableBackButton]="true" [displayInPlace]="true" i18n> | ||
Public Forms | ||
</app-view-title> | ||
|
||
<div> | ||
<app-related-entities | ||
entityType="PublicFormConfig" | ||
property="entity" | ||
[columns]="['title', 'route', 'description']" | ||
[entity]="dummyEntity" | ||
clickMode="popup-details" | ||
></app-related-entities> | ||
</div> |
Empty file.
26 changes: 26 additions & 0 deletions
26
src/app/core/admin/admin-entity-public-forms/admin-entity-public-forms-component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ComponentFixture, TestBed } from "@angular/core/testing"; | ||
import { AdminEntityPublicFormsComponent } from "./admin-entity-public-forms-component"; | ||
import { MockedTestingModule } from "../../../utils/mocked-testing.module"; | ||
import { TestEntity } from "../../../utils/test-utils/TestEntity"; | ||
|
||
describe("AdminEntityPublicFormsComponent", () => { | ||
let component: AdminEntityPublicFormsComponent; | ||
let fixture: ComponentFixture<AdminEntityPublicFormsComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ | ||
AdminEntityPublicFormsComponent, | ||
MockedTestingModule.withState(), | ||
], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(AdminEntityPublicFormsComponent); | ||
component = fixture.componentInstance; | ||
component.entityConstructor = TestEntity; | ||
}); | ||
|
||
it("should create the component", () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
src/app/core/admin/admin-entity-public-forms/admin-entity-public-forms-component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Component, Input } from "@angular/core"; | ||
import { EntityConstructor } from "app/core/entity/model/entity"; | ||
import { ViewTitleComponent } from "../../common-components/view-title/view-title.component"; | ||
import { RelatedEntitiesComponent } from "../../entity-details/related-entities/related-entities.component"; | ||
|
||
@Component({ | ||
selector: "app-admin-entity-public-forms-component", | ||
standalone: true, | ||
templateUrl: "./admin-entity-public-forms-component.html", | ||
styleUrls: [ | ||
"./admin-entity-public-forms-component.scss", | ||
"../admin-entity/admin-entity-styles.scss", | ||
], | ||
imports: [ViewTitleComponent, RelatedEntitiesComponent], | ||
}) | ||
export class AdminEntityPublicFormsComponent { | ||
/** | ||
* The entity type for which to display public forms for. | ||
*/ | ||
@Input() entityConstructor: EntityConstructor; | ||
|
||
/** | ||
* Fake entity instance to correctly filter/link related PublicFormConfigs | ||
* using the standard related-entities component. | ||
*/ | ||
protected dummyEntity: any = { | ||
getId: () => this.entityConstructor.ENTITY_TYPE, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters