Skip to content

Commit a59bbc8

Browse files
committed
Improve rendering of objectclasses in entries
1 parent 9b3ef7a commit a59bbc8

File tree

5 files changed

+26
-14
lines changed

5 files changed

+26
-14
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
use LdapRecord\Query\ObjectNotFoundException;
1616
use Nette\NotImplementedException;
1717

18-
use App\Classes\LDAP\Attribute\Factory;
19-
use App\Classes\LDAP\{Attribute,Server};
18+
use App\Classes\LDAP\Attribute\{Factory,Password};
19+
use App\Classes\LDAP\Server;
2020
use App\Classes\LDAP\Import\LDIF as LDIFImport;
2121
use App\Classes\LDAP\Export\LDIF as LDIFExport;
2222
use App\Exceptions\Import\{GeneralException,VersionException};
@@ -101,10 +101,10 @@ public function entry_attr_add(Request $request,string $id): string
101101

102102
$x = $request->noheader
103103
? (string)view(sprintf('components.attribute.widget.%s',$id))
104-
->with('o',new Attribute($id,[]))
104+
->with('o',Factory::create($id,[]))
105105
->with('value',$request->value)
106106
->with('loop',$xx)
107-
: (new AttributeType(new Attribute($id,[]),TRUE,collect($request->oc ?: [])))->render();
107+
: (new AttributeType(Factory::create($id,[]),TRUE,collect($request->oc ?: [])))->render();
108108

109109
return $x;
110110
}
@@ -249,7 +249,7 @@ public function entry_pending_update(EntryRequest $request)
249249

250250
if ($value) {
251251
$type = Arr::get($request->userpassword_hash,$key);
252-
array_push($passwords,Attribute\Password::hash_id($type)->encode($value));
252+
array_push($passwords,Password::hash_id($type)->encode($value));
253253
}
254254
}
255255
$o->userpassword = $passwords;

public/css/custom.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,16 @@ div#userPassword .select2-container--bootstrap-5 .select2-selection {
1515
.input-group:first-child .select2-container--bootstrap-5 .select2-selection {
1616
border-bottom-right-radius: unset;
1717
border-top-right-radius: unset;
18+
}
19+
20+
div#objectClass .input-group-end:not(input.form-control) {
21+
position: absolute;
22+
right: 1em;
23+
top: 0.5em;
24+
z-index: 5;
25+
}
26+
27+
input.form-control.input-group-end {
28+
border-bottom-right-radius: 4px !important;
29+
border-top-right-radius: 4px !important;
1830
}

public/css/fixes.css

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,8 @@ select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__
297297
font-weight: 800;
298298
}
299299

300-
div#objectClass .input-group-delete {
301-
position: relative;
302-
float: inline-end;
303-
bottom: 30px;
304-
right: 10px;
305-
height: 5px;
300+
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice {
301+
padding: 0.25em 0.45em;
306302
}
307303

308304
.input-group-text {

resources/views/components/attribute/objectclass.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- $o=Attribute::class -->
22
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
33
@foreach (old($o->name_lc,$o->values) as $value)
4-
@if ($edit && ($value === NULL || (! $o->isStructural($value))))
4+
@if ($edit)
55
<x-attribute.widget.objectclass :o="$o" :edit="$edit" :new="$new" :loop="$loop" :value="$value"/>
66
@else
77
{{ $value }}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
<span id="objectclass_{{$value}}">
22
<div class="input-group has-validation">
33
<!-- @todo Have an "x" to remove the entry, we need an event to process the removal, removing any attribute values along the way -->
4-
<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)>
4+
<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)>
5+
@if ($o->isStructural($value))
6+
<span class="input-group-end text-black-50">structural</span>
7+
@else
8+
<span class="input-group-end"><i class="fas fa-fw fa-xmark"></i></span>
9+
@endif
510
<div class="invalid-feedback pb-2">
611
@if($e)
712
{{ join('|',$e) }}
813
@endif
914
</div>
1015
</div>
11-
<span class="input-group-delete"><i class="fas fa-fw fa-xmark"></i></span>
1216
</span>

0 commit comments

Comments
 (0)