aboutsummaryrefslogtreecommitdiff
path: root/views/home
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2025-02-01 10:30:45 +0200
committerSyndamia <kamen@syndamia.com>2025-02-01 10:30:45 +0200
commitc8cdadfabea0120526a6e0366710f9256fc999b4 (patch)
treeb4acc126498e6dbf6187722409f7873b654d2a7a /views/home
parentc4f387d21147b91e708345fc6f7405fb1a2b6271 (diff)
downloadnowayforward_human-c8cdadfabea0120526a6e0366710f9256fc999b4.tar
nowayforward_human-c8cdadfabea0120526a6e0366710f9256fc999b4.tar.gz
nowayforward_human-c8cdadfabea0120526a6e0366710f9256fc999b4.zip
feat(views/home): Move single webpage card code to a separate file
Diffstat (limited to 'views/home')
-rw-r--r--views/home/card.php15
-rw-r--r--views/home/index.php33
2 files changed, 21 insertions, 27 deletions
diff --git a/views/home/card.php b/views/home/card.php
new file mode 100644
index 0000000..de7d6a6
--- /dev/null
+++ b/views/home/card.php
@@ -0,0 +1,15 @@
+<section class="card" onclick="window.location.href = '<?= $goto ?>'">
+ <section class="quickinfo">
+ <a href="<?= $page->URL ?>"><?= $page->URL ?></a>
+ <span class="float-right"><?= $page->Date ?></span>
+ </section>
+ <section class="title">
+ <img src="<?= '/archives/' . $page->FaviconPath ?>"></span>
+ <span><?= $page->Title ?></span>
+ </section>
+ <section>
+ <strong>Visits: <?= $page->Visits ?></strong>
+ <strong><!-- Archives count --></strong>
+ </section>
+</section>
+
diff --git a/views/home/index.php b/views/home/index.php
index e14e23a..036a79a 100644
--- a/views/home/index.php
+++ b/views/home/index.php
@@ -11,34 +11,13 @@
<h1>Most popular archives</h1>
-<?php foreach(Database\Webpage::fromDBmostVisited(10) as $page): ?>
- <section class="card" onclick="goto_archive('<?= $page->URL ?>')">
- <section class="quickinfo">
- <a href="<?= $page->URL ?>"><?= $page->URL ?></a>
- <span class="float-right"><?= $page->Date ?></span>
- </section>
- <section class="title">
- <img src="<?= '/archives/' . $page->FaviconPath ?>"></span>
- <span><?= $page->Title ?></span>
- </section>
- <section>
- <strong>Visits: <?= $page->Visits ?></strong>
- <strong><!-- Archives count --></strong>
- </section>
- <script type="text/javascript">
- function open_archive(url) {
- window.location.href = '/archive/' + url;
- }
- </script>
- </section>
-<?php endforeach; ?>
+<?php
+ foreach(Database\Webpage::fromDBmostVisited(10) as $page) {
+ $goto = "/archive/?url=$page->URL";
+ include __DIR__ . '/card.php';
+ }
+?>
<h1>...</h1>
<div class="card-blank-afterspace"></div>
-
-<script type="text/javascript">
- function goto_archive(uri) {
- window.location.href = '/archive/?url=' + uri;
- }
-</script>