feat: Add custom settings category icon

This commit is contained in:
IceToast 2023-02-20 13:44:06 +01:00 committed by IceToast
parent a6a729a065
commit 84f94ed564
13 changed files with 22 additions and 8 deletions

View file

@ -38,8 +38,8 @@ class SettingsController extends Controller
$optionInputData = [];
}
// collect all option input data
$optionsData = [];
foreach ($options as $key => $value) {
$optionsData[$key] = [
'value' => $value,
@ -50,6 +50,11 @@ class SettingsController extends Controller
];
}
// collect category icon if available
if (isset($optionInputData['category_icon'])) {
$optionsData['category_icon'] = $optionInputData['category_icon'];
}
$settings[str_replace('Settings.php', '', $file)] = $optionsData;
}

View file

@ -56,6 +56,7 @@ class DiscordSettings extends Settings
public static function getOptionInputData()
{
return [
'category_icon' => 'fas fa-user-friends',
'bot_token' => [
'label' => 'Bot Token',
'type' => 'string',

View file

@ -38,7 +38,6 @@ class GeneralSettings extends Settings
public static function getValidations()
{
return [
'main_site' => 'nullable|string',
'credits_display_name' => 'required|string',
'initial_user_credits' => 'required|numeric',
'initial_server_limit' => 'required|numeric',
@ -61,11 +60,7 @@ class GeneralSettings extends Settings
public static function getOptionInputData()
{
return [
'main_site' => [
'type' => 'string',
'label' => 'Main Site URL',
'description' => 'The URL of your main site.'
],
'category_icon' => "fas fa-cog",
'credits_display_name' => [
'type' => 'string',
'label' => 'Credits Display Name',

View file

@ -53,6 +53,7 @@ class InvoiceSettings extends Settings
public static function getOptionInputData()
{
return [
'category_icon' => 'fas fa-file-invoice-dollar',
'company_address' => [
'label' => 'Company Address',
'type' => 'string',

View file

@ -44,6 +44,7 @@ class LocaleSettings extends Settings
public static function getOptionInputData()
{
return [
'category_icon' => 'fas fa-globe',
'available' => [
'label' => 'Available Locales',
'type' => 'multiselect',

View file

@ -77,6 +77,7 @@ class MailSettings extends Settings
public static function getOptionInputData()
{
return [
'category_icon' => 'fas fa-envelope',
'mail_host' => [
'label' => 'Mail Host',
'type' => 'string',

View file

@ -59,6 +59,7 @@ class PterodactylSettings extends Settings
public static function getOptionInputData()
{
return [
'category_icon' => 'fas fa-server',
'panel_url' => [
'label' => 'Panel URL',
'type' => 'string',

View file

@ -47,6 +47,7 @@ class ReferralSettings extends Settings
public static function getOptionInputData()
{
return [
'category_icon' => 'fas fa-user-friends',
'allowed' => [
'label' => 'Allowed',
'type' => 'select',

View file

@ -41,6 +41,7 @@ class ServerSettings extends Settings
public static function getOptionInputData()
{
return [
'category_icon' => 'fas fa-server',
'allocation_limit' => [
'label' => 'Allocation Limit',
'type' => 'number',

View file

@ -35,6 +35,7 @@ class TicketSettings extends Settings
public static function getOptionInputData()
{
return [
'category_icon' => 'fas fa-ticket-alt',
'enabled' => [
'label' => 'Enabled',
'type' => 'boolean',

View file

@ -65,6 +65,7 @@ class UserSettings extends Settings
public static function getOptionInputData()
{
return [
'category_icon' => 'fas fa-user',
'credits_reward_after_verify_discord' => [
'label' => 'Credits Reward After Verify Discord',
'type' => 'number',

View file

@ -56,6 +56,7 @@ class WebsiteSettings extends Settings
public static function getOptionInputData()
{
return [
'category_icon' => 'fas fa-globe',
'motd_enabled' => [
'label' => 'Enable MOTD',
'type' => 'boolean',

View file

@ -49,7 +49,8 @@
<a href="#{{ $category }}"
class="nav-link {{ $loop->first ? 'active' : '' }}" data-toggle="pill"
role="tab">
<i class="nav-icon fas fa-cog"></i>
<i
class="nav-icon fas {{ $options['category_icon'] ?? 'fas fa-cog' }}"></i>
<p>
{{ $category }}
</p>
@ -73,6 +74,9 @@
<input type="hidden" name="category" value="{{ $category }}">
@foreach ($options as $key => $value)
@if ($key == 'category_icon')
@continue
@endif
<div class="row">
<div class="col-4 d-flex align-items-center">
<label for="{{ $key }}">{{ $value['label'] }}</label>