From 5e9009ce86a366001616fad5b28cb59dc20ee4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 5 Apr 2017 22:22:16 +0200 Subject: Added publication date --- src/Wallabag/CoreBundle/Entity/Entry.php | 29 ++++++++++++++++++++++ src/Wallabag/CoreBundle/Helper/ContentProxy.php | 4 +++ .../Resources/translations/messages.da.yml | 1 + .../Resources/translations/messages.de.yml | 1 + .../Resources/translations/messages.en.yml | 1 + .../Resources/translations/messages.es.yml | 1 + .../Resources/translations/messages.fa.yml | 1 + .../Resources/translations/messages.fr.yml | 1 + .../Resources/translations/messages.it.yml | 1 + .../Resources/translations/messages.oc.yml | 1 + .../Resources/translations/messages.pl.yml | 1 + .../Resources/translations/messages.pt.yml | 1 + .../Resources/translations/messages.ro.yml | 1 + .../Resources/translations/messages.tr.yml | 1 + .../views/themes/baggy/Entry/entry.html.twig | 8 +++++- .../views/themes/material/Entry/entry.html.twig | 10 ++++++-- 16 files changed, 60 insertions(+), 3 deletions(-) (limited to 'src/Wallabag') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 7276b437..54f74a14 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -121,6 +121,15 @@ class Entry */ private $updatedAt; + /** + * @var \DateTime + * + * @ORM\Column(name="published_at", type="datetime", nullable=true) + * + * @Groups({"entries_for_user", "export_all"}) + */ + private $publishedAt; + /** * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) * @ORM\JoinTable @@ -701,4 +710,24 @@ class Entry return $this; } + + /** + * @return \Datetime + */ + public function getPublishedAt() + { + return $this->publishedAt; + } + + /** + * @param \Datetime $publishedAt + * + * @return Entry + */ + public function setPublishedAt(\Datetime $publishedAt) + { + $this->publishedAt = $publishedAt; + + return $this; + } } diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index f222dd88..56358665 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -79,6 +79,10 @@ class ContentProxy $entry->setContent($html); $entry->setHttpStatus(isset($content['status']) ? $content['status'] : ''); + if (isset($content['date']) && null !== $content['date']) { + $entry->setPublishedAt(new \DateTime($content['date'])); + } + $entry->setLanguage(isset($content['language']) ? $content['language'] : ''); $entry->setMimetype(isset($content['content_type']) ? $content['content_type'] : ''); $entry->setReadingTime(Utils::getReadingTime($html)); diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index dfac7a65..a8802efc 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -224,6 +224,7 @@ entry: original_article: 'original' # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' created_at: 'Oprettelsesdato' + # published_at: 'Publication date' new: page_title: 'Gem ny artikel' placeholder: 'http://website.com' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 0b9df325..fa2b9fcb 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -224,6 +224,7 @@ entry: original_article: 'original' annotations_on_the_entry: '{0} Keine Anmerkungen|{1} Eine Anmerkung|]1,Inf[ %count% Anmerkungen' created_at: 'Erstellungsdatum' + # published_at: 'Publication date' new: page_title: 'Neuen Artikel speichern' placeholder: 'https://website.de' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 2fa3192e..bc2a90a5 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -224,6 +224,7 @@ entry: original_article: 'original' annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' created_at: 'Creation date' + published_at: 'Publication date' new: page_title: 'Save new entry' placeholder: 'http://website.com' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index ce581d89..da516ee8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -224,6 +224,7 @@ entry: original_article: 'original' annotations_on_the_entry: '{0} Sin anotaciones|{1} Una anotación|]1,Inf[ %count% anotaciones' created_at: 'Fecha de creación' + # published_at: 'Publication date' new: page_title: 'Guardar un nuevo artículo' placeholder: 'http://sitioweb.com' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 3e3ee12c..0a3bebe4 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -224,6 +224,7 @@ entry: original_article: 'اصلی' annotations_on_the_entry: '{0} بدون حاشیه|{1} یک حاشیه|]1,Inf[ %nbحاشیه% annotations' created_at: 'زمان ساخت' + # published_at: 'Publication date' new: page_title: 'ذخیرهٔ مقالهٔ تازه' placeholder: 'http://website.com' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 074593a6..468a9af9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -224,6 +224,7 @@ entry: original_article: "original" annotations_on_the_entry: "{0} Aucune annotation|{1} Une annotation|]1,Inf[ %count% annotations" created_at: "Date de création" + published_at: "Date de publication" new: page_title: "Sauvegarder un nouvel article" placeholder: "http://website.com" diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 0d86756a..e7b0ea8a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -224,6 +224,7 @@ entry: original_article: 'originale' annotations_on_the_entry: '{0} Nessuna annotazione|{1} Una annotazione|]1,Inf[ %count% annotazioni' created_at: 'Data di creazione' + # published_at: 'Publication date' new: page_title: 'Salva un nuovo contenuto' placeholder: 'http://website.com' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index d2949c50..1937dfce 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -224,6 +224,7 @@ entry: original_article: 'original' annotations_on_the_entry: "{0} Pas cap d'anotacion|{1} Una anotacion|]1,Inf[ %count% anotacions" created_at: 'Data de creacion' + # published_at: 'Publication date' new: page_title: 'Enregistrar un novèl article' placeholder: 'http://website.com' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 1f512942..cb644045 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -224,6 +224,7 @@ entry: original_article: 'oryginalny' annotations_on_the_entry: '{0} Nie ma adnotacji |{1} Jedna adnotacja |]1,Inf[ %count% adnotacji' created_at: 'Czas stworzenia' + # published_at: 'Publication date' new: page_title: 'Zapisz nowy wpis' placeholder: 'http://website.com' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index 2e815230..16803549 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml @@ -224,6 +224,7 @@ entry: original_article: 'original' annotations_on_the_entry: '{0} Sem anotações|{1} Uma anotação|]1,Inf[ %nbAnnotations% anotações' created_at: 'Data de criação' + # published_at: 'Publication date' new: page_title: 'Salvar nova entrada' placeholder: 'http://website.com' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 16401efd..539482f8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -224,6 +224,7 @@ entry: original_article: 'original' # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' created_at: 'Data creării' + # published_at: 'Publication date' new: page_title: 'Salvează un nou articol' placeholder: 'http://website.com' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index a4bf7dfe..a3e1cca7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -224,6 +224,7 @@ entry: original_article: 'orijinal' # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' created_at: 'Oluşturulma tarihi' + # published_at: 'Publication date' new: page_title: 'Yeni makaleyi kaydet' placeholder: 'http://website.com' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig index 5d5e6dd8..8bc7b54c 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig @@ -44,9 +44,15 @@
- {{ entry.createdAt|date('Y-m-d') }} + {{ entry.createdAt|date('Y-m-d H:i') }} + {% if entry.publishedAt is not null %} + + {{ entry.publishedAt|date('Y-m-d H:i') }} + + {% endif %} + {% set readingTime = entry.readingTime / app.user.config.readingSpeed %} {% if readingTime > 0 %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig index 8e60e2b4..c72a22c0 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig @@ -138,7 +138,7 @@ scuttle - {% endif %} + {% endif %} {% if craue_setting('share_diaspora') %}
  • @@ -226,8 +226,14 @@
  • today - {{ entry.createdAt|date('Y-m-d') }} + {{ entry.createdAt|date('Y-m-d H:i') }} +
  • + {% if entry.publishedAt is not null %} +
  • + create + {{ entry.publishedAt|date('Y-m-d H:i') }}
  • + {% endif %}
  • link -- cgit v1.2.3