color modified date as files app does it
authorChristian Weiske <cweiske@cweiske.de>
Tue, 28 Oct 2014 17:20:33 +0000 (18:20 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 28 Oct 2014 17:20:33 +0000 (18:20 +0100)
controller/guicontroller.php
grauphel.css
templates/tag.php

index 6fffcb2f7377db128d076d395e94d10156661c5b..127daafb1ada681d6b5f4f94c95c5c0b602a27f3 100644 (file)
@@ -157,6 +157,17 @@ class GuiController extends Controller
             }
         );
 
+        foreach ($notes as &$note) {
+            $diffInDays = intval(
+                (time() - strtotime($note['last-change-date'])) / 86400
+            );
+            $value = 0 + $diffInDays;
+            if ($value > 160) {
+                $value = 160;
+            }
+            $note['dateColor'] = '#' . str_repeat(sprintf('%02X', $value), 3);
+        }
+
         $res = new TemplateResponse('grauphel', 'tag');
         $res->setParams(
             array(
index 0cddce6fe6b165daa868e30f906ecbb26160c919..14eafb0d57e3917d9a52f972b96f21848a379687 100644 (file)
@@ -144,6 +144,10 @@ table.table td {
     background-position: 8px center;
     background-repeat: no-repeat;
 }
+#headerTitle {
+    /* let it take all available space */
+    width: 9999px;
+}
 
 a.action.delete, table.table form button.action.delete {
     position: absolute;
index b2cab023431375b005384020beb270bd9a125cb0..a8752a44a8a76df57651cd72ed0f4426ee552ad0 100644 (file)
@@ -9,8 +9,8 @@
   <table class="table" id="grauphel-notes">
    <thead>
     <tr>
-     <th>Title</th>
-     <th>Last change</th>
+     <th id="headerTitle">Title</th>
+     <th>Modified</th>
     </tr>
    </thead>
    <tbody>
@@ -20,7 +20,7 @@
       <td>
        <a class="cellclick" href="<?php p(OCP\Util::linkToRoute('grauphel.gui.note', array('guid' => $note['guid']))); ?>"><?php echo ($note['title']); ?></a>
       </td>
-      <td>
+      <td style="color: <?php echo p($note['dateColor']); ?>">
        <?php p(\OCP\Util::formatDate(strtotime($note['last-change-date']))); ?>
       </td>
      </tr>