Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp: Display the total number of links in the news #723

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified locales/fr_FR/LC_MESSAGES/main.mo
Binary file not shown.
44 changes: 22 additions & 22 deletions locales/fr_FR/LC_MESSAGES/main.po
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Flus\n"
"POT-Creation-Date: 2024-10-17 18:52+0200\n"
"PO-Revision-Date: 2024-10-17 18:52+0200\n"
"POT-Creation-Date: 2024-10-31 15:15+0100\n"
"PO-Revision-Date: 2024-10-31 15:15+0100\n"
"Last-Translator: Marien Fressinaud <dev@marienfressinaud.fr>\n"
"Language-Team: \n"
"Language: fr_FR\n"
Expand Down Expand Up @@ -722,8 +722,8 @@ msgstr "Placez ici les liens que vous souhaitez consulter plus tard."

#: views/bookmarks/index.phtml:28 views/collections/_collection.phtml:31
#: views/collections/show.phtml:211 views/collections/show_public.phtml:226
#: views/links/searches/show.phtml:106 views/news/index.phtml:115
#: views/read/index.phtml:29
#: views/links/searches/show.phtml:106 views/news/index.phtml:18
#: views/news/index.phtml:121 views/read/index.phtml:29
#, php-format
msgid "%s link"
msgid_plural "%s links"
Expand Down Expand Up @@ -1075,8 +1075,8 @@ msgstr "Publiée par %s"
#: views/collections/show.phtml:74 views/collections/show_public.phtml:112
#: views/links/_link.phtml:231 views/links/_link.phtml:235
#: views/links/show.phtml:131 views/links/show.phtml:135
#: views/news/index.phtml:41 views/news/index.phtml:129
#: views/news/index.phtml:213
#: views/news/index.phtml:47 views/news/index.phtml:135
#: views/news/index.phtml:220
msgid "Actions"
msgstr "Actions"

Expand Down Expand Up @@ -1144,13 +1144,13 @@ msgstr ""
msgid "Copy the link"
msgstr "Copier le lien"

#: views/collections/show_public.phtml:165 views/news/index.phtml:56
#: views/news/index.phtml:145 views/news/index.phtml:226
#: views/collections/show_public.phtml:165 views/news/index.phtml:62
#: views/news/index.phtml:151 views/news/index.phtml:233
msgid "Mark all as read"
msgstr "Tout marquer comme lu"

#: views/collections/show_public.phtml:175 views/news/index.phtml:85
#: views/news/index.phtml:177 views/news/index.phtml:253
#: views/collections/show_public.phtml:175 views/news/index.phtml:91
#: views/news/index.phtml:183 views/news/index.phtml:260
msgid "Remove the links from the news"
msgstr "Retirer les liens du journal"

Expand Down Expand Up @@ -2100,51 +2100,51 @@ msgstr "Toujours rien&nbsp;? Avez-vous vérifié votre spam&nbsp;?"
msgid "Didn’t receive the email? Resend it"
msgstr "Courriel non reçu ? Renvoyer"

#: views/news/index.phtml:23
#: views/news/index.phtml:29
msgid "today"
msgstr "aujourd’hui"

#: views/news/index.phtml:25
#: views/news/index.phtml:31
msgid "yesterday"
msgstr "hier"

#: views/news/index.phtml:47
#: views/news/index.phtml:53
msgid "Actions on the day"
msgstr "Actions pour la journée"

#: views/news/index.phtml:67 views/news/index.phtml:157
#: views/news/index.phtml:236
#: views/news/index.phtml:73 views/news/index.phtml:163
#: views/news/index.phtml:243
msgid "Read the links later"
msgstr "Lire les liens plus tard"

#: views/news/index.phtml:76 views/news/index.phtml:167
#: views/news/index.phtml:245
#: views/news/index.phtml:82 views/news/index.phtml:173
#: views/news/index.phtml:252
msgid ""
"You’ll remove all the news links, this action cannot be canceled. Are you "
"sure?"
msgstr ""
"Vous allez retirer tous les liens du journal, cette action ne peut pas être "
"annulée. Confirmez-vous ?"

#: views/news/index.phtml:135
#: views/news/index.phtml:141
msgid "Actions on the feed"
msgstr "Actions pour le flux"

#: views/news/index.phtml:218
#: views/news/index.phtml:225
msgid "Empty the news"
msgstr "Vider le journal"

#: views/news/index.phtml:261
#: views/news/index.phtml:268
msgid ""
"Fill your news feed with the content published by the feeds that you follow."
msgstr ""
"Remplissez votre journal avec le contenu publié par les flux que vous suivez."

#: views/news/index.phtml:266
#: views/news/index.phtml:273
msgid "There are no relevant links to suggest at this time."
msgstr "Il n'y a aucun lien pertinent à vous proposer pour le moment."

#: views/news/index.phtml:286
#: views/news/index.phtml:293
msgid "Refresh the news"
msgstr "Rafraichir le journal"

Expand Down
11 changes: 11 additions & 0 deletions src/utils/LinksTimeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,15 @@ public function empty(): bool
{
return empty($this->dates_groups);
}

public function count(): int
{
$count = 0;

foreach ($this->dates_groups as $date_group) {
$count += $date_group->count();
}

return $count;
}
}
11 changes: 11 additions & 0 deletions src/utils/LinksTimeline/DateGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,15 @@ public function sourceGroups(): array
{
return utils\Sorter::localeSort($this->source_groups, 'title');
}

public function count(): int
{
$count = count($this->links);

foreach ($this->source_groups as $source_group) {
$count += $source_group->count();
}

return $count;
}
}
5 changes: 5 additions & 0 deletions src/utils/LinksTimeline/SourceGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ public function __construct(mixed $source)
$this->reference = "user#{$this->source->id}";
}
}

public function count(): int
{
return count($this->links);
}
}
5 changes: 5 additions & 0 deletions src/views/news/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
</div>

<?php if (!$links_timeline->empty()): ?>
<p class="collection__number-links">
<?php $count_links = $links_timeline->count(); ?>
<?= _nf('%s link', '%s links', $count_links, format_number($count_links)) ?>
</p>

<div data-controller="zindex-inverser">
<?php foreach ($links_timeline->datesGroups() as $date_group): ?>
<section class="group">
Expand Down
Loading