]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
EntriesExport: change authors and title when not single entry export
authorKevin Decherf <kevin@kdecherf.com>
Sun, 6 Jan 2019 19:17:35 +0000 (20:17 +0100)
committerKevin Decherf <kevin@kdecherf.com>
Mon, 7 Jan 2019 20:44:14 +0000 (21:44 +0100)
Change '{method} authors' (which gives 'Tag_entries authors' when
exporting a tag) to 'Various authors'.

When exporting a tag (tag_entries), change the title from 'Tag_entries
articles' to 'Tag {tag} articles'.

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
src/Wallabag/CoreBundle/Controller/ExportController.php
src/Wallabag/CoreBundle/Helper/EntriesExport.php

index 7ca89239430dc7b2ec3da1d18fd1b88779ee944e..9e9dbe49a96f1446411c77e2cfd8ab4c9d37a610 100644 (file)
@@ -58,6 +58,7 @@ class ExportController extends Controller
         $method = ucfirst($category);
         $methodBuilder = 'getBuilderFor' . $method . 'ByUser';
         $repository = $this->get('wallabag_core.entry_repository');
+        $title = $method;
 
         if ('tag_entries' === $category) {
             $tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag'));
@@ -66,6 +67,8 @@ class ExportController extends Controller
                 $this->getUser()->getId(),
                 $tag->getId()
             );
+
+            $title = 'Tag ' . $tag->getLabel();
         } else {
             $entries = $repository
                 ->$methodBuilder($this->getUser()->getId())
@@ -76,7 +79,7 @@ class ExportController extends Controller
         try {
             return $this->get('wallabag_core.helper.entries_export')
                 ->setEntries($entries)
-                ->updateTitle($method)
+                ->updateTitle($title)
                 ->updateAuthor($method)
                 ->exportAs($format);
         } catch (\InvalidArgumentException $e) {
index 92f1779c547d7e7516baa6132e297117545be2ea..db5340fc10a24e18f86169911c498b6917d9af10 100644 (file)
@@ -85,7 +85,7 @@ class EntriesExport
     public function updateAuthor($method)
     {
         if ('entry' !== $method) {
-            $this->author = $method . ' authors';
+            $this->author = 'Various authors';
 
             return $this;
         }