From 0d26157af3b8584154371e55f1d64c826a340417 Mon Sep 17 00:00:00 2001
From: efalcy <efalcy@git-test.afi-sa.fr>
Date: Thu, 12 Dec 2013 14:49:04 +0000
Subject: [PATCH] Boites de droite toujours visibles : ajout de l'option cote
 admin

---
 .../admin/views/scripts/profil/_formProfil.phtml     | 11 +++++++++++
 library/Class/Profil.php                             |  7 +++++--
 .../admin/controllers/ProfilControllerTest.php       | 12 +++++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/application/modules/admin/views/scripts/profil/_formProfil.phtml b/application/modules/admin/views/scripts/profil/_formProfil.phtml
index 7a337943c0d..a889dc31469 100644
--- a/application/modules/admin/views/scripts/profil/_formProfil.phtml
+++ b/application/modules/admin/views/scripts/profil/_formProfil.phtml
@@ -266,21 +266,32 @@ Class_ScriptLoader::getInstance()
 									<td>&nbsp;</td>
 									<td colspan="2"><span class="info">Largeur</span></td>
 									<td colspan="2"><span class="info">Marge interne</span></td>
+									<td>&nbsp;</td>
+									
 								</tr>
 								<tr>
 									<td align="right">Divison 1</td>
 									<td width="10px"><input type="text" class="normal" name="largeur_division1" size="4" maxlength="4" value="<?php echo $this->profil->getLargeurDivision1()?>"></td><td class="normal" width="10px">pixels&nbsp;</td>
 									<td width="10px"><input type="text" class="normal" name="marge_division1" size="2" maxlength="2" value="<?php echo $this->profil->getMargeDivision1()?>"></td><td class="normal">pixels</td>
+									<td>&nbsp;</td>
+
 								</tr>
 								<tr>
 									<td align="right">Divison 2</td>
 									<td width="10px"><input type="text" class="normal" name="largeur_division2" size="4" maxlength="4" value="<?php echo $this->profil->getLargeurDivision2()?>"></td><td class="normal" width="10px">pixels&nbsp;</td>
 									<td width="10px"><input type="text" class="normal" name="marge_division2" size="2" maxlength="2" value="<?php echo $this->profil->getMargeDivision2()?>"></td><td class="normal">pixels</td>
+									<td>&nbsp;</td>
+									
 								</tr>
 								<tr>
 									<td align="right">Divison 3</td>
 									<td width="10px"><input type="text" class="normal" name="largeur_division3" size="4" maxlength="4" value="<?php echo $this->profil->getLargeurDivision3()?>"></td><td class="normal" width="10px">pixels&nbsp;</td>
 									<td width="10px"><input type="text" class="normal" name="marge_division3" size="2" maxlength="2" value="<?php echo $this->profil->getMargeDivision3()?>"></td><td class="normal">pixels</td>
+									<td>              <?php echo $this->formCheckbox(  'division_three_always_visible', 
+																															 null,
+																															 ['checked' => $this->profil->getDivisionThreeAlwaysVisible()]); 
+																		?>Toujours visible</td>
+
 								</tr>
 							</table>
 						</div>
diff --git a/library/Class/Profil.php b/library/Class/Profil.php
index f25e38c38de..003996aed25 100644
--- a/library/Class/Profil.php
+++ b/library/Class/Profil.php
@@ -164,7 +164,9 @@ class Class_Profil extends Storm_Model_Abstract {
 																		'logo_droite_img',
 																		'logo_droite_link',
 																		'header_social_network',
-																		'mail_suggestion_achat');
+																		'mail_suggestion_achat',
+																		'division_three_always_visible',
+				);
 	  return self::$CFG_SITE_KEYS;
 
 	}
@@ -240,7 +242,8 @@ class Class_Profil extends Storm_Model_Abstract {
 				 'logo_gauche_link' => '',
 				 'logo_droite_img' => '',
 				 'logo_droite_link' => '',
-				 'header_social_network' => false];
+				 'header_social_network' => false,
+					'division_three_always_visible' => false];
 	  return self::$DEFAULT_VALUES;
   }
 
diff --git a/tests/application/modules/admin/controllers/ProfilControllerTest.php b/tests/application/modules/admin/controllers/ProfilControllerTest.php
index 04baeff9676..a3c9c974e07 100644
--- a/tests/application/modules/admin/controllers/ProfilControllerTest.php
+++ b/tests/application/modules/admin/controllers/ProfilControllerTest.php
@@ -37,6 +37,7 @@ abstract class Admin_ProfilControllerProfilJeunesseTestCase extends Admin_Abstra
 											'logo_droite_img' => '/userfiles/macommune.png',
 											'logo_droite_link' => 'http://macommune.fr',
 											'header_social_network' => true,
+											'division_three_always_visible' => true,
 											'header_css' => '/userfiles/css/my.css',
 											'header_js' => '/userfiles/js/my.js',
 											'ordre_divisions' => 1);
@@ -112,6 +113,10 @@ class Admin_ProfilControllerEditProfilJeunesseTest extends Admin_ProfilControlle
 		$this->assertXPath('//select[@name="id_site"]');
 	}
 
+/** @test */
+	public function division3ShouldHaveVisibilityOption() {
+		$this->assertXPathContentContains('//td','Toujours visible'); 
+	}
 
 	/** @test */
 	public function textInputHeaderImgShouldContainsPathToJeunessePng() {
@@ -202,6 +207,12 @@ class Admin_ProfilControllerEditProfilJeunesseTest extends Admin_ProfilControlle
 		$this->assertXPath("//input[@type='checkbox'][@name='header_social_network'][@checked='checked']");
 	}
 
+
+	/** @test */
+	public function divisionThreeVisibleShouldBeChecked() {
+		$this->assertXPath("//input[@type='checkbox'][@name='division_three_always_visible'][@checked='checked']",$this->_response->getBody());
+	}
+
 	/** @test */
 	public function skinListShouldContainOriginal() {
 		$this->assertXPath("//select[@name='skin']/option[@value='original'][not(@selected)]");
@@ -977,7 +988,6 @@ class Admin_ProfilControllerEditAccueilPageMusiqueTest extends Admin_ProfilContr
 }
 
 
-
 class Admin_ProfilControllerPostAccueilPageMusiqueTest extends Admin_ProfilControllerProfilJeunesseWithPagesTestCase {
 	public function setUp() {
 		parent::setUp();
-- 
GitLab