Skip to content

Commit

Permalink
add a LocalTextPrefix property to FormScript and ColumnsScript attrib…
Browse files Browse the repository at this point in the history
…ute that may be used to override the local text prefix calculated from form key and namespace
  • Loading branch information
volkanceylan committed Aug 12, 2023
1 parent 2b763fd commit a70459f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Serenity.ComponentModel;
namespace Serenity.ComponentModel;

/// <summary>
/// Indicates that this type should generate a columns script,
Expand Down Expand Up @@ -39,4 +39,11 @@ public ColumnsScriptAttribute(string key)
/// The key.
/// </value>
public string? Key { get; private set; }

/// <summary>
/// If set, modifies the local text prefix that should be used
/// instead of the automatically calculated one from Key and
/// Namespace
/// </summary>
public string? LocalTextPrefix { get; private set; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Serenity.ComponentModel;
namespace Serenity.ComponentModel;

/// <summary>
/// Indicates that this type should generate a form script,
Expand Down Expand Up @@ -39,4 +39,11 @@ public FormScriptAttribute(string key)
/// The key.
/// </value>
public string? Key { get; private set; }

/// <summary>
/// If set, modifies the local text prefix that should be used
/// instead of the automatically calculated one from Key and
/// Namespace
/// </summary>
public string? LocalTextPrefix { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ void addText(string text, string suffix)
if (columnsAttr is null)
return null;

if (columnsAttr.LocalTextPrefix is not null)
return columnsAttr.LocalTextPrefix;

itemsKey = columnsAttr.Key;
}
else if (formAttr.LocalTextPrefix is not null)
return formAttr.LocalTextPrefix;
else
itemsKey = formAttr.Key;

Expand Down

0 comments on commit a70459f

Please sign in to comment.