diff options
| author | 2024-12-05 16:19:27 +0100 | |
|---|---|---|
| committer | 2024-12-05 16:19:27 +0100 | |
| commit | 84642037350393625f0a4866ed74f564ef37973b (patch) | |
| tree | bdb64ece059a70cfc61d14abedede3d1d1f88062 /app/views/index | |
| parent | 8e41190746c8e51d0c0dd9b52f1d8c5f44f93dde (diff) | |
Rework UI authors (#7054)
Add separators, and mutualise code
fix https://github.com/FreshRSS/FreshRSS/issues/7032
Diffstat (limited to 'app/views/index')
| -rw-r--r-- | app/views/index/normal.phtml | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index 3923d774b..4ebcb28a6 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -119,22 +119,14 @@ $today = @strtotime('today'); <img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><span><?= $this->feed->name() ?></span></a> </div> - <?php + <?php } + if (!empty($this->entry->authors())) { + $this->renderHelper('index/authors'); + if ($this->feed === null || $this->entry === null) { + throw new Exception('Unexpected side effect!'); // Should never occur. Only for PHPStan + } } - - $authors = $this->entry->authors(); - if (!empty($authors) && is_array($authors)) { ?> - <div class="author"> - <?= _t('gen.short.by_author') ?> - <?php - foreach ($authors as $author) { - $href = Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:"' . htmlspecialchars_decode($author, ENT_QUOTES) . '"'])); - ?> - <a href="<?= $href ?>" title="<?= _t('gen.action.filter') ?>"><?= $author ?></a> - <?php } ?> - </div> - <?php } ?> <div class="date"><?= $this->entry->date() ?></div> </div> <?php } ?> @@ -158,21 +150,14 @@ $today = @strtotime('today'); <img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><span><?= $this->feed->name() ?></span></a> </div> - <?php - } - $authors = $this->entry->authors(); - if (!empty($authors) && is_array($authors)) { + <?php } + if (!empty($this->entry->authors())) { + $this->renderHelper('index/authors'); + if ($this->feed === null || $this->entry === null) { + throw new Exception('Unexpected side effect!'); // Should never occur. Only for PHPStan + } + } ?> - <div class="author"> - <?= _t('gen.short.by_author') ?> - <?php - foreach ($authors as $author) { - $href = Minz_Url::display(Minz_Request::modifiedCurrentRequest(['search' => 'author:"' . htmlspecialchars_decode($author, ENT_QUOTES) . '"'])); - ?> - <a href="<?= $href ?>" title="<?= _t('gen.action.filter') ?>"><?= $author ?></a> - <?php } ?> - </div> - <?php } ?> <div class="date"><?= $this->entry->date() ?></div> </div> <?php |
