Skip to content
Snippets Groups Projects
Commit 02e62a28 authored by Laurent's avatar Laurent
Browse files

hotline #149057 MT : in page, fix loading of parent settings for

footer
parent 4ee30dbc
Branches
Tags
1 merge request!4346hotline #149057 MT : in page, fix loading of parent settings for
Pipeline #16077 passed with stage
in 29 minutes and 47 seconds
- correctif #149057 : Magasin de thèmes : affichage du pied de page dans les pages : correction de la prise en compte des classes personnalisés sélectionnées dans le profil
\ No newline at end of file
......@@ -20,22 +20,7 @@
*/
class Intonation_System_Section_Footer extends Intonation_System_Section {
public function __construct($template) {
parent::__construct($template);
$profile = Class_Profil::getCurrentProfil();
$profile_id = $profile->hasParentId()
? $profile->getParentId()
: $profile->getId();
$this->setSettings($this->getSettingsInstance()
->setProfileId($profile_id)
->load());
}
class Intonation_System_Section_Footer extends Intonation_System_Section_ForAllPages {
protected function _newSettingsInstance() {
return new Class_Systeme_Widget_Section_Footer;
}
......@@ -44,11 +29,4 @@ class Intonation_System_Section_Footer extends Intonation_System_Section {
public function getWrappingTag() {
return 'footer';
}
protected function _defaultsSettings() {
return array_merge(parent::_defaultsSettings(),
[Class_Template::current()->withNameSpace('width_xsmall') => 12,
Class_Template::current()->withNameSpace('display_mode') => Intonation_Library_Constants::SECTION_DISPLAY_MODE_ROW]);
}
}
\ No newline at end of file
}
<?php
/**
* Copyright (c) 2012-2022, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class Intonation_System_Section_ForAllPages extends Intonation_System_Section {
protected function _loadSettings(Class_Template $template) : self {
$profile = Class_Profil::getCurrentProfil();
$profile_id = $profile->hasParentId()
? $profile->getParentId()
: $profile->getId();
$this->setSettings($this->getSettingsInstance()
->setProfileId($profile_id)
->load());
return $this;
}
protected function _defaultsSettings() {
return array_merge(parent::_defaultsSettings(),
[Class_Template::current()->withNameSpace('width_xsmall') => 12,
Class_Template::current()->withNameSpace('display_mode') => Intonation_Library_Constants::SECTION_DISPLAY_MODE_ROW]);
}
}
......@@ -20,20 +20,7 @@
*/
class Intonation_System_Section_Header extends Intonation_System_Section {
protected function _loadSettings(Class_Template $template) : self {
$profile = Class_Profil::getCurrentProfil();
$profile_id = $profile->hasParentId()
? $profile->getParentId()
: $profile->getId();
$this->setSettings($this->getSettingsInstance()
->setProfileId($profile_id)
->load());
return $this;
}
class Intonation_System_Section_Header extends Intonation_System_Section_ForAllPages {
protected function _newSettingsInstance() {
return new Class_Systeme_Widget_Section_Header;
}
......@@ -42,11 +29,4 @@ class Intonation_System_Section_Header extends Intonation_System_Section {
public function getWrappingTag() {
return 'header';
}
protected function _defaultsSettings() {
return array_merge(parent::_defaultsSettings(),
[Class_Template::current()->withNameSpace('width_xsmall') => 12,
Class_Template::current()->withNameSpace('display_mode') => Intonation_Library_Constants::SECTION_DISPLAY_MODE_ROW]);
}
}
......@@ -35,10 +35,18 @@ class TemplatesProfileWithPageTest extends AbstractControllerTestCase {
'1' => ['division' => Class_Profil::DIV_BANNIERE,
'type_module' => 'IMAGE',
'preferences' => ['image' => 'wedontcare.jpg',
'link' => '/home']],
'2' => ['division' => Class_Profil::DIV_FOOTER,
'type_module' => 'IMAGE',
'preferences' => ['image' => 'meninblack.jpg',
'link' => '/home']]],
'section' => [
Class_Profil::DIV_BANNIERE => [
'boite' => ['black_and_white']]]]]);
'boite' => ['black_and_white']],
Class_Profil::DIV_FOOTER => [
'boite' => ['men_in_black']]
]
]]);
$page = $this->fixture(Class_Profil::class,
['id' => 2,
'parent_id' => 1,
......@@ -54,6 +62,13 @@ class TemplatesProfileWithPageTest extends AbstractControllerTestCase {
}
/** @test */
public function homeProfileFooterShouldHaveClassMenInBlack() {
$this->dispatch('/home');
$this->assertXPathContentContains('//footer/@class', 'men_in_black');
}
/** @test */
public function agendaPageHeaderShouldHaveParentClassBlackAndWhite() {
$this->dispatch('/agenda');
......@@ -66,4 +81,12 @@ class TemplatesProfileWithPageTest extends AbstractControllerTestCase {
$this->dispatch('/agenda');
$this->assertXPath('//header//div[contains(@class, "boite image")]//img[@src="' . Class_Url::absolute('wedontcare.jpg') . '"]');
}
/** @test */
public function agendaPageFooterShouldHaveParentClassMenInBlack() {
$this->dispatch('/agenda');
$this->assertXPathContentContains('//footer/@class', 'men_in_black');
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment