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%">
|
<Space Direction="DirectionVHType.Vertical" Size="@("large")" Style="width: 100%">
|
||||||
<SpaceItem>
|
<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.Type" />
|
||||||
<PropertyColumn Property="s => s.CreatedBy">
|
<PropertyColumn Property="s => s.CreatedBy">
|
||||||
@context.CreatedBy?.UserName
|
@context.CreatedBy?.UserName
|
||||||
|
@ -100,7 +100,10 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@code {
|
@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;
|
Script Script;
|
||||||
|
|
||||||
|
@ -122,8 +125,8 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
if (Game.Scripts == null)
|
if (Scripts == null)
|
||||||
Game.Scripts = new List<Script>();
|
Scripts = new List<Script>();
|
||||||
|
|
||||||
Snippets = ScriptService.GetSnippets();
|
Snippets = ScriptService.GetSnippets();
|
||||||
|
|
||||||
|
@ -136,7 +139,7 @@
|
||||||
if (script == null) {
|
if (script == null) {
|
||||||
Script = new Script()
|
Script = new Script()
|
||||||
{
|
{
|
||||||
GameId = Game.Id
|
GameId = GameId
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Editor != null)
|
if (Editor != null)
|
||||||
|
@ -200,7 +203,7 @@
|
||||||
|
|
||||||
var browserOptions = new ArchiveBrowserOptions()
|
var browserOptions = new ArchiveBrowserOptions()
|
||||||
{
|
{
|
||||||
ArchiveId = Game.Archives.FirstOrDefault().Id,
|
ArchiveId = ArchiveId,
|
||||||
Select = true,
|
Select = true,
|
||||||
Multiple = false
|
Multiple = false
|
||||||
};
|
};
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
<SpaceItem>
|
<SpaceItem>
|
||||||
<Card Title="Scripts">
|
<Card Title="Scripts">
|
||||||
<Body>
|
<Body>
|
||||||
<ScriptEditor Game="Game" />
|
<ScriptEditor @bind-Scripts="Game.Scripts" GameId="Game.Id" ArchiveId="Game.Archives.OrderByDescending(a => a.CreatedOn).FirstOrDefault().Id" />
|
||||||
</Body>
|
</Body>
|
||||||
</Card>
|
</Card>
|
||||||
</SpaceItem>
|
</SpaceItem>
|
||||||
|
|
Loading…
Add table
Reference in a new issue