highlight selected tag
authorChristian Weiske <cweiske@cweiske.de>
Mon, 27 Oct 2014 21:33:52 +0000 (22:33 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 27 Oct 2014 21:33:52 +0000 (22:33 +0100)
controller/guicontroller.php
templates/appnavigation.php

index 97a7f10c9289f2622b6e77eabc531ca882744583..4f74ab53f1fa3e81f9b29e67a4e64f328b79463f 100644 (file)
@@ -99,7 +99,12 @@ class GuiController extends Controller
             )
         );
 
-        $this->addNavigation($res);
+        $selectedRawtag = null;
+        if (count($note->tags) > 0) {
+            $selectedRawtag = $note->tags[0];
+        }
+
+        $this->addNavigation($res, $selectedRawtag);
         return $res;
     }
 
@@ -233,6 +238,7 @@ class GuiController extends Controller
                     'href' => $this->urlGen->linkToRoute(
                         'grauphel.gui.tag', array('rawtag' => $rawtag)
                     ),
+                    'selected' => $rawtag == $selectedRawtag,
                 );
             }
         }
index b0657e113b8f64efa0f55721308d145b56e095bf..04eb86c9b7cb42deec8ebe5b328258ca0df9e5d2 100644 (file)
@@ -1,7 +1,7 @@
 <div id="app-navigation">
   <ul>
     <?php foreach ($_['tags'] as $tag) { ?>
-      <li data-id="<?php p($tag['id']) ?>"><a href="<?php p(isset($tag['href']) ? $tag['href'] : '#') ?>"><?php p($tag['name']);?></a></li>
+      <li data-id="<?php p($tag['id']) ?>" <?php $tag['selected'] && print ' class="selected"'; ?>><a href="<?php p(isset($tag['href']) ? $tag['href'] : '#') ?>"><?php p($tag['name']);?></a></li>
     <?php } ?>
   </ul>