Databind on scripts instead of game
This commit is contained in:
parent
1ef4469fbf
commit
c8a11bee7f
2 changed files with 10 additions and 7 deletions
|
@ -64,7 +64,7 @@
|
|||
|
||||
<Space Direction="DirectionVHType.Vertical" Size="@("large")" Style="width: 100%">
|
||||
<SpaceItem>
|
||||
<Table TItem="Script" DataSource="@Game.Scripts" HidePagination="true">
|
||||
<Table TItem="Script" DataSource="@Scripts" HidePagination="true">
|
||||
<PropertyColumn Property="s => s.Type" />
|
||||
<PropertyColumn Property="s => s.CreatedBy">
|
||||
@context.CreatedBy?.UserName
|
||||
|
@ -100,7 +100,10 @@
|
|||
</style>
|
||||
|
||||
@code {
|
||||
[Parameter] public Game Game { get; set; }
|
||||
[Parameter] public Guid GameId { get; set; }
|
||||
[Parameter] public Guid ArchiveId { get; set; }
|
||||
[Parameter] public ICollection<Script> Scripts { get; set; }
|
||||
[Parameter] public EventCallback<ICollection<Script>> ScriptsChanged { get; set; }
|
||||
|
||||
Script Script;
|
||||
|
||||
|
@ -122,8 +125,8 @@
|
|||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (Game.Scripts == null)
|
||||
Game.Scripts = new List<Script>();
|
||||
if (Scripts == null)
|
||||
Scripts = new List<Script>();
|
||||
|
||||
Snippets = ScriptService.GetSnippets();
|
||||
|
||||
|
@ -136,7 +139,7 @@
|
|||
if (script == null) {
|
||||
Script = new Script()
|
||||
{
|
||||
GameId = Game.Id
|
||||
GameId = GameId
|
||||
};
|
||||
|
||||
if (Editor != null)
|
||||
|
@ -200,7 +203,7 @@
|
|||
|
||||
var browserOptions = new ArchiveBrowserOptions()
|
||||
{
|
||||
ArchiveId = Game.Archives.FirstOrDefault().Id,
|
||||
ArchiveId = ArchiveId,
|
||||
Select = true,
|
||||
Multiple = false
|
||||
};
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
<SpaceItem>
|
||||
<Card Title="Scripts">
|
||||
<Body>
|
||||
<ScriptEditor Game="Game" />
|
||||
<ScriptEditor @bind-Scripts="Game.Scripts" GameId="Game.Id" ArchiveId="Game.Archives.OrderByDescending(a => a.CreatedOn).FirstOrDefault().Id" />
|
||||
</Body>
|
||||
</Card>
|
||||
</SpaceItem>
|
||||
|
|
Loading…
Add table
Reference in a new issue