From 5b38148651ec2f21fbab27a5b7f01e7e297139ea Mon Sep 17 00:00:00 2001
From: qwerltaz <69696513+qwerltaz@users.noreply.github.com>
Date: Sat, 11 Oct 2025 02:41:22 +0200
Subject: [PATCH] Hop console grant all and revoke all access buttons (#39375)
* add hop console select and deselect all access buttons
* align the buttons right
* document code
---
.../Access/UI/IdCardConsoleWindow.xaml | 19 +++++++++++----
.../Access/UI/IdCardConsoleWindow.xaml.cs | 23 ++++++++++++++-----
.../components/id-card-console-component.ftl | 4 +++-
3 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/Content.Client/Access/UI/IdCardConsoleWindow.xaml b/Content.Client/Access/UI/IdCardConsoleWindow.xaml
index a2f5f3382b..0a695a3dce 100644
--- a/Content.Client/Access/UI/IdCardConsoleWindow.xaml
+++ b/Content.Client/Access/UI/IdCardConsoleWindow.xaml
@@ -1,6 +1,7 @@
+
@@ -16,6 +17,7 @@
+
@@ -26,10 +28,19 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs b/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs
index 202653f700..30a7d969b6 100644
--- a/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs
+++ b/Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs
@@ -79,6 +79,18 @@ namespace Content.Client.Access.UI
JobPresetOptionButton.AddItem(Loc.GetString(job.Name), _jobPrototypeIds.Count - 1);
}
+ SelectAllButton.OnPressed += _ =>
+ {
+ SetAllAccess(true);
+ SubmitData();
+ };
+
+ DeselectAllButton.OnPressed += _ =>
+ {
+ SetAllAccess(false);
+ SubmitData();
+ };
+
JobPresetOptionButton.OnItemSelected += SelectJobPreset;
_accessButtons.Populate(accessLevels, prototypeManager);
AccessLevelControlContainer.AddChild(_accessButtons);
@@ -89,14 +101,13 @@ namespace Content.Client.Access.UI
}
}
- private void ClearAllAccess()
+ /// If true, every individual access button will be pressed. If false, each will be depressed.
+ private void SetAllAccess(bool enabled)
{
foreach (var button in _accessButtons.ButtonsList.Values)
{
- if (button.Pressed)
- {
- button.Pressed = false;
- }
+ if (!button.Disabled && button.Pressed != enabled)
+ button.Pressed = enabled;
}
}
@@ -110,7 +121,7 @@ namespace Content.Client.Access.UI
JobTitleLineEdit.Text = Loc.GetString(job.Name);
args.Button.SelectId(args.Id);
- ClearAllAccess();
+ SetAllAccess(false);
// this is a sussy way to do this
foreach (var access in job.Access)
diff --git a/Resources/Locale/en-US/access/components/id-card-console-component.ftl b/Resources/Locale/en-US/access/components/id-card-console-component.ftl
index 7793b34846..0418d32062 100644
--- a/Resources/Locale/en-US/access/components/id-card-console-component.ftl
+++ b/Resources/Locale/en-US/access/components/id-card-console-component.ftl
@@ -5,7 +5,9 @@ id-card-console-window-save-button = Save
id-card-console-window-job-title-label = Job title:
id-card-console-window-eject-button = Eject
id-card-console-window-insert-button = Insert
-id-card-console-window-job-selection-label = Job presets (sets department and job icon):
+id-card-console-window-job-selection-label = Job preset (sets department and job icon):
+id-card-console-window-select-all-button = Grant all
+id-card-console-window-deselect-all-button = Revoke all
access-id-card-console-component-no-hands-error = You have no hands.
id-card-console-privileged-id = Privileged ID
--
2.51.2