Prechádzať zdrojové kódy

Update PM\PBlock page

Visman 3 rokov pred
rodič
commit
ea34a2f266

+ 20 - 3
app/Models/PM/PBlock.php

@@ -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;
     }
 
     /**

+ 4 - 4
app/templates/pm/block.forkbb.php

@@ -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>

+ 17 - 0
public/style/ForkBB/style.css

@@ -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;