From c4ab4bb5e339a65c10cf7f85ff16e8794e357c55 Mon Sep 17 00:00:00 2001 From: ScuffedNewt Date: Mon, 5 Feb 2024 14:11:12 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8feature:=20introduce=20overall=20colou?= =?UTF-8?q?r=20toggle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Character/CharacterImage.php | 2 +- config/lorekeeper/character_pairing.php | 3 + .../admin/pairings/_pairing_myo.blade.php | 18 +++--- .../views/admin/pairings/roller.blade.php | 10 +-- .../views/character/_image_info.blade.php | 61 ++++++++++--------- .../views/character/design/image.blade.php | 4 +- resources/views/home/pairings.blade.php | 10 +-- routes/lorekeeper/members.php | 3 + 8 files changed, 62 insertions(+), 49 deletions(-) diff --git a/app/Models/Character/CharacterImage.php b/app/Models/Character/CharacterImage.php index 985fa96043..d8f2e7a618 100644 --- a/app/Models/Character/CharacterImage.php +++ b/app/Models/Character/CharacterImage.php @@ -270,7 +270,7 @@ public function getThumbnailUrlAttribute() { * * @return string */ - public function displayColours($breaks = false) { + public function displayColours() { // return the images as a row of colour boxes if (!$this->colours) { return ''; diff --git a/config/lorekeeper/character_pairing.php b/config/lorekeeper/character_pairing.php index 86b912f078..2def895656 100644 --- a/config/lorekeeper/character_pairing.php +++ b/config/lorekeeper/character_pairing.php @@ -23,6 +23,9 @@ // Recommended to leave these settings alone unless you know what you're doing ///////////////////////////////////// + // 0: Disabled, 1: Enabled + 'colours' => 0, + // if colours from parents should be inherited, entirely visual, no actual colour checks occur, // just a colour palette generated from parents and displayed on the pairing slots 'inherit_colours' => 1, // 0: Disabled, 1: Enabled diff --git a/resources/views/admin/pairings/_pairing_myo.blade.php b/resources/views/admin/pairings/_pairing_myo.blade.php index ab23525378..63d2806e55 100644 --- a/resources/views/admin/pairings/_pairing_myo.blade.php +++ b/resources/views/admin/pairings/_pairing_myo.blade.php @@ -24,14 +24,16 @@
{!! $myo['sex'] !!}
-
-
-
Colours
-
-
- {!! $myo['palette'] ?? '
No colours generated. Inheritance likely disabled.
' !!} -
-
+ @if(config('lorekeeper.character_pairing.colours')) +
+
+
Colours
+
+
+ {!! $myo['palette'] ?? '
No colours generated. Inheritance likely disabled.
' !!} +
+
+ @endif
Traits
diff --git a/resources/views/admin/pairings/roller.blade.php b/resources/views/admin/pairings/roller.blade.php index 735412a051..da90acac9a 100644 --- a/resources/views/admin/pairings/roller.blade.php +++ b/resources/views/admin/pairings/roller.blade.php @@ -166,10 +166,12 @@ function(response, status, xhr) { $parent.find('.character-rewards').removeClass('hide'); }); // load colour palette - $parent.find('.character-image-colours').load('{{ url('character') }}/' + $(this).val() + '/image/colours', - function(response, status, xhr) { - $parent.find('.character-image-colours').html(response); - }); + if ("{{ config('lorekeeper.character_pairing.colours') }}" == 1) { + $parent.find('.character-image-colours').load('{{ url('character') }}/' + $(this).val() + '/image/colours', + function(response, status, xhr) { + $parent.find('.character-image-colours').html(response); + }); + } // check if both parents are selected if ($char_1.find('.character-code').val() && $char_2.find('.character-code').val()) { // get request to check if they are compatible diff --git a/resources/views/character/_image_info.blade.php b/resources/views/character/_image_info.blade.php index d10b74ed7f..493539672c 100644 --- a/resources/views/character/_image_info.blade.php +++ b/resources/views/character/_image_info.blade.php @@ -64,41 +64,42 @@
{!! $image->sex !!}
@endif -
-
-
- Colours - @if ($image->character->is_myo_slot) - {!! add_help('These colours are created from the parents of the MYO slot. They are not editable until the MYO is created.') !!} - @endif -
-
-
- @if ($image->colours) -
- {!! $image->displayColours() !!} - @if (Auth::check() && Auth::user()->hasPower('manage_characters') && !$image->character->is_myo_slot) -
Edit
+ @if (config('lorekeeper.character_pairing.colours')) +
+
+
+ Colours + @if ($image->character->is_myo_slot) + {!! add_help('These colours are created from the parents of the MYO slot. They are not editable until the MYO is created.') !!} @endif -
- @if (Auth::check() && Auth::user()->hasPower('manage_characters') && !$image->character->is_myo_slot) -
- @include('character.admin._edit_image_colours', ['image' => $image]) + +
+
+ @if ($image->colours) +
+ {!! $image->displayColours() !!} + @if (Auth::check() && Auth::user()->hasPower('manage_characters') && !$image->character->is_myo_slot) +
Edit
+ @endif
- @endif - @else -
-
No colours listed.
@if (Auth::check() && Auth::user()->hasPower('manage_characters') && !$image->character->is_myo_slot) - {!! Form::open(['url' => 'admin/character/image/' . $image->id . '/colours']) !!} - {!! Form::submit('Generate', ['class' => 'btn btn-outline-info btn-sm ml-3 py-0']) !!} - {!! Form::close() !!} +
+ @include('character.admin._edit_image_colours', ['image' => $image]) +
@endif -
- @endif + @else +
+
No colours listed.
+ @if (Auth::check() && Auth::user()->hasPower('manage_characters') && !$image->character->is_myo_slot) + {!! Form::open(['url' => 'admin/character/image/' . $image->id . '/colours']) !!} + {!! Form::submit('Generate', ['class' => 'btn btn-outline-info btn-sm ml-3 py-0']) !!} + {!! Form::close() !!} + @endif +
+ @endif +
-
- + @endif
diff --git a/resources/views/character/design/image.blade.php b/resources/views/character/design/image.blade.php index f5da50cf4d..59c0c6f931 100644 --- a/resources/views/character/design/image.blade.php +++ b/resources/views/character/design/image.blade.php @@ -68,10 +68,10 @@

As a staff member, you may modify the thumbnail of the uploaded image and/or the credits, but not the image itself. If you have recropped the thumbnail, you may need to hard refresh to see the new one.

@endif - @if ($request->character->is_myo_slot && $request->character->image->colours) + @if ($request->character->is_myo_slot && $request->character->image->colours && config('lorekeeper.character_pairing.colours'))
This is a pairing slot with predefined colours. Colours are a general guideline that your MYO should follow. You may deviate from these colours, but they should be recognizable as the same character. If you have any questions, please contact staff. -
{!! $request->character->image->displayColours(true) !!}
+
{!! $request->character->image->displayColours() !!}
@endif diff --git a/resources/views/home/pairings.blade.php b/resources/views/home/pairings.blade.php index eeb59b3773..e12b06ab4e 100644 --- a/resources/views/home/pairings.blade.php +++ b/resources/views/home/pairings.blade.php @@ -84,10 +84,12 @@ function(response, status, xhr) { $parent.find('.character-rewards').removeClass('hide'); }); // load colour palette - $parent.find('.character-image-colours').load('{{ url('character') }}/' + $(this).val() + '/image/colours', - function(response, status, xhr) { - $parent.find('.character-image-colours').html(response); - }); + if ("{{ config('lorekeeper.character_pairing.colours') }}" == 1) { + $parent.find('.character-image-colours').load('{{ url('character') }}/' + $(this).val() + '/image/colours', + function(response, status, xhr) { + $parent.find('.character-image-colours').html(response); + }); + } // check if both parents are selected if ($char_1.find('.character-code').val() && $char_2.find('.character-code').val()) { // get request to check if they are compatible diff --git a/routes/lorekeeper/members.php b/routes/lorekeeper/members.php index bd0b24bbcf..22269cbb24 100644 --- a/routes/lorekeeper/members.php +++ b/routes/lorekeeper/members.php @@ -122,6 +122,9 @@ Route::get('{slug}/approval', 'CharacterController@getCharacterApproval'); Route::get('{slug}/image/colours', function ($slug) { + if (!config('lorekeeper.character_pairing.colours')) { + return ""; + } return \App\Models\Character\Character::where('slug', $slug)->first()?->image->displayColours(); }); });