-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
imp: Group news and read links by dates
- Loading branch information
1 parent
e671774
commit f83a22d
Showing
9 changed files
with
240 additions
and
66 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: flusio\n" | ||
"POT-Creation-Date: 2024-03-24 20:14+0100\n" | ||
"PO-Revision-Date: 2024-03-24 20:14+0100\n" | ||
"POT-Creation-Date: 2024-03-25 15:13+0100\n" | ||
"PO-Revision-Date: 2024-03-25 15:13+0100\n" | ||
"Last-Translator: Marien Fressinaud <[email protected]>\n" | ||
"Language-Team: \n" | ||
"Language: fr_FR\n" | ||
|
@@ -50,7 +50,7 @@ msgstr "Afficher" | |
#: controllers/Feeds.php:107 controllers/Groups.php:90 | ||
#: controllers/Links.php:270 controllers/Links.php:442 | ||
#: controllers/Mastodon.php:211 controllers/Mastodon.php:297 | ||
#: controllers/News.php:75 controllers/Passwords.php:89 | ||
#: controllers/News.php:79 controllers/Passwords.php:89 | ||
#: controllers/Passwords.php:192 controllers/Registrations.php:103 | ||
#: controllers/Sessions.php:85 controllers/Support.php:70 | ||
#: controllers/collections/Filters.php:105 | ||
|
@@ -455,28 +455,28 @@ msgstr "plateforme inconnue" | |
msgid "%s on %s" | ||
msgstr "%s sur %s" | ||
|
||
#: utils/view_helpers.php:102 | ||
#: utils/view_helpers.php:81 | ||
msgid "< 1 min" | ||
msgstr "< 1 min" | ||
|
||
#: utils/view_helpers.php:104 | ||
#: utils/view_helpers.php:83 | ||
#, php-format | ||
msgid "%s min" | ||
msgstr "%s min" | ||
|
||
#: utils/view_helpers.php:222 | ||
#: utils/view_helpers.php:201 | ||
msgid "There are no relevant links to suggest at this time." | ||
msgstr "Il n'y a aucun lien pertinent à vous proposer pour le moment." | ||
|
||
#: utils/view_helpers.php:224 | ||
#: utils/view_helpers.php:203 | ||
#, php-format | ||
msgid "" | ||
"You can add links to <a href=\"%s\">your bookmarks</a> to read them later." | ||
msgstr "" | ||
"Vous pouvez placer des liens dans <a href=\"%s\">vos signets</a> pour les " | ||
"lire plus tard." | ||
|
||
#: utils/view_helpers.php:254 views/links/show.phtml:73 | ||
#: utils/view_helpers.php:233 views/links/show.phtml:73 | ||
msgid "you" | ||
msgstr "vous" | ||
|
||
|
@@ -1143,7 +1143,7 @@ msgstr "Régler pour le journal" | |
msgid "Copy the link" | ||
msgstr "Copier le lien" | ||
|
||
#: views/collections/show_public.phtml:165 views/news/index.phtml:52 | ||
#: views/collections/show_public.phtml:165 views/news/index.phtml:68 | ||
msgid "Mark all as read" | ||
msgstr "Tout marquer comme lu" | ||
|
||
|
@@ -2110,57 +2110,61 @@ msgstr "Toujours rien ? Avez-vous vérifié votre spam ?" | |
msgid "Didn’t receive the email? Resend it" | ||
msgstr "Courriel non reçu ? Renvoyer" | ||
|
||
#: views/news/index.phtml:41 | ||
#: views/news/index.phtml:21 views/read/index.phtml:38 | ||
msgid "Today" | ||
msgstr "Aujourd’hui" | ||
|
||
#: views/news/index.phtml:57 | ||
msgid "Empty the news" | ||
msgstr "Vider le journal" | ||
|
||
#: views/news/index.phtml:62 | ||
#: views/news/index.phtml:78 | ||
msgid "Read the links later" | ||
msgstr "Lire les liens plus tard" | ||
|
||
#: views/news/index.phtml:71 | ||
#: views/news/index.phtml:87 | ||
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:79 | ||
#: views/news/index.phtml:95 | ||
msgid "Never see the links again" | ||
msgstr "Ne plus revoir les liens" | ||
|
||
#: views/news/index.phtml:87 | ||
#: views/news/index.phtml:103 | ||
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:101 | ||
#: views/news/index.phtml:117 | ||
msgid "Refresh the news" | ||
msgstr "Rafraichir le journal" | ||
|
||
#: views/news/index.phtml:106 | ||
#: views/news/index.phtml:122 | ||
msgid "Fill the news with…" | ||
msgstr "Remplissez votre journal avec…" | ||
|
||
#: views/news/index.phtml:129 | ||
#: views/news/index.phtml:145 | ||
msgid "the latest publications" | ||
msgstr "les dernières publications" | ||
|
||
#: views/news/index.phtml:130 | ||
#: views/news/index.phtml:146 | ||
msgid "from your followed feeds" | ||
msgstr "depuis vos flux suivis" | ||
|
||
#: views/news/index.phtml:145 | ||
#: views/news/index.phtml:161 | ||
msgid "3 links of -10 minutes" | ||
msgstr "3 liens de -10 minutes" | ||
|
||
#: views/news/index.phtml:146 views/news/index.phtml:162 | ||
#: views/news/index.phtml:162 views/news/index.phtml:178 | ||
msgid "from your bookmarks" | ||
msgstr "depuis vos signets" | ||
|
||
#: views/news/index.phtml:161 | ||
#: views/news/index.phtml:177 | ||
msgid "1 link of +10 minutes" | ||
msgstr "1 lien de +10 minutes" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace flusio\utils; | ||
|
||
use flusio\models; | ||
|
||
/** | ||
* A class to organise a list of links in a timeline (i.e. grouped by dates). | ||
* | ||
* @author Marien Fressinaud <[email protected]> | ||
* @license http://www.gnu.org/licenses/agpl-3.0.en.html AGPL | ||
*/ | ||
class LinksTimeline | ||
{ | ||
/** @var array<string, LinksTimeline\DateGroup> */ | ||
private array $dates_groups = []; | ||
|
||
/** | ||
* @param models\Link[] $links | ||
*/ | ||
public function __construct(array $links) | ||
{ | ||
foreach ($links as $link) { | ||
if (!$link->published_at) { | ||
continue; | ||
} | ||
|
||
$date_key = $link->published_at->format('Y-m-d'); | ||
if (isset($this->dates_groups[$date_key])) { | ||
$date_group = $this->dates_groups[$date_key]; | ||
} else { | ||
$date_group = new LinksTimeline\DateGroup($link->published_at); | ||
$this->dates_groups[$date_key] = $date_group; | ||
} | ||
|
||
$date_group->links[] = $link; | ||
} | ||
} | ||
|
||
/** | ||
* @return array<string, LinksTimeline\DateGroup> | ||
*/ | ||
public function datesGroups(): array | ||
{ | ||
return $this->dates_groups; | ||
} | ||
|
||
public function empty(): bool | ||
{ | ||
return empty($this->dates_groups); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace flusio\utils\LinksTimeline; | ||
|
||
use flusio\models; | ||
|
||
/** | ||
* @author Marien Fressinaud <[email protected]> | ||
* @license http://www.gnu.org/licenses/agpl-3.0.en.html AGPL | ||
*/ | ||
class DateGroup | ||
{ | ||
public \DateTimeImmutable $date; | ||
|
||
/** @var models\Link[] */ | ||
public array $links = []; | ||
|
||
public function __construct(\DateTimeImmutable $date) | ||
{ | ||
$this->date = $date; | ||
} | ||
|
||
public function isToday(): bool | ||
{ | ||
$today = \Minz\Time::now(); | ||
return $this->date->format('Y-m-d') === $today->format('Y-m-d'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.