Improved determination of attribute object being dirty, improved detection of blank input and processing
This commit is contained in:
parent
dd759b23d9
commit
f0a4bcf941
app
resources/views
@ -253,10 +253,9 @@ class Attribute implements \Countable, \ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public function isDirty(): bool
|
public function isDirty(): bool
|
||||||
{
|
{
|
||||||
return (($a=$this->values_old->dot())->keys()->count() !== ($b=$this->values->dot())->keys()->count())
|
return (($a=$this->values_old->dot()->filter())->keys()->count() !== ($b=$this->values->dot()->filter())->keys()->count())
|
||||||
|| ($a->values()->count() !== $b->values()->count())
|
|| ($a->count() !== $b->count())
|
||||||
|| ($a->keys()->diff($b->keys())->count() !== 0)
|
|| ($a->diff($b)->count() !== 0);
|
||||||
|| ($a->values()->diff($b->values())->count() !== 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -349,7 +349,7 @@ class HomeController extends Controller
|
|||||||
|
|
||||||
return Redirect::to('/')
|
return Redirect::to('/')
|
||||||
->withInput()
|
->withInput()
|
||||||
->with('updated',collect($dirty)->map(fn($key,$item)=>$o->getObject($item)));
|
->with('updated',collect($dirty)->map(fn($item,$key)=>$o->getObject(collect(explode(';',$key))->first())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -376,7 +376,7 @@ class HomeController extends Controller
|
|||||||
// If we are rendering a DN, rebuild our object
|
// If we are rendering a DN, rebuild our object
|
||||||
$o = config('server')->fetch($key['dn']);
|
$o = config('server')->fetch($key['dn']);
|
||||||
|
|
||||||
foreach (collect(old())->except(['key','step','_token','userpassword_hash']) as $attr => $value)
|
foreach (collect(old())->except(['key','dn','step','_token','userpassword_hash']) as $attr => $value)
|
||||||
$o->{$attr} = $value;
|
$o->{$attr} = $value;
|
||||||
|
|
||||||
return match ($key['cmd']) {
|
return match ($key['cmd']) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<p>{{ __('Entry updated') }}</p>
|
<p>{{ __('Entry updated') }}</p>
|
||||||
<ul style="list-style-type: square;">
|
<ul style="list-style-type: square;">
|
||||||
@foreach (session()->pull('updated') as $key => $o)
|
@foreach (session()->pull('updated') as $key => $o)
|
||||||
<li><abbr title="{{ $o->description }}">{{ $o->name }}</abbr>: {{ $o->values->map(fn($item,$key)=>$o->render_item_new($key))->join(',') }}</li>
|
<li><abbr title="{{ $o->description }}">{{ $o->name }}</abbr>: {{ $o->values->dot()->filter()->join(',') }}</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -50,8 +50,12 @@
|
|||||||
{{ $dotkey }}
|
{{ $dotkey }}
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<td>{{ (($r=$oo->render_item_old($dotkey)) !== NULL) ? $r : '['.strtoupper(__('New Value')).']' }}</td>
|
@if((! Arr::get($oo->values_old->dot(),$dotkey)) && (! Arr::get($oo->values->dot(),$dotkey)))
|
||||||
<td>{{ (($r=$oo->render_item_new($dotkey)) !== NULL) ? $r : '['.strtoupper(__('Deleted')).']' }}<input type="hidden" name="{{ $key }}[{{ collect(explode('.',$dotkey))->first() }}][]" value="{{ Arr::get($oo,$dotkey) }}"></td>
|
<td colspan="2" class="text-center">@lang('Ignoring blank value')</td>
|
||||||
|
@else
|
||||||
|
<td>{{ (($r=$oo->render_item_old($dotkey)) !== NULL) ? $r : '['.strtoupper(__('New Value')).']' }}</td>
|
||||||
|
<td>{{ (($r=$oo->render_item_new($dotkey)) !== NULL) ? $r : '['.strtoupper(__('Deleted')).']' }}<input type="hidden" name="{{ $key }}[{{ collect(explode('.',$dotkey))->first() }}][]" value="{{ Arr::get($oo,$dotkey) }}"></td>
|
||||||
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
Loading…
x
Reference in New Issue
Block a user