From 8ab6759c9491b2c3c9c64937cde4ac86a4f65abe Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Wed, 25 Aug 2021 14:08:18 +0200 Subject: [PATCH] hotline MT #139853 fix usage of button classes --- VERSIONS_HOTLINE/139853 | 1 + library/templates/Intonation/Library/Link.php | 8 +++++--- .../templates/Intonation/Library/View/Wrapper/Record.php | 1 - library/templates/Intonation/View/TagAction.php | 3 --- library/templates/Intonation/View/Template/Permalink.php | 4 ++-- tests/scenarios/Templates/TemplatesMenuTest.php | 2 +- tests/scenarios/Templates/TemplatesWidgetTest.php | 6 ++++++ 7 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 VERSIONS_HOTLINE/139853 diff --git a/VERSIONS_HOTLINE/139853 b/VERSIONS_HOTLINE/139853 new file mode 100644 index 00000000000..cb1cee0f6cd --- /dev/null +++ b/VERSIONS_HOTLINE/139853 @@ -0,0 +1 @@ + - ticket #139853 : Magasin de thèmes : Correction de l'affichage du bouton de recherche avancée. \ No newline at end of file diff --git a/library/templates/Intonation/Library/Link.php b/library/templates/Intonation/Library/Link.php index 38fabd728d5..358f318d051 100644 --- a/library/templates/Intonation/Library/Link.php +++ b/library/templates/Intonation/Library/Link.php @@ -21,6 +21,7 @@ class Intonation_Library_Link extends Class_Button { + protected $_inline_text, $_class = '', @@ -61,12 +62,13 @@ class Intonation_Library_Link extends Class_Button { public function getClass() { - return $this->_class; + return $this->getAttrib('class'); } public function setClass($class) { - $this->_class = $class; + $classes = $this->getAttrib('class'); + $this->setAttrib('class', $classes . ' ' . $class); return $this; } @@ -102,4 +104,4 @@ class Intonation_Library_Link extends Class_Button { $this->_callback = $callback; return $this; } -} +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index 71d85f215b3..3d011c90c75 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -527,7 +527,6 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra ->setTitle($this->_('Voir plus d\'actions pour le document %s', $this->_model->getTitrePrincipal(' '))) ->setClass('view_more_record_actions') - ->setAttrib('class', 'more_action') ->setCallback(function($button) use ($actions) { $button->setCallback(null); diff --git a/library/templates/Intonation/View/TagAction.php b/library/templates/Intonation/View/TagAction.php index ff96bbc7bd7..5d982c024c9 100644 --- a/library/templates/Intonation/View/TagAction.php +++ b/library/templates/Intonation/View/TagAction.php @@ -57,9 +57,6 @@ class Intonation_View_TagAction extends ZendAfi_View_Helper_BaseHelper { unset($attribs['class']); } - if ($class = $action->getClass()) - $classes[] = $class; - if ($only_classes = $action->getOnlyClasses()) $classes = [$only_classes]; diff --git a/library/templates/Intonation/View/Template/Permalink.php b/library/templates/Intonation/View/Template/Permalink.php index afe778af0c1..6979cc0b070 100644 --- a/library/templates/Intonation/View/Template/Permalink.php +++ b/library/templates/Intonation/View/Template/Permalink.php @@ -25,8 +25,8 @@ class Intonation_View_Template_Permalink extends ZendAfi_View_Helper_BaseHelper ->setText($this->_('Lien …')) ->setImage($this->view->templateIco('permalink', 'utils')) ->setTitle($this->_('Voir le lien permanent suivant: %s', $url)) - ->setClass('view_permalink permalink py-1 my-1') - ->setAttribs(['data-url' => $url, + ->setAttribs(['class' => 'view_permalink permalink py-1 my-1', + 'data-url' => $url, 'data-helptext' => $this->_('Copiez le lien suivant'), 'onclick' => 'popupPermalink(this);']); } diff --git a/tests/scenarios/Templates/TemplatesMenuTest.php b/tests/scenarios/Templates/TemplatesMenuTest.php index b2e4e0e3c4a..0470ae52f70 100644 --- a/tests/scenarios/Templates/TemplatesMenuTest.php +++ b/tests/scenarios/Templates/TemplatesMenuTest.php @@ -331,7 +331,7 @@ class TemplatesMenuDefaultSettingsTest extends Admin_AbstractControllerTestCase -class TemplatesMenuTestCase extends AbstractControllerTestCase { +abstract class TemplatesMenuTestCase extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true, diff --git a/tests/scenarios/Templates/TemplatesWidgetTest.php b/tests/scenarios/Templates/TemplatesWidgetTest.php index c4150955d60..9360621a381 100644 --- a/tests/scenarios/Templates/TemplatesWidgetTest.php +++ b/tests/scenarios/Templates/TemplatesWidgetTest.php @@ -565,6 +565,12 @@ class TemplatesWidgetSearchInlineStyleTest extends TemplatesIntonationTestCase { public function searchButtonSubmitShouldHaveClassBtnSm() { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//div[contains(@class, "form-row")]//input[@type="submit"][contains(@class, "btn-sm")]'); } + + + /** @test */ + public function advancedSearchButtonShouldHaveClassDropdownToggle() { + $this->assertXPath('//div[contains(@class,"boite rech_simple")]//div[@class="dropdown"]/button[contains(@class, "dropdown-toggle")]'); + } } -- GitLab