Added publication date

This commit is contained in:
Nicolas Lœuillet 2017-04-05 22:22:16 +02:00
parent 19122cf660
commit 5e9009ce86
37 changed files with 140 additions and 23 deletions

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added foreign keys for account resetting
* Added foreign keys for account resetting.
*/
class Version20160410190541 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added name field on wallabag_oauth2_clients
* Added name field on wallabag_oauth2_clients.
*/
class Version20160812120952 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added settings for RabbitMQ and Redis imports
* Added settings for RabbitMQ and Redis imports.
*/
class Version20160911214952 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added pocket_consumer_key field on wallabag_config
* Added pocket_consumer_key field on wallabag_config.
*/
class Version20160916201049 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Doctrine\DBAL\Migrations\SkipMigrationException;
/**
* Added pocket_consumer_key field on wallabag_config
* Added pocket_consumer_key field on wallabag_config.
*/
class Version20161001072726 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Converted database to utf8mb4 encoding (for MySQL only)
* Converted database to utf8mb4 encoding (for MySQL only).
*/
class Version20161022134138 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added user_id column on oauth2_clients to prevent users to delete API clients from other users
* Added user_id column on oauth2_clients to prevent users to delete API clients from other users.
*/
class Version20161024212538 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added the internal setting to enable/disable downloading pictures
* Added the internal setting to enable/disable downloading pictures.
*/
class Version20161031132655 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added created_at index on entry table
* Added created_at index on entry table.
*/
class Version20161104073720 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added action_mark_as_read field on config table
* Added action_mark_as_read field on config table.
*/
class Version20161106113822 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added the internal setting to share articles to unmark.it
* Added the internal setting to share articles to unmark.it.
*/
class Version20161117071626 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Renamed uuid to uid in entry table
* Renamed uuid to uid in entry table.
*/
class Version20161214094402 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added index on wallabag_entry.uid
* Added index on wallabag_entry.uid.
*/
class Version20161214094403 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Added indexes on wallabag_entry.is_starred and wallabag_entry.is_archived
* Added indexes on wallabag_entry.is_starred and wallabag_entry.is_archived.
*/
class Version20170127093841 extends AbstractMigration implements ContainerAwareInterface
{

View file

@ -0,0 +1,55 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Add published_at in `entry` table.
*/
class Version20170405182620 extends AbstractMigration implements ContainerAwareInterface
{
/**
* @var ContainerInterface
*/
private $container;
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
private function getTable($tableName)
{
return $this->container->getParameter('database_table_prefix').$tableName;
}
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasColumn('published_at'), 'It seems that you already played this migration.');
$entryTable->addColumn('published_at', 'datetime', [
'notnull' => false,
]);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf(!$entryTable->hasColumn('published_at'), 'It seems that you already played this migration.');
$entryTable->dropColumn('published_at');
}
}

View file

@ -912,6 +912,10 @@ a.add-to-wallabag-link-after::after {
content: "\e953";
}
.icon-pencil2::before {
content: "\e906";
}
.icon-time::before {
content: "\e952";
}

View file

@ -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;
}
}

View file

@ -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));

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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"

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -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'

View file

@ -44,9 +44,15 @@
<div id="article-informations">
<i class="tool icon icon-calendar" title="{{ 'entry.view.created_at'|trans }}">
{{ entry.createdAt|date('Y-m-d') }}
{{ entry.createdAt|date('Y-m-d H:i') }}
</i>
{% if entry.publishedAt is not null %}
<i class="tool icon icon-pencil2" title="{{ 'entry.view.published_at'|trans }}">
{{ entry.publishedAt|date('Y-m-d H:i') }}
</i>
{% endif %}
<i class="tool icon icon-time">
{% set readingTime = entry.readingTime / app.user.config.readingSpeed %}
{% if readingTime > 0 %}

View file

@ -138,7 +138,7 @@
<span>scuttle</span>
</a>
</li>
{% endif %}
{% endif %}
{% if craue_setting('share_diaspora') %}
<li>
<a href="{{ craue_setting('diaspora_url') }}/bookmarklet?url={{ entry.url|url_encode }}&amp;title={{ entry.title|striptags|url_encode }}&amp;notes=&amp;v=1&amp;noui=1&amp;jump=doclose" target="_blank">
@ -226,8 +226,14 @@
</li>
<li>
<i class="material-icons" title="{{ 'entry.view.created_at'|trans }}">today</i>
{{ entry.createdAt|date('Y-m-d') }}
{{ entry.createdAt|date('Y-m-d H:i') }}
</li>
{% if entry.publishedAt is not null %}
<li>
<i class="material-icons" title="{{ 'entry.view.published_at'|trans }}">create</i>
{{ entry.publishedAt|date('Y-m-d H:i') }}
</li>
{% endif %}
<li>
<i class="material-icons link">link</i>
<a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|striptags }}" class="tool">

View file

@ -138,6 +138,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
$this->assertEquals($this->url, $content->getUrl());
$this->assertContains('Google', $content->getTitle());
$this->assertEquals('2015-03-28 15:37:39', $content->getPublishedAt());
}
public function testPostNewOkUrlExist()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long