Improve rendering of objectclasses in entries

This commit is contained in:
Deon George 2025-03-03 16:37:48 +11:00
parent 9b3ef7a3ba
commit a59bbc8790
5 changed files with 26 additions and 14 deletions

View File

@ -15,8 +15,8 @@ use LdapRecord\LdapRecordException;
use LdapRecord\Query\ObjectNotFoundException;
use Nette\NotImplementedException;
use App\Classes\LDAP\Attribute\Factory;
use App\Classes\LDAP\{Attribute,Server};
use App\Classes\LDAP\Attribute\{Factory,Password};
use App\Classes\LDAP\Server;
use App\Classes\LDAP\Import\LDIF as LDIFImport;
use App\Classes\LDAP\Export\LDIF as LDIFExport;
use App\Exceptions\Import\{GeneralException,VersionException};
@ -101,10 +101,10 @@ class HomeController extends Controller
$x = $request->noheader
? (string)view(sprintf('components.attribute.widget.%s',$id))
->with('o',new Attribute($id,[]))
->with('o',Factory::create($id,[]))
->with('value',$request->value)
->with('loop',$xx)
: (new AttributeType(new Attribute($id,[]),TRUE,collect($request->oc ?: [])))->render();
: (new AttributeType(Factory::create($id,[]),TRUE,collect($request->oc ?: [])))->render();
return $x;
}
@ -249,7 +249,7 @@ class HomeController extends Controller
if ($value) {
$type = Arr::get($request->userpassword_hash,$key);
array_push($passwords,Attribute\Password::hash_id($type)->encode($value));
array_push($passwords,Password::hash_id($type)->encode($value));
}
}
$o->userpassword = $passwords;

12
public/css/custom.css vendored
View File

@ -15,4 +15,16 @@ div#userPassword .select2-container--bootstrap-5 .select2-selection {
.input-group:first-child .select2-container--bootstrap-5 .select2-selection {
border-bottom-right-radius: unset;
border-top-right-radius: unset;
}
div#objectClass .input-group-end:not(input.form-control) {
position: absolute;
right: 1em;
top: 0.5em;
z-index: 5;
}
input.form-control.input-group-end {
border-bottom-right-radius: 4px !important;
border-top-right-radius: 4px !important;
}

View File

@ -297,12 +297,8 @@ select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__
font-weight: 800;
}
div#objectClass .input-group-delete {
position: relative;
float: inline-end;
bottom: 30px;
right: 10px;
height: 5px;
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice {
padding: 0.25em 0.45em;
}
.input-group-text {

View File

@ -1,7 +1,7 @@
<!-- $o=Attribute::class -->
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
@foreach (old($o->name_lc,$o->values) as $value)
@if ($edit && ($value === NULL || (! $o->isStructural($value))))
@if ($edit)
<x-attribute.widget.objectclass :o="$o" :edit="$edit" :new="$new" :loop="$loop" :value="$value"/>
@else
{{ $value }}

View File

@ -1,12 +1,16 @@
<span id="objectclass_{{$value}}">
<div class="input-group has-validation">
<!-- @todo Have an "x" to remove the entry, we need an event to process the removal, removing any attribute values along the way -->
<input type="text" @class(['form-control','is-invalid'=>($e=$errors->get($o->name_lc.'.'.$loop->index)),'mb-1','border-focus'=>$o->values->contains($value)]) name="{{ $o->name_lc }}[]" value="{{ $value }}" placeholder="{{ Arr::get($o->values,$loop->index,'['.__('NEW').']') }}" @readonly(true)>
<input type="text" @class(['form-control','input-group-end','is-invalid'=>($e=$errors->get($o->name_lc.'.'.$loop->index)),'mb-1','border-focus'=>$o->values->contains($value)]) name="{{ $o->name_lc }}[]" value="{{ $value }}" placeholder="{{ Arr::get($o->values,$loop->index,'['.__('NEW').']') }}" @readonly(true)>
@if ($o->isStructural($value))
<span class="input-group-end text-black-50">structural</span>
@else
<span class="input-group-end"><i class="fas fa-fw fa-xmark"></i></span>
@endif
<div class="invalid-feedback pb-2">
@if($e)
{{ join('|',$e) }}
@endif
</div>
</div>
<span class="input-group-delete"><i class="fas fa-fw fa-xmark"></i></span>
</span>