added color to setting

pull/44/head
A1Gard 5 months ago
parent e280b8deb8
commit 801de6ae1d

@ -548,8 +548,10 @@ function validateSettingRequest($setting, $newValue)
switch ($setting->key) { switch ($setting->key) {
case 'optimize': case 'optimize':
if ($newValue != 'jpg' || $newValue != 'webp') { if ($newValue != 'jpg' && $newValue != 'webp') {
return 'webp'; return 'webp';
}else{
return $newValue;
} }
case 'gallery_thumb': case 'gallery_thumb':
case 'post_thumb': case 'post_thumb':

@ -13,5 +13,5 @@ class Setting extends Model
public $translatable = ['value']; public $translatable = ['value'];
public static $settingTypes = ['TEXT', 'LONGTEXT', 'CODE', 'EDITOR', public static $settingTypes = ['TEXT', 'LONGTEXT', 'CODE', 'EDITOR',
'CATEGORY', 'GROUP', 'CHECKBOX', 'FILE']; 'CATEGORY', 'GROUP', 'CHECKBOX', 'FILE','COLOR'];
} }

@ -62,7 +62,7 @@
<select name="type" id="type" <select name="type" id="type"
class="form-control @error('type') is-invalid @enderror"> class="form-control @error('type') is-invalid @enderror">
@foreach(\App\Models\Setting::$settingTypes as $type) @foreach(\App\Models\Setting::$settingTypes as $type)
<option value="text" <option value="{{$type}}"
@if (old('type') == $type ) selected @endif >{{__($type)}} </option> @if (old('type') == $type ) selected @endif >{{__($type)}} </option>
@endforeach @endforeach

@ -56,6 +56,12 @@
xvalue='{{old($setting->key,$setting->value??null)}}' xvalue='{{old($setting->key,$setting->value??null)}}'
:close-on-Select="true"></searchable-select> :close-on-Select="true"></searchable-select>
@break @break
@case('COLOR')
<br>
<input type="color" id="{{$setting->key}}"
name="{{$setting->key}}" class="form-control-color w-100"
value="{{old($setting->key, $setting->value)}}" >
@break
@case('FILE') @case('FILE')
<div class="row"> <div class="row">
@php($ext = strtolower(pathinfo(str_replace('_','.',$setting->key), PATHINFO_EXTENSION))) @php($ext = strtolower(pathinfo(str_replace('_','.',$setting->key), PATHINFO_EXTENSION)))
@ -87,9 +93,9 @@
@default @default
@if($setting->key == 'optimize') @if($setting->key == 'optimize')
<select class="form-control" name="{{$setting->key}}" id="{{$setting->key}}"> <select class="form-control" name="{{$setting->key}}" id="{{$setting->key}}">
<option value="1" <option value="jpg"
@if (old($setting->key, $setting->value??'webp') == 'jpg' ) selected @endif >{{__("jpg")}} </option> @if (old($setting->key, $setting->value??'webp') == 'jpg' ) selected @endif >{{__("jpg")}} </option>
<option value="0" <option value="webp"
@if (old($setting->key, $setting->value??'webp') == 'webp' ) selected @endif >{{__("webp")}} </option> @if (old($setting->key, $setting->value??'webp') == 'webp' ) selected @endif >{{__("webp")}} </option>
</select> </select>
@else @else

Loading…
Cancel
Save