Update PM\PBlock page

This commit is contained in:
Visman 2021-11-15 21:35:48 +07:00
parent 62b5af7c3e
commit ea34a2f266
3 changed files with 41 additions and 7 deletions

View file

@ -111,9 +111,26 @@ class PBlock extends Model
*/
protected function getlist(): array
{
return isset($this->repository[$this->user->id])
? $this->c->users->loadByIds($this->repository[$this->user->id])
: [];
if (empty($this->repository[$this->user->id])) {
return [];
}
$list = $this->c->users->loadByIds($this->repository[$this->user->id]);
foreach ($list as &$user) {
if ($user instanceof User) {
$user->linkPMUnblock = $this->c->Router->link(
'PMAction',
[
'action' => Cnst::ACTION_BLOCK,
'more1' => $user->id,
]
);
}
}
unset($user);
return $list;
}
/**

View file

@ -1,16 +1,16 @@
@extends ('layouts/pm')
<section id="fork-pm-bl" class="f-pm f-forum @empty ($p->blockList) f-pm-bl-empty @endempty">
<section id="fork-pm-bl" class="f-pm f-pm-bl-list @empty ($p->blockList) f-pm-bl-empty @endempty">
<h2>{!! __('Blocked users title') !!}</h2>
@if (empty($p->blockList) && $iswev = ['i' => ['No blocked users']])
@include ('layouts/iswev')
@else
<div>
<fieldset>
<ol>
<ol id="fork-pm-bl-ol">
@foreach ($p->blockList as $user)
<li>
<li class="f-pm-bl-li">
<a href="{{ $user->link }}">{{ $user->username }}</a>
<a class="f-btn" href="{{ '?' }}" title="{{ __('Unblock') }}">{!! __('Unblock') !!}</a>
<a class="f-btn" href="{{ $user->linkPMUnblock }}" title="{{ __(['Unblock user %s', $user->username]) }}">{!! __('Unblock') !!}</a>
</li>
@endforeach
</ol>

View file

@ -2420,6 +2420,23 @@ body,
width: auto;
}
#forkpm #fork-pm-bl-ol {
padding-top: 0.3125rem;
display: flex;
flex-wrap: wrap;
gap: 0.3125rem;
}
#forkpm .f-pm-bl-li {
display: flex;
flex-wrap: wrap;
padding: 0.3125rem 0.625rem 0.625rem;
justify-content: space-between;
align-items: center;
flex: 1 1 25rem;
border-bottom: 0.0625rem dotted;
}
@media screen and (min-width: 36rem) {
#forkpm > .f-pmconfig-form dl {
display: flex;