Commit 211c0f05 authored by Laurent's avatar Laurent
Browse files

dev #56107 ckeditor kiosk: do not display title if not set, do not add div id

parent 4f910277
......@@ -219,13 +219,13 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac
}
public function getBoite($show_admin_buttons = true) {
public function getBoite() {
if (!$this->isBoiteVisible())
return '';
$closure = function() use ($show_admin_buttons) {
$closure = function() {
$template = $this->getTemplate();
$html_array = $this->getHtml($show_admin_buttons);
$html_array = $this->getHtml();
return $this->getBoiteFromTemplate($template, $html_array);
};
......@@ -289,12 +289,17 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac
else
$html=$html_array["TITRE"].BR.$html_array["CONTENU"];
return '<div id="' . $this->_getBoxId() . '" class="boite '.strtolower($this->type_module).'">'.$html.'</div>';
return $this->_tag('div',
$html,
array_filter(['id' => $this->_getBoxId(),
'class' => 'boite '.strtolower($this->type_module)]));
}
public function _getBoxId() {
return 'boite_' . $this->id_module;
return $this->id_module
? ('boite_' . $this->id_module)
: null;
}
......
......@@ -62,7 +62,7 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba
}
public function getHtml($show_admin_buttons = true) {
public function getHtml() {
$this->titre = $this->getTitre();
$this->rss_interne = $this->getRss();
......@@ -71,7 +71,7 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba
: $this->getKiosqueIFrame();
$this->contenu = $this->contenu;
return $this->getHtmlArray($show_admin_buttons);
return $this->getHtmlArray();
}
......@@ -238,12 +238,14 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba
public function getTitre() {
if (!$titre = $this->preferences['titre'])
return '';
$tris = ['0' => 'alpha_titre',
'1' => 'date_creation desc',
'2' => 'nb_visu desc',
'3' => 'annee desc'];
$titre = $this->preferences['titre'];
$this->preferences['titre'] = str_replace(['/', '%2F'], ' ', $this->preferences['titre']);
$url_options = array_merge(['controller' => 'recherche',
......
......@@ -21,7 +21,6 @@
class ZendAfi_View_Helper_Article_ReplaceWidgets extends ZendAfi_View_Helper_BaseHelper {
public function article_ReplaceWidgets($content) {
return preg_replace_callback(
'|(?P<allimg><img[^>]+data-code="(?P<code>\w+)"[^>]+data-form="(?P<form>[^"]+)[^>]*>)|',
......@@ -34,14 +33,15 @@ class ZendAfi_View_Helper_Article_ReplaceWidgets extends ZendAfi_View_Helper_Bas
);
}
protected function _renderWidget($code,$form) {
$prefs = [];
parse_str(html_entity_decode($form),$prefs);
$params=['type_module'=> $code,
'preferences' => $prefs];
'preferences' => $prefs];
$helper = ZendAfi_View_Helper_Accueil_Base::getModuleHelperFromParams(null,$params,$this->view);
return $helper->getBoite(false);
return $helper->setFonctionAdminHelper(null)->getBoite();
}
}
?>
\ No newline at end of file
......@@ -1716,7 +1716,7 @@ class CmsControllerWithArticleWithWallKioskTest extends CmsControllerWithArticle
$this->fixture('Class_Article', [ 'id' => 55,
'titre' => 'Mes dvds',
'contenu' => '<img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=Boite%20kiosque&amp;style_liste=mur&amp;styles_reload=0&amp;op_speed=100&amp;op_largeur_img=120&amp;op_hauteur_img=150&amp;profil_redirect=&amp;id_catalogue=0&amp;id_panier=&amp;aleatoire=1&amp;tri=1&amp;nb_notices=20&amp;nb_analyse=50&amp;only_img=1&amp;boite=&amp;rss_avis=0">']);
'contenu' => '<img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&amp;style_liste=mur&amp;styles_reload=0&amp;op_speed=100&amp;op_largeur_img=120&amp;op_hauteur_img=150&amp;profil_redirect=&amp;id_catalogue=0&amp;id_panier=&amp;aleatoire=1&amp;tri=1&amp;nb_notices=20&amp;nb_analyse=50&amp;only_img=1&amp;boite=&amp;rss_avis=0">']);
$this->dispatch('/cms/articleview/id/55',true);
}
......@@ -1738,6 +1738,18 @@ class CmsControllerWithArticleWithWallKioskTest extends CmsControllerWithArticle
public function adminButtonShouldNotBeenShow() {
$this->assertNotXPath('//a[contains(@href,"widget/edit-widget")]',$this->_response->getBody());
}
/** @test */
public function kioskShouldNotDisplayTitleLink() {
$this->assertNotXPath('//div[contains(@class, "boite kiosque")]/div/a');
}
/** @test */
public function widgetDivShouldNotHaveAnId() {
$this->assertXPath('//div[contains(@class, "boite kiosque")][not(@id)]');
}
}
......@@ -1760,4 +1772,10 @@ class CmsControllerWithArticleWithCubeKioskTest extends CmsControllerWithArticle
$this->assertXPath( '//iframe[contains(@src, "style_liste/cube")]');;
}
/** @test */
public function kioskShouldDisplayTitleLink() {
$this->assertXPathContentContains('//div[contains(@class, "boite kiosque")]/div/a',
'Boite kiosque');
}
}
\ No newline at end of file
Markdown is supported
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