add confirmation to the delete button in objects tab (#30946)
ui shitcode
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using Content.Client.Administration.Managers;
|
using Content.Client.Administration.Managers;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
@@ -13,6 +13,7 @@ public sealed partial class ObjectsTabEntry : PanelContainer
|
|||||||
|
|
||||||
public Action<NetEntity>? OnTeleport;
|
public Action<NetEntity>? OnTeleport;
|
||||||
public Action<NetEntity>? OnDelete;
|
public Action<NetEntity>? OnDelete;
|
||||||
|
private readonly Dictionary<Button, ConfirmationData> _confirmations = new();
|
||||||
|
|
||||||
public ObjectsTabEntry(IClientAdminManager manager, string name, NetEntity nent, StyleBox styleBox)
|
public ObjectsTabEntry(IClientAdminManager manager, string name, NetEntity nent, StyleBox styleBox)
|
||||||
{
|
{
|
||||||
@@ -27,6 +28,13 @@ public sealed partial class ObjectsTabEntry : PanelContainer
|
|||||||
DeleteButton.Disabled = !manager.CanCommand("delete");
|
DeleteButton.Disabled = !manager.CanCommand("delete");
|
||||||
|
|
||||||
TeleportButton.OnPressed += _ => OnTeleport?.Invoke(nent);
|
TeleportButton.OnPressed += _ => OnTeleport?.Invoke(nent);
|
||||||
DeleteButton.OnPressed += _ => OnDelete?.Invoke(nent);
|
DeleteButton.OnPressed += _ =>
|
||||||
|
{
|
||||||
|
if (!AdminUIHelpers.TryConfirm(DeleteButton, _confirmations))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OnDelete?.Invoke(nent);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user