diff options
| author | Syndamia <kamen@syndamia.com> | 2025-02-09 20:52:35 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2025-02-09 20:52:35 +0200 |
| commit | ae8b6f88a0c31703d5e846fd1717a26b74d5da3b (patch) | |
| tree | f4bbffc0670e46450acba673c819672b28d89f26 | |
| parent | aac3a0fa5072525edb4e271a61047624781567e4 (diff) | |
| download | nowayforward_human-ae8b6f88a0c31703d5e846fd1717a26b74d5da3b.tar nowayforward_human-ae8b6f88a0c31703d5e846fd1717a26b74d5da3b.tar.gz nowayforward_human-ae8b6f88a0c31703d5e846fd1717a26b74d5da3b.zip | |
feat: Better home cards, show total view count of pages
| -rw-r--r-- | models/webpage.php | 9 | ||||
| -rw-r--r-- | views/admin/index.php | 6 | ||||
| -rw-r--r-- | views/archive/index.php | 5 | ||||
| -rw-r--r-- | views/home/card.php | 4 | ||||
| -rw-r--r-- | views/styles.css | 16 |
5 files changed, 31 insertions, 9 deletions
diff --git a/models/webpage.php b/models/webpage.php index 90ffb45..a42c300 100644 --- a/models/webpage.php +++ b/models/webpage.php @@ -70,6 +70,15 @@ class Webpage extends Table { ); } + function totalViewCount() : int { + return Table::_get_all( + 'Webpages', + 'Database\Webpage', + "WHERE URL = \"$this->URL\"", + "SUM(Visits) as WID" + )[0]->WID; + } + function previousPageId() : int { $foundId = Table::_get_all( "Webpages", diff --git a/views/admin/index.php b/views/admin/index.php index e633d32..fa3fc0f 100644 --- a/views/admin/index.php +++ b/views/admin/index.php @@ -3,9 +3,11 @@ ?> <?php if ($user->Role === 'Admin'): ?> + <h1>Global settings</h1> + <h2>Change role</h2> - <form action="#" method="POST" class="font-115"> + <form action="#" method="POST" class="font-115 flex-row"> <input type="hidden" name="method" value="PATCH"> <?php if (isset($role_status)): ?> <?php if ($role_status !== ""): ?> @@ -30,7 +32,7 @@ <h2>Delete</h2> - <form action="/user/delete" method="GET" class="font-115"> + <form action="/user/delete" method="GET" class="font-115 flex-row"> <input type="text" name="username" placeholder="Username"> <input type="submit" value="Delete"> </form> diff --git a/views/archive/index.php b/views/archive/index.php index 11b4189..b39d641 100644 --- a/views/archive/index.php +++ b/views/archive/index.php @@ -20,8 +20,9 @@ <h1 id="page-header"><?= $page->URL ?></h1> <p id="page-info"> - Archived <b><?= count($archives) ?></b> times, - between + Viewed <b><?= $page->totalViewCount() ?></b> times, + accross <b><?= count($archives) ?></b> archives, + created between <b><?php echo end($archives)->Date; reset($archives); ?></b> and <b><?= current($archives)->Date ?></b> diff --git a/views/home/card.php b/views/home/card.php index de7d6a6..2711b4a 100644 --- a/views/home/card.php +++ b/views/home/card.php @@ -8,8 +8,8 @@ <span><?= $page->Title ?></span> </section> <section> - <strong>Visits: <?= $page->Visits ?></strong> - <strong><!-- Archives count --></strong> + <strong>Visits: <?= $page->totalViewCount() ?></strong> + <strong>Archives: <?= count($page->allArchives()) ?></strong> </section> </section> diff --git a/views/styles.css b/views/styles.css index 07564ea..3817e0e 100644 --- a/views/styles.css +++ b/views/styles.css @@ -12,7 +12,8 @@ --blue: #add8e6; --cherry: #c26979; - --card-expand-with: 6em; + --card-height: 7em; + --card-expand-with: 2.5em; } /* Global */ @@ -240,7 +241,7 @@ hr.new-section { background-image: url(/img/paper.jpg); background-repeat: repeat; - height: 8.5em; + height: var(--card-height); overflow: hidden; mask-image: linear-gradient( to top, @@ -261,9 +262,13 @@ hr.new-section { pointer-events: none; } +.card strong:not(:first-of-type) { + margin-left: 1em; +} + .card:hover { cursor: pointer; - height: calc(8.5em + var(--card-expand-with)); + height: calc(var(--card-height) + var(--card-expand-with)); } .card > .quickinfo { @@ -272,6 +277,11 @@ hr.new-section { border-bottom: 3px dotted #909090; } +.card > .title { + font-size: 1.2em; + margin-bottom: 0.5em; +} + .card > .title img { vertical-align: middle; height: 2em; |
