Skip to content

Commit

Permalink
Fix area without specified templateScript simply rendering components…
Browse files Browse the repository at this point in the history
… without templateScript.

 - Setting the templateScript to anything (default now undefined) will throw an error if not specified
 - TemplateScript has to remain optional in case of spring-renderer
  • Loading branch information
eschleb committed Oct 4, 2024
1 parent 33df074 commit c59446b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public TemplateDefinition getInternal() throws Registry.InvalidDefinitionExcepti
template.setDeletable(annotation.deletable().getValue());
template.setAreas(getAreas(template, factoryObject.getClass()));
Optional.of(annotation.modelClass()).filter(RenderingModel.class::isAssignableFrom).ifPresent(template::setModelClass);
Optional.ofNullable(StringUtils.trimToNull(annotation.templateScript())).ifPresent(template::setTemplateScript);
template.setTemplateScript(annotation.templateScript());
dynamicFragment(factoryObject.getClass()).ifPresent(template::setFragmentDefinition);
return template;
}
Expand All @@ -117,7 +117,7 @@ protected AreaDefinition getAreaDefinition(final ConfiguredTemplateDefinition te
Optional.of(annotation.maxComponents()).filter(max -> Integer.MAX_VALUE != max).ifPresent(area::setMaxComponents);
area.setOptional(annotation.optional().getValue());
area.setCreateAreaNode(annotation.createAreaNode().getValue());
Optional.ofNullable(StringUtils.trimToNull(annotation.templateScript())).ifPresent(area::setTemplateScript);
area.setTemplateScript(annotation.templateScript()); // If the templateScript is null the area is rendered simply by looping the components. (default annotation value is undefined)
getInheritanceConfiguration(areaClazz).ifPresent(area::setInheritance);
getAutoGenerationConfiguration(template, area, areaClazz).ifPresent(area::setAutoGeneration);
area.setAvailableComponents(getAvailableComponents(areaClazz));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

String dialog() default "";

String templateScript() default "";
String templateScript() default "undefined";

/**
* Defines the visibility of the template. When set to false the template is never presented in the user interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
String renderer() default "";

String templateScript() default "";
String templateScript() default "undefined";

String title() default "";

Expand Down

0 comments on commit c59446b

Please sign in to comment.