Pārlūkot izejas kodu

update field details template
if name contains password input type password

Ruben Poppe 4 gadi atpakaļ
vecāks
revīzija
9cac38bded
1 mainītis faili ar 6 papildinājumiem un 5 dzēšanām
  1. 6 5
      resources/views/components/field-details.blade.php

+ 6 - 5
resources/views/components/field-details.blade.php

@@ -3,7 +3,8 @@
 @if(($isInput ?? true) && empty($hasChildren))
 @php
     $isList = Str::endsWith($type, '[]');
-    $fullName =str_replace('[]', '.0', $name);
+    $isPassword = preg_match('/password/', $name);
+    $fullName = str_replace('[]', '.0', $name);
     $baseType = $isList ? substr($type, 0, -2) : $type;
     // Ignore the first '[]': the frontend will take care of it
     while (\Str::endsWith($baseType, '[]')) {
@@ -26,11 +27,11 @@
 <label data-endpoint="{{ $endpointId }}" hidden><input type="radio" name="{{ $fullName }}" value="{{$component === 'body' ? 'true' : 1}}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" @if($required)required @endif><code>true</code></label>
 <label data-endpoint="{{ $endpointId }}" hidden><input type="radio" name="{{ $fullName }}" value="{{$component === 'body' ? 'false' : 0}}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" @if($required)required @endif><code>false</code></label>
 @elseif($isList)
-<input type="{{ $inputType }}" name="{{ $fullName.".0" }}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" @if($required)required @endif hidden>
-<input type="{{ $inputType }}" name="{{ $fullName.".1" }}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" hidden>
+<input type="{{ $isPassword ? 'password' : $inputType }}" name="{{ $fullName.".0" }}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" @if($required)required @endif hidden>
+<input type="{{ $isPassword ? 'password' : $inputType }}" name="{{ $fullName.".1" }}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" hidden>
 @else
-<input type="{{ $inputType }}" name="{{ $fullName }}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" @if($required)required @endif hidden>
+<input type="{{ $isPassword ? 'password' : $inputType }}" name="{{ $fullName }}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" @if($required)required @endif hidden>
 @endif
 @endif
 <br>
-{!! $description !!}
+{!! $description !!}