From a59bbc8790bd5c271e00080b0527efda91b45c9e Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 3 Mar 2025 16:37:48 +1100 Subject: [PATCH] Improve rendering of objectclasses in entries --- app/Http/Controllers/HomeController.php | 10 +++++----- public/css/custom.css | 12 ++++++++++++ public/css/fixes.css | 8 ++------ .../views/components/attribute/objectclass.blade.php | 2 +- .../attribute/widget/objectclass.blade.php | 8 ++++++-- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index a4123dc8..ed24a821 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -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; diff --git a/public/css/custom.css b/public/css/custom.css index 77f1db97..76c5a7b0 100644 --- a/public/css/custom.css +++ b/public/css/custom.css @@ -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; } \ No newline at end of file diff --git a/public/css/fixes.css b/public/css/fixes.css index 1c02a97d..070a2839 100644 --- a/public/css/fixes.css +++ b/public/css/fixes.css @@ -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 { diff --git a/resources/views/components/attribute/objectclass.blade.php b/resources/views/components/attribute/objectclass.blade.php index ff90a597..717ecd6c 100644 --- a/resources/views/components/attribute/objectclass.blade.php +++ b/resources/views/components/attribute/objectclass.blade.php @@ -1,7 +1,7 @@ @foreach (old($o->name_lc,$o->values) as $value) - @if ($edit && ($value === NULL || (! $o->isStructural($value)))) + @if ($edit) @else {{ $value }} diff --git a/resources/views/components/attribute/widget/objectclass.blade.php b/resources/views/components/attribute/widget/objectclass.blade.php index 3a8d3181..c0753e3d 100644 --- a/resources/views/components/attribute/widget/objectclass.blade.php +++ b/resources/views/components/attribute/widget/objectclass.blade.php @@ -1,12 +1,16 @@
- ($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)> + ($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)) + structural + @else + + @endif
@if($e) {{ join('|',$e) }} @endif
-
\ No newline at end of file