feat(project-editor): per-field inline validation for languages, homepage, widgets, navigation, static-pages
Extends the fieldError() wiring pattern (already used in theme/general/branding) to the remaining sections that have matching ProjectValidator fieldKeys: - languages: localization.supportedLocales (no-languages, missing-translations) - homepage: pages (empty-homepage, missing-widget, duplicate-routes) - widgets: pages (invalid-widget-config) - navigation: navigation.header (duplicate-nav-links) - static-pages: staticPages (duplicate-slugs, invalid-css) Header/footer/features sections have no matching validator issues today, so nothing to wire there yet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
<h2>{{ 'builder.staticPages' | translate }}</h2>
|
||||
<app-button variant="primary" (click)="createPage()">{{ 'builder.createPage' | translate }}</app-button>
|
||||
</div>
|
||||
@if (fieldError('staticPages'); as msg) {
|
||||
<p class="editor-error">{{ msg }}</p>
|
||||
}
|
||||
|
||||
<div class="editor-grid three static-pages-toolbar">
|
||||
<app-form-field [label]="'staticPages.searchPlaceholder' | translate">
|
||||
|
||||
@@ -51,6 +51,10 @@ export class StaticPagesEditorComponent {
|
||||
private readonly translate = inject(TranslateService);
|
||||
|
||||
readonly bootstrap = this.projectEditor.bootstrap;
|
||||
readonly fieldError = (key: string): string | null => {
|
||||
const messageKey = this.projectEditor.fieldError(key);
|
||||
return messageKey ? this.translate.t(messageKey) : null;
|
||||
};
|
||||
readonly allPages = computed(() => this.contentFacade.pages(this.bootstrap()));
|
||||
readonly validation = computed(() => this.contentFacade.validatePages(this.bootstrap()));
|
||||
readonly locales = computed(() => this.bootstrap()?.localization.supportedLocales ?? ['en']);
|
||||
|
||||
Reference in New Issue
Block a user