aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Controller
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-03-11 14:48:46 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-03-20 21:12:22 +0100
commit4204a06b7726597dc84fe34b39c53f1534a86140 (patch)
treef81243f621997e9da4c39e4c17f2a2d37053103e /src/Wallabag/ImportBundle/Controller
parent4f9cf232f8d4d750d39aca83406b8a6d5e17a6c9 (diff)
downloadwallabag-4204a06b7726597dc84fe34b39c53f1534a86140.tar.gz
wallabag-4204a06b7726597dc84fe34b39c53f1534a86140.tar.zst
wallabag-4204a06b7726597dc84fe34b39c53f1534a86140.zip
Add flashes messages
Diffstat (limited to 'src/Wallabag/ImportBundle/Controller')
-rw-r--r--src/Wallabag/ImportBundle/Controller/PocketController.php8
-rw-r--r--src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php9
-rw-r--r--src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php9
3 files changed, 18 insertions, 8 deletions
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php
index 7a35514b..1d804219 100644
--- a/src/Wallabag/ImportBundle/Controller/PocketController.php
+++ b/src/Wallabag/ImportBundle/Controller/PocketController.php
@@ -52,8 +52,9 @@ class PocketController extends Controller
52 */ 52 */
53 public function callbackAction() 53 public function callbackAction()
54 { 54 {
55 $message = 'Import failed, please try again.'; 55 $message = 'flashes.import.notice.failed';
56 $pocket = $this->get('wallabag_import.pocket.import'); 56 $pocket = $this->get('wallabag_import.pocket.import');
57
57 $markAsRead = $this->get('session')->get('mark_as_read'); 58 $markAsRead = $this->get('session')->get('mark_as_read');
58 $this->get('session')->remove('mark_as_read'); 59 $this->get('session')->remove('mark_as_read');
59 60
@@ -69,7 +70,10 @@ class PocketController extends Controller
69 70
70 if (true === $pocket->setMarkAsRead($markAsRead)->import()) { 71 if (true === $pocket->setMarkAsRead($markAsRead)->import()) {
71 $summary = $pocket->getSummary(); 72 $summary = $pocket->getSummary();
72 $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; 73 $message = $this->get('translator')->trans('flashes.import.notice.summary', array(
74 '%imported%' => $summary['imported'],
75 '%skipped%' => $summary['skipped'],
76 ));
73 } 77 }
74 78
75 $this->get('session')->getFlashBag()->add( 79 $this->get('session')->getFlashBag()->add(
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php
index 154a0769..1bc9696d 100644
--- a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php
+++ b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php
@@ -31,11 +31,14 @@ class WallabagV1Controller extends Controller
31 ->setMarkAsRead($markAsRead) 31 ->setMarkAsRead($markAsRead)
32 ->import(); 32 ->import();
33 33
34 $message = 'Import failed, please try again.'; 34 $message = 'flashes.import.notice.failed';
35 35
36 if (true === $res) { 36 if (true === $res) {
37 $summary = $wallabag->getSummary(); 37 $summary = $wallabag->getSummary();
38 $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; 38 $message = $this->get('translator')->trans('flashes.import.notice.summary', array(
39 '%imported%' => $summary['imported'],
40 '%skipped%' => $summary['skipped'],
41 ));
39 42
40 unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); 43 unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name);
41 } 44 }
@@ -49,7 +52,7 @@ class WallabagV1Controller extends Controller
49 } else { 52 } else {
50 $this->get('session')->getFlashBag()->add( 53 $this->get('session')->getFlashBag()->add(
51 'notice', 54 'notice',
52 'Error while processing import. Please verify your import file.' 55 'flashes.import.notice.failed_on_file'
53 ); 56 );
54 } 57 }
55 } 58 }
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php
index 6dcd204a..3e6428a0 100644
--- a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php
+++ b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php
@@ -31,11 +31,14 @@ class WallabagV2Controller extends Controller
31 ->setMarkAsRead($markAsRead) 31 ->setMarkAsRead($markAsRead)
32 ->import(); 32 ->import();
33 33
34 $message = 'Import failed, please try again.'; 34 $message = 'flashes.import.notice.failed';
35 35
36 if (true === $res) { 36 if (true === $res) {
37 $summary = $wallabag->getSummary(); 37 $summary = $wallabag->getSummary();
38 $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; 38 $message = $this->get('translator')->trans('flashes.import.notice.summary', array(
39 '%imported%' => $summary['imported'],
40 '%skipped%' => $summary['skipped'],
41 ));
39 42
40 unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); 43 unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name);
41 } 44 }
@@ -49,7 +52,7 @@ class WallabagV2Controller extends Controller
49 } else { 52 } else {
50 $this->get('session')->getFlashBag()->add( 53 $this->get('session')->getFlashBag()->add(
51 'notice', 54 'notice',
52 'Error while processing import. Please verify your import file.' 55 'flashes.import.notice.failed_on_file'
53 ); 56 );
54 } 57 }
55 } 58 }