Bläddra i källkod

feat: ✨ Add custom settings category icon

IceToast 2 år sedan
förälder
incheckning
84f94ed564

+ 6 - 1
app/Http/Controllers/Admin/SettingsController.php

@@ -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;
         }
 

+ 1 - 0
app/Settings/DiscordSettings.php

@@ -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',

+ 1 - 6
app/Settings/GeneralSettings.php

@@ -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',

+ 1 - 0
app/Settings/InvoiceSettings.php

@@ -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',

+ 1 - 0
app/Settings/LocaleSettings.php

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

+ 1 - 0
app/Settings/MailSettings.php

@@ -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',

+ 1 - 0
app/Settings/PterodactylSettings.php

@@ -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',

+ 1 - 0
app/Settings/ReferralSettings.php

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

+ 1 - 0
app/Settings/ServerSettings.php

@@ -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',

+ 1 - 0
app/Settings/TicketSettings.php

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

+ 1 - 0
app/Settings/UserSettings.php

@@ -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',

+ 1 - 0
app/Settings/WebsiteSettings.php

@@ -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',

+ 5 - 1
themes/default/views/admin/settings/index.blade.php

@@ -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>