Visman 7 vuotta sitten
vanhempi
commit
d4e56d515a
3 muutettua tiedostoa jossa 23 lisäystä ja 5 poistoa
  1. 16 4
      app/Models/Page.php
  2. 6 0
      app/Models/Pages/Search.php
  3. 1 1
      app/templates/layouts/main.tpl

+ 16 - 4
app/Models/Page.php

@@ -74,13 +74,25 @@ class Page extends Model
 
         if ($this->user->g_read_board == '1' && $this->user->g_search == '1') {
             $sub = [];
-            $sub['latest']     = [$r->link('SearchAction', ['action' => 'latest_active_topics']), 'Latest active topics', 'Find latest active topics'];
+            $sub['latest'] = [
+                $r->link('SearchAction', ['action' => 'latest_active_topics']),
+                'Latest active topics',
+                'Find latest active topics',
+            ];
             if (! $this->user->isGuest) {
-                $sub['with-your-posts'] = [$r->link('SearchAction', ['action' => 'topics_with_your_posts']), 'Topics with your posts', 'Find topics with your posts'];
+                $sub['with-your-posts'] = [
+                    $r->link('SearchAction', ['action' => 'topics_with_your_posts']),
+                    'Topics with your posts',
+                    'Find topics with your posts',
+                ];
             }
-            $sub['unanswered'] = [$r->link('SearchAction', ['action' => 'unanswered_topics']), 'Unanswered topics', 'Find unanswered topics'];
+            $sub['unanswered'] = [
+                $r->link('SearchAction', ['action' => 'unanswered_topics']),
+                'Unanswered topics',
+                'Find unanswered topics',
+            ];
 
-            $nav['search']     = [$r->link('Search'), 'Search', null, $sub];
+            $nav['search'] = [$r->link('Search'), 'Search', null, $sub];
         }
 
         if ($this->user->isGuest) {

+ 6 - 0
app/Models/Pages/Search.php

@@ -394,6 +394,11 @@ class Search extends Page
         $asTopicsList = true;
         $list         = false;
         $uid          = isset($args['uid']) ? (int) $args['uid'] : null;
+        $subIndex = [
+            'topics_with_your_posts' => 'with-your-posts',
+            'latest_active_topics'   => 'latest',
+            'unanswered_topics'      => 'unanswered',
+        ];
         switch ($action) {
             case 'search':
                 if (1 === $model->showAs) {
@@ -421,6 +426,7 @@ class Search extends Page
                 $model->name       = \ForkBB\__('Quick search ' . $action);
                 $model->linkMarker = 'SearchAction';
                 $model->linkArgs   = ['action' => $action];
+                $this->fSubIndex   = $subIndex[$action];
                 break;
 #            default:
 #                throw new InvalidArgumentException('Unknown action: ' . $action);

+ 1 - 1
app/templates/layouts/main.tpl

@@ -34,7 +34,7 @@
       @foreach ($val[3] as $key => $val)
               <li id="id-nav-{!! $key !!}" class="f-menu-item">
         @if (isset($val[0]))
-                <a class="f-menu-a" href="{!! __($val[0]) !!}" title="{!! __($val[2]) !!}">{!! __($val[1]) !!}</a>
+                <a class="f-menu-a @if ($key == $p->fSubIndex) active @endif" href="{!! __($val[0]) !!}" title="{!! __($val[2]) !!}">{!! __($val[1]) !!}</a>
         @else
                 <span class="f-menu-span">{!! __($val[1]) !!}</span>
         @endif