From 26d2d53022273b183b7e3f24cb176a544ad52cdb Mon Sep 17 00:00:00 2001
From: efalcy <efalcy@afi-sa.fr>
Date: Tue, 6 Oct 2015 14:02:30 +0200
Subject: [PATCH] sandbox : display all notice reviews , change title for table

---
 .../admin/views/scripts/modo/allreviews.phtml | 25 -------------------
 .../admin/views/scripts/modo/avisnotice.phtml |  8 +++---
 .../admin/controllers/ModoControllerTest.php  | 10 ++++++++
 3 files changed, 15 insertions(+), 28 deletions(-)
 delete mode 100644 application/modules/admin/views/scripts/modo/allreviews.phtml

diff --git a/application/modules/admin/views/scripts/modo/allreviews.phtml b/application/modules/admin/views/scripts/modo/allreviews.phtml
deleted file mode 100644
index 824c4a3bd6d..00000000000
--- a/application/modules/admin/views/scripts/modo/allreviews.phtml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-echo '<h1>'.$this->traduire('Modération des avis sur les notices').'</h1>';
-
-echo '<div id="avis-notice-liste" >';
-
-echo $this->avisBloc('Bibliothécaires', $this->list_avis_bibliothecaires);
-
-echo $this->avisBloc('Abonnés', $this->list_avis_utilisateurs);
-
-echo $this->avisBloc('Avis orphelins', $this->list_orphan_reviews);
-
-echo $this->avisBloc('Avis archives', $this->list_archived_reviews);
-
-echo '</div>';
-
-?>
-
-<script type='text/javascript'>
-  $(document).ready(function() {
-      $('.critique a:not(.actions a)').attr('target', '_blank');
-      $('#avis-notice-liste').accordion({heightStyle:'content',disabled:false, icons:null});
-      $('#avis-notice-liste .ui-accordion-content').show();
-    });
-</script>
diff --git a/application/modules/admin/views/scripts/modo/avisnotice.phtml b/application/modules/admin/views/scripts/modo/avisnotice.phtml
index fe1fbf30e53..31e27bb605d 100644
--- a/application/modules/admin/views/scripts/modo/avisnotice.phtml
+++ b/application/modules/admin/views/scripts/modo/avisnotice.phtml
@@ -1,11 +1,13 @@
 <?php
 
 
-if ($this->display_all)
- echo '<h1>'.$this->traduire('Tous les avis de notices').'</h1>';
+if ($this->display_all) {
+  echo '<h1>'.$this->traduire('Tous les avis de notices modérés').'</h1>';
+  echo $this->tagAnchor(['action' => 'avisnotice'],"Afficher les avis non modérés");
+}
 if (!$this->display_all) {
   echo '<h1>'.$this->traduire('Modération des avis sur les notices').'</h1>';
-  echo $this->tagAnchor(['action' => 'allreviews'],"Afficher tous les avis");
+  echo $this->tagAnchor(['action' => 'allreviews'],"Afficher tous les avis modérés");
 }
 echo '<div id="avis-notice-liste" >';
 
diff --git a/tests/application/modules/admin/controllers/ModoControllerTest.php b/tests/application/modules/admin/controllers/ModoControllerTest.php
index b2bef9f9696..9ec78abf35d 100644
--- a/tests/application/modules/admin/controllers/ModoControllerTest.php
+++ b/tests/application/modules/admin/controllers/ModoControllerTest.php
@@ -633,6 +633,11 @@ class ModoControllerAvisnoticeActionTest extends Admin_AbstractControllerTestCas
     $this->assertXpathContentContains('//div//h2', 'Avis orphelins', $this->_response->getBody());
   }
 
+
+  /** @test */
+  public function LinkToAllModeratedReviewsShouldBeDisplayed() {
+    $this->assertXPathContentContains('//a', 'Afficher tous les avis modérés', $this->_response->getBody());
+  }
 }
 
 
@@ -677,6 +682,11 @@ class ModoControllerAllReviewsPageActionTest extends ModoControllerIndexActionTe
     $this->assertXpathContentContains('//div//h2', 'B comme bière : la bière expliquée aux (grands) enfants', $this->_response->getBody());
   }
 
+
+  /** @test */
+  public function LinkToNonModeratedReviewsShouldBeDisplayed() {
+    $this->assertXPathContentContains('//a', 'Afficher les avis non modérés', $this->_response->getBody());
+  }
 }
 
 
-- 
GitLab