From b2e46d62154faf28c3c17e2b775c47d11e38ee56 Mon Sep 17 00:00:00 2001 From: maTh Date: Sun, 17 Jul 2022 22:54:24 +0200 Subject: Improved: Article header (#4101) * First draft for normal view * Revert changes on the entry header * Update normal.phtml * Update normal.phtml * RTL CSS * CSS fixes * Better tags style * fix * Update swage.scss * fix * Update swage.scss * fixed .content header * font-size in rem * improved template * dropdown menu if more than 7 tags * configuration: show tags in topline * Simplify loop logic * Minor space * config tags via reading (i18n still missed) * fixed the whitespaces * optimizations * optimize header+footer * Update normal.phtml * fix css * new config: show author+date in footer * config feed name display * improve HTML * fix whitespaces * i18n * i18n: German translations * fix i18n German * fixed: uncouple from bottomline config * reverted: tobline_tags * equalities * fixed: author in footer * fixed data-leave-validation * improved max numbers i18n label * Config works now also in the reader view * fix: footer border * reader view: style article-header-topline * fixed whitespace * i18n fr * Minor i18n fr * Fix mistake i18n fr * i18n fr more precise expression * Fix JavaScript * removed the link icon in the title * clean CSS Co-authored-by: Alexandre Alapetite --- app/views/index/normal.phtml | 185 ++++++++++++++++++++++++++++++------ app/views/index/reader.phtml | 219 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 332 insertions(+), 72 deletions(-) (limited to 'app/views/index') diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index da2388e8f..179c0f86d 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -13,6 +13,7 @@ $display_others = true; $hidePosts = !FreshRSS_Context::$user_conf->display_posts; $lazyload = FreshRSS_Context::$user_conf->lazyload; $content_width = FreshRSS_Context::$user_conf->content_width; +$MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max; $today = @strtotime('today'); ?> @@ -72,44 +73,168 @@ $today = @strtotime('today'); ?>" id="flux_entry->id() ?>" data-feed="feed->id() ?>">renderHelper('index/normal/entry_header'); - ?>
+ $tags = null; + $firstTags = array(); + $remainingTags = array(); + + if (FreshRSS_Context::$user_conf->show_tags === 'h' || FreshRSS_Context::$user_conf->show_tags === 'f' || FreshRSS_Context::$user_conf->show_tags === 'b') { + $tags = $this->entry->tags(); + if (!empty($tags)) { + if ($MAX_TAGS_DISPLAYED > 0) { + $firstTags = array_slice($tags, 0, $MAX_TAGS_DISPLAYED); + $remainingTags = array_slice($tags, $MAX_TAGS_DISPLAYED); + } else { + $firstTags = $tags; + } + } + } + ?>
-

entry->title() ?>

-
- -
entry->date() ?>
- + show_feed_name === 't') { ?> + + + show_tags === 'h' || FreshRSS_Context::$user_conf->show_tags === 'b') { ?> +
+
  • #
  • +
  • + +
  • + +
+
+ +

entry->title() ?>

+ show_author_date === 'h' || FreshRSS_Context::$user_conf->show_author_date === 'b') { ?> +
+ show_feed_name === 'a') { ?> + + entry->authors(); - if (!empty($authors) && is_array($authors)): - $first = true; - ?> -
- "> - -
-
+ if (!empty($authors) && is_array($authors)) { + ?> +
+ + 'author:"' . htmlspecialchars_decode($author, ENT_QUOTES) . '"'])); + ?> + + +
+ +
entry->date() ?>
+
+ +
entry->content()) : $this->entry->content(); ?>
-
show_author_date === 'f' || FreshRSS_Context::$user_conf->show_author_date === 'b'; + $display_tags = FreshRSS_Context::$user_conf->show_tags === 'f' || FreshRSS_Context::$user_conf->show_tags === 'b'; - $this->renderHelper('index/normal/entry_bottom'); - - ?>
+ if ($display_authors_date || $display_tags) { + ?> +
+ +
+ show_feed_name === 'a') { ?> + + entry->authors(); + if (!empty($authors) && is_array($authors)) { + ?> +
+ + 'author:"' . htmlspecialchars_decode($author, ENT_QUOTES) . '"'])); + ?> + + +
+ +
entry->date() ?>
+
+ +
+
  • #
  • +
  • + +
  • + +
