浏览代码

Fix main nav for PM

Visman 3 年之前
父节点
当前提交
f16a11cb08
共有 2 个文件被更改,包括 11 次插入2 次删除
  1. 10 1
      app/Models/Page.php
  2. 1 1
      app/templates/layouts/main.forkbb.php

+ 10 - 1
app/Models/Page.php

@@ -212,12 +212,21 @@ abstract class Page extends Model
             ];
 
             if ($this->user->usePM) {
+                $tmpPM = [];
+
+                if (1 !== $this->user->u_pm) {
+                    $tmpPM[] = 'pmoff';
+                }
+                if ($this->user->u_pm_num_new > 0) {
+                    $tmpPM[] = 'pmnew';
+                }
+
                 $navUser[self::FI_PM] = [
                     $r->link('PM'),
                     $this->user->u_pm_num_new > 0 ? ['PM %s', $this->user->u_pm_num_new] : 'PM',
                     'Private messages',
                     null,
-                    $this->user->u_pm_num_new > 0 ? 'newpm' : null,
+                    $tmpPM ?: null,
                 ];
             }
 

+ 1 - 1
app/templates/layouts/main.forkbb.php

@@ -52,7 +52,7 @@
     @if ($p->fNavigationUser)
         <ul class="f-menu-user-items">
         @foreach ($p->fNavigationUser as $key => $val)
-          <li id="fork-nav-{{ $key }}" class="f-menu-item @if ($val[4]) f-mi-{{ $val[4] }} @endif"><!-- inline -->
+          <li id="fork-nav-{{ $key }}" class="f-menu-item @if ($val[4]) f-mi-{{ \implode(' f-mi-', $val[4]) }} @endif"><!-- inline -->
             <a class="f-menu-a @if ($key == $p->fIndex) active @endif" href="{{ $val[0] }}" @if ($val[2]) title="{{ __($val[2]) }}" @endif>
               <span class="f-menu-span">{!! __($val[1]) !!}</span>
             </a>