Add role bans tab to the bans admin window (#20388)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<roleBans:RoleBanListControl
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:roleBans="clr-namespace:Content.Client.Administration.UI.BanList.RoleBans">
|
||||
<PanelContainer StyleClasses="BackgroundDark">
|
||||
<ScrollContainer>
|
||||
<BoxContainer Name="RoleBans" Access="Public" Orientation="Vertical">
|
||||
<roleBans:RoleBanListHeader Name="BansHeader"/>
|
||||
</BoxContainer>
|
||||
</ScrollContainer>
|
||||
</PanelContainer>
|
||||
</roleBans:RoleBanListControl>
|
||||
@@ -0,0 +1,36 @@
|
||||
using Content.Client.Administration.UI.CustomControls;
|
||||
using Content.Shared.Administration.BanList;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
namespace Content.Client.Administration.UI.BanList.RoleBans;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class RoleBanListControl : Control
|
||||
{
|
||||
public event Action<RoleBanListLine>? LineIdsClicked;
|
||||
|
||||
public RoleBanListControl()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public void SetRoleBans(List<SharedServerRoleBan> bans)
|
||||
{
|
||||
for (var i = RoleBans.ChildCount - 1; i >= 1; i--)
|
||||
{
|
||||
RoleBans.GetChild(i).Dispose();
|
||||
}
|
||||
|
||||
foreach (var ban in bans)
|
||||
{
|
||||
RoleBans.AddChild(new HSeparator());
|
||||
|
||||
var line = new RoleBanListLine(ban);
|
||||
line.IdsClicked += LineIdsClicked;
|
||||
|
||||
RoleBans.AddChild(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<ContainerButton
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls">
|
||||
<PanelContainer Name="BackgroundPanel" Access="Public">
|
||||
<BoxContainer
|
||||
Orientation="Horizontal"
|
||||
HorizontalExpand="True"
|
||||
SeparationOverride="4">
|
||||
<Label Text="{Loc ban-list-header-ids}"
|
||||
SizeFlagsStretchRatio="1"
|
||||
HorizontalExpand="True"/>
|
||||
<cc:VSeparator/>
|
||||
<Label Text="{Loc ban-list-header-reason}"
|
||||
SizeFlagsStretchRatio="4.5"
|
||||
HorizontalExpand="True"/>
|
||||
<cc:VSeparator Name="ReasonSeparator" Access="Public"/>
|
||||
<Label Text="{Loc ban-list-header-role}"
|
||||
SizeFlagsStretchRatio="1.5"
|
||||
HorizontalExpand="True"/>
|
||||
<cc:VSeparator/>
|
||||
<Label Text="{Loc ban-list-header-time}"
|
||||
SizeFlagsStretchRatio="2"
|
||||
HorizontalExpand="True"/>
|
||||
<cc:VSeparator/>
|
||||
<Label Text="{Loc ban-list-header-expires}"
|
||||
SizeFlagsStretchRatio="4"
|
||||
HorizontalExpand="True"/>
|
||||
<cc:VSeparator/>
|
||||
<Label Text="{Loc ban-list-header-banning-admin}"
|
||||
SizeFlagsStretchRatio="2"
|
||||
HorizontalExpand="True"/>
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
</ContainerButton>
|
||||
@@ -0,0 +1,14 @@
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
namespace Content.Client.Administration.UI.BanList.RoleBans;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class RoleBanListHeader : ContainerButton
|
||||
{
|
||||
public RoleBanListHeader()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<BoxContainer
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
||||
Orientation="Horizontal"
|
||||
HorizontalExpand="True"
|
||||
SeparationOverride="4">
|
||||
<BoxContainer Orientation="Vertical"
|
||||
SizeFlagsStretchRatio="1"
|
||||
HorizontalExpand="True"
|
||||
RectClipContent="True">
|
||||
<Button Name="IdsHidden"
|
||||
Text="{Loc 'ban-list-view'}"
|
||||
HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
MouseFilter="Pass"/>
|
||||
</BoxContainer>
|
||||
<cc:VSeparator/>
|
||||
<Label Name="Reason"
|
||||
Access="Public"
|
||||
SizeFlagsStretchRatio="4.5"
|
||||
HorizontalExpand="True"
|
||||
VerticalExpand="True"/>
|
||||
<cc:VSeparator/>
|
||||
<Label Name="Role"
|
||||
SizeFlagsStretchRatio="1.5"
|
||||
HorizontalExpand="True"
|
||||
VerticalExpand="True"/>
|
||||
<cc:VSeparator/>
|
||||
<Label Name="BanTime"
|
||||
Access="Public"
|
||||
SizeFlagsStretchRatio="2"
|
||||
HorizontalExpand="True"
|
||||
ClipText="True"/>
|
||||
<cc:VSeparator/>
|
||||
<Label Name="Expires"
|
||||
Access="Public"
|
||||
SizeFlagsStretchRatio="4"
|
||||
HorizontalExpand="True"
|
||||
ClipText="True"/>
|
||||
<cc:VSeparator/>
|
||||
<Label Name="BanningAdmin"
|
||||
Access="Public"
|
||||
SizeFlagsStretchRatio="2"
|
||||
HorizontalExpand="True"
|
||||
ClipText="True"/>
|
||||
</BoxContainer>
|
||||
@@ -0,0 +1,40 @@
|
||||
using Content.Shared.Administration.BanList;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.Administration.UI.BanList.RoleBans;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class RoleBanListLine : BoxContainer, IBanListLine<SharedServerRoleBan>
|
||||
{
|
||||
public SharedServerRoleBan Ban { get; }
|
||||
|
||||
public event Action<RoleBanListLine>? IdsClicked;
|
||||
|
||||
public RoleBanListLine(SharedServerRoleBan ban)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
Ban = ban;
|
||||
IdsHidden.OnPressed += IdsPressed;
|
||||
|
||||
BanListEui.SetData(this, ban);
|
||||
Role.Text = ban.Role;
|
||||
}
|
||||
|
||||
private void IdsPressed(ButtonEventArgs buttonEventArgs)
|
||||
{
|
||||
IdsClicked?.Invoke(this);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
IdsHidden.OnPressed -= IdsPressed;
|
||||
IdsClicked = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user