+
+ +
+ +
renderHelper('index/normal/entry_bottom'); + ?> +
callbackBeforeEntries, $this); $lazyload = FreshRSS_Context::$user_conf->lazyload; $content_width = FreshRSS_Context::$user_conf->content_width; +$MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max; ?>
@@ -27,52 +28,186 @@ $content_width = FreshRSS_Context::$user_conf->content_width; if ($item == null) { continue; } + $this->entry = $item; + + $tags = null; + $firstTags = array(); + $remainingTags = array(); + + if (FreshRSS_Context::$user_conf->show_tags == 'h' || FreshRSS_Context::$user_conf->show_tags == 'f' || FreshRSS_Context::$user_conf->show_tags == 'b') { + $tags = $this->entry->tags(); + if (!empty($tags)) { + if ($MAX_TAGS_DISPLAYED > 0) { + $firstTags = array_slice($tags, 0, $MAX_TAGS_DISPLAYED); + $remainingTags = array_slice($tags, $MAX_TAGS_DISPLAYED); + } else { + $firstTags = $tags; + } + } + } ?>
-
+
+
- categories, $item->feed()); //We most likely already have the feed object in cache - if (empty($feed)) $feed = $item->feed(true); - $favoriteUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id())); - if ($item->isFavorite()) { - $favoriteUrl['params']['is_favorite'] = 0; - } - $readUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id())); - if ($item->isRead()) { - $readUrl['params']['is_read'] = 0; - } - ?> - - isRead() ? 'read' : 'unread') ?> - isFavorite() ? 'starred' : 'non-starred') ?> - - show_favicons): - ?>✇name() ?> - -

title() ?>

+
+ categories, $item->feed()); //We most likely already have the feed object in cache + if (empty($feed)) $feed = $item->feed(true); + $favoriteUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id())); + if ($item->isFavorite()) { + $favoriteUrl['params']['is_favorite'] = 0; + } + $readUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id())); + if ($item->isRead()) { + $readUrl['params']['is_read'] = 0; + } + ?> +
+ + isRead() ? 'read' : 'unread') ?> + isFavorite() ? 'starred' : 'non-starred') ?> + + show_feed_name === 't') { ?> + + show_favicons): ?> + ✇name() ?> + +
+ + show_tags === 'h' || FreshRSS_Context::$user_conf->show_tags === 'b') { ?> +
+
  • #
  • authors(); - if (is_array($authors)): - $first = true; - foreach ($authors as $author): - echo $first ? _t('gen.short.by_author') . ' ' : '· '; - $first = false; - ?> - + if (!empty($remainingTags)) { // more than 7 tags: show dropdown menu ?> +
  • + +
  • + +
+
+ + +

title() ?>

+ show_author_date === 'h' || FreshRSS_Context::$user_conf->show_author_date === 'b') { ?> +
+ show_feed_name === 'a') { ?> + + +
authors(); + if (is_array($authors)) { + foreach ($authors as $author) { + ?> + + + + +
+
+ +
+
+ +
+ +
+ content() ?> +
- content() ?> -
-
+ $display_authors_date = FreshRSS_Context::$user_conf->show_author_date === 'f' || FreshRSS_Context::$user_conf->show_author_date === 'b'; + $display_tags = FreshRSS_Context::$user_conf->show_tags === 'f' || FreshRSS_Context::$user_conf->show_tags === 'b'; + + if ($display_authors_date || $display_tags) { + ?> +
+ +
+ show_feed_name === 'a') { ?> + + +
authors(); + if (is_array($authors)) { + foreach ($authors as $author) { + ?> + + + + +
+
+ +
+
+ +
+
  • #
  • +
  • + +
  • + +
+
+ +
+ + +