From 7b0b3622ab2dd909028481b294c91f88a5682671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 6 Apr 2017 09:36:20 +0200 Subject: Added author of article --- src/Wallabag/CoreBundle/Entity/Entry.php | 29 ++++++++++++++++++++++ src/Wallabag/CoreBundle/Helper/ContentProxy.php | 6 ++++- .../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 | 10 +++++++- .../views/themes/material/Entry/entry.html.twig | 10 +++++++- 16 files changed, 64 insertions(+), 3 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 54f74a14..8d385eb4 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -130,6 +130,15 @@ class Entry */ private $publishedAt; + /** + * @var array + * + * @ORM\Column(name="published_by", type="json_array", nullable=true) + * + * @Groups({"entries_for_user", "export_all"}) + */ + private $publishedBy; + /** * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) * @ORM\JoinTable @@ -730,4 +739,24 @@ class Entry return $this; } + + /** + * @return string + */ + public function getPublishedBy() + { + return $this->publishedBy; + } + + /** + * @param string $publishedBy + * + * @return Entry + */ + public function setPublishedBy($publishedBy) + { + $this->publishedBy = $publishedBy; + + return $this; + } } diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 56358665..d45aef88 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -79,10 +79,14 @@ class ContentProxy $entry->setContent($html); $entry->setHttpStatus(isset($content['status']) ? $content['status'] : ''); - if (isset($content['date']) && null !== $content['date']) { + if (isset($content['date']) && null !== $content['date'] && '' !== $content['date']) { $entry->setPublishedAt(new \DateTime($content['date'])); } + if (!empty($content['authors'])) { + $entry->setPublishedBy($content['authors']); + } + $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 a8802efc..3e841a18 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -225,6 +225,7 @@ entry: # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' created_at: 'Oprettelsesdato' # published_at: 'Publication date' + # published_by: 'Published by' 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 fa2b9fcb..3358b5d3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -225,6 +225,7 @@ entry: annotations_on_the_entry: '{0} Keine Anmerkungen|{1} Eine Anmerkung|]1,Inf[ %count% Anmerkungen' created_at: 'Erstellungsdatum' # published_at: 'Publication date' + # published_by: 'Published by' 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 bc2a90a5..30f44350 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -225,6 +225,7 @@ entry: annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' created_at: 'Creation date' published_at: 'Publication date' + published_by: 'Published by' 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 da516ee8..363c94fb 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -225,6 +225,7 @@ entry: 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' + # published_by: 'Published by' 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 0a3bebe4..972c2a5d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -225,6 +225,7 @@ entry: annotations_on_the_entry: '{0} بدون حاشیه|{1} یک حاشیه|]1,Inf[ %nbحاشیه% annotations' created_at: 'زمان ساخت' # published_at: 'Publication date' + # published_by: 'Published by' 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 468a9af9..04b1eeef 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -225,6 +225,7 @@ entry: 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" + published_by: "Publié par" 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 e7b0ea8a..7f6787c9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -225,6 +225,7 @@ entry: annotations_on_the_entry: '{0} Nessuna annotazione|{1} Una annotazione|]1,Inf[ %count% annotazioni' created_at: 'Data di creazione' # published_at: 'Publication date' + # published_by: 'Published by' 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 1937dfce..5a760b87 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -225,6 +225,7 @@ entry: 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' + # published_by: 'Published by' 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 cb644045..b2df8a0a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -225,6 +225,7 @@ entry: annotations_on_the_entry: '{0} Nie ma adnotacji |{1} Jedna adnotacja |]1,Inf[ %count% adnotacji' created_at: 'Czas stworzenia' # published_at: 'Publication date' + # published_by: 'Published by' 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 16803549..fb8c4d29 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml @@ -225,6 +225,7 @@ entry: 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' + # published_by: 'Published by' 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 539482f8..d702159a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -225,6 +225,7 @@ entry: # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' created_at: 'Data creării' # published_at: 'Publication date' + # published_by: 'Published by' 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 a3e1cca7..6525afac 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -225,6 +225,7 @@ entry: # annotations_on_the_entry: '{0} No annotations|{1} One annotation|]1,Inf[ %count% annotations' created_at: 'Oluşturulma tarihi' # published_at: 'Publication date' + # published_by: 'Published by' 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 8bc7b54c..426ce91c 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 @@ -47,12 +47,20 @@ {{ entry.createdAt|date('Y-m-d H:i') }} - {% if entry.publishedAt is not null %} + {% if entry.publishedAt is not null %} {{ entry.publishedAt|date('Y-m-d H:i') }} {% endif %} + {% if entry.publishedBy is not empty %} + + {% for author in entry.publishedBy %} + {{ author }}{% if not loop.last %}, {% endif %} + {% endfor %} + + {% 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 c72a22c0..8be5fd0d 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 @@ -228,12 +228,20 @@ today {{ entry.createdAt|date('Y-m-d H:i') }} - {% if entry.publishedAt is not null %} + {% if entry.publishedAt is not null %}
  • create {{ entry.publishedAt|date('Y-m-d H:i') }}
  • {% endif %} + {% if entry.publishedBy is not empty %} +
  • + person + {% for author in entry.publishedBy %} + {{ author }}{% if not loop.last %}, {% endif %} + {% endfor %} +
  • + {% endif %}
  • link -- cgit v1.2.3