index.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php use App\Utils\Url, App\Utils\Html, App\Utils\Date ?>
  2. <?php $app->render('layouts/header', ['title' => 'Notes']) ?>
  3. <?php $app->render('layouts/navbar', ['app' => $app]) ?>
  4. <h1>Notes</h1>
  5. <?php $app->render('layouts/alerts/error', ['error' => $error]) ?>
  6. <?php $app->render('layouts/alerts/success', ['success' => $success]) ?>
  7. <a href="<?= Url::build('notes/new') ?>" class="btn btn-default btn-ghost">
  8. Create note
  9. </a>
  10. <?php foreach ($notes as $note): ?>
  11. <hr>
  12. <article class="terminal-card">
  13. <header>
  14. <?= Html::escape($note['title']) ?>
  15. </header>
  16. <div>
  17. <p>Created: <?= Date::humanize($note['created_at']) ?></p>
  18. <p>Updated: <?= Date::humanize($note['updated_at']) ?></p>
  19. <p>
  20. <?php foreach ($note['tags'] as $tag): ?>
  21. <a href="">
  22. <?= Html::escape($tag['name']) ?>
  23. </a>
  24. <?php endforeach ?>
  25. </p>
  26. <footer>
  27. <a target="_blank" href="<?= Url::build(['notes', $note['id']]) ?>" class="btn btn-default btn-ghost">
  28. View
  29. </a>
  30. <a href="<?= Url::build(['notes', 'edit', $note['id']]) ?>" class="btn btn-primary btn-ghost">
  31. Edit
  32. </a>
  33. <a href="<?= Url::build(['notes', 'delete', $note['id']]) ?>" class="btn btn-error btn-ghost">
  34. Delete
  35. </a>
  36. </footer>
  37. </div>
  38. </article>
  39. <?php endforeach ?>
  40. <?php $app->render('layouts/footer') ?>