Skip to content

Commit

Permalink
AddTemplateDecorator: add Template suffix to properties
Browse files Browse the repository at this point in the history
  • Loading branch information
exyi committed Feb 8, 2024
1 parent 2c81c2e commit 71ee2f4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions src/Framework/Framework/Controls/AddTemplateDecorator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ public class AddTemplateDecorator: Decorator
{
/// <summary> Template is rendered after the decorated control. </summary>
[MarkupOptions(MappingMode = MappingMode.InnerElement)]
public ITemplate After
public ITemplate AfterTemplate
{
get => (ITemplate)GetValue(AfterProperty)!;
set => SetValue(AfterProperty, value);
get => (ITemplate)GetValue(AfterTemplateProperty)!;
set => SetValue(AfterTemplateProperty, value);
}
public static readonly DotvvmProperty AfterProperty =
DotvvmProperty.Register<ITemplate, AddTemplateDecorator>(nameof(After));
public static readonly DotvvmProperty AfterTemplateProperty =
DotvvmProperty.Register<ITemplate, AddTemplateDecorator>(nameof(AfterTemplate));

/// <summary> Template is rendered before the decorated control. </summary>
[MarkupOptions(MappingMode = MappingMode.InnerElement)]
public ITemplate Before
public ITemplate BeforeTemplate
{
get => (ITemplate)GetValue(BeforeProperty)!;
set => SetValue(BeforeProperty, value);
get => (ITemplate)GetValue(BeforeTemplateProperty)!;
set => SetValue(BeforeTemplateProperty, value);
}
public static readonly DotvvmProperty BeforeProperty =
DotvvmProperty.Register<ITemplate, AddTemplateDecorator>(nameof(Before));
public static readonly DotvvmProperty BeforeTemplateProperty =
DotvvmProperty.Register<ITemplate, AddTemplateDecorator>(nameof(BeforeTemplate));

protected internal override void OnInit(IDotvvmRequestContext context)
{
var after = this.After;
var before = this.Before;
var after = this.AfterTemplate;
var before = this.BeforeTemplate;

if (after is {})
{
Expand Down
8 changes: 4 additions & 4 deletions src/Tests/ControlTests/GridViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,20 @@ public async Task GridView_RowDecorators_AddChildren()
<dot:Decorator Class-enabled="{value: Enabled}" />
<dot:AddTemplateDecorator>
<Before>
<BeforeTemplate>
<tr colspan=3 IncludeInPage={value: Enabled}>
<td>
vvv enabled customer vvv
</td>
</tr>
</Before>
<After>
</BeforeTemplate>
<AfterTemplate>
<tr colspan=3 IncludeInPage={value: Enabled}>
<td>
^^^ enabled customer ^^^
</td>
</tr>
</After>
</AfterTemplate>
</dot:AddTemplateDecorator>
</RowDecorators>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,11 @@
}
},
"DotVVM.Framework.Controls.AddTemplateDecorator": {
"After": {
"AfterTemplate": {
"type": "DotVVM.Framework.Controls.ITemplate, DotVVM.Framework",
"mappingMode": "InnerElement"
},
"Before": {
"BeforeTemplate": {
"type": "DotVVM.Framework.Controls.ITemplate, DotVVM.Framework",
"mappingMode": "InnerElement"
}
Expand Down

0 comments on commit 71ee2f4

Please sign in to comment.