diff --git a/VERSIONS_HOTLINE/134150 b/VERSIONS_HOTLINE/134150 new file mode 100644 index 0000000000000000000000000000000000000000..fe8fd2d00a870792f3e8d8c40800c9748e59cf2a --- /dev/null +++ b/VERSIONS_HOTLINE/134150 @@ -0,0 +1 @@ + - ticket #134150 : Magasin de thèmes : Correction des affichages du bouton vider l'historique de recherche, du bouton gestion des activités et du formulaire de configuration dans le compte lecteur. \ No newline at end of file diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index 1b5315da67760fe8eef4b670cbe1ae086ca1bd4c..5c1103917834cfb9a526908c82cd01947a67b57e 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -293,6 +293,9 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'div class loans_list' => 'col-12', 'div class numerical_loans_list' => 'col-12 mt-5', 'div class historical_loans_list' => 'col-12 mt-5', + 'a class clear_history_button' => 'btn btn-sm btn-warning', + 'form class user_configuration_form' => 'form row no-gutters', + 'a class manage_activities_button' => 'btn btn-sm btn-success menu_admin_front_anchor', ], 'icons_map_doc_types' => [], diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Agenda.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Agenda.php index 988808b885443a03f6dbddd6181ba22f099d5f2b..a56816a1605ccfbbc5b369fd252f5782b2ff354d 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Agenda.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Agenda.php @@ -83,17 +83,12 @@ class Intonation_Library_View_Wrapper_User_RichContent_Agenda ->setUrl($this->_view->url(['module' => 'admin', 'controller' => 'activity'], null, true)) - ->setAttribs(['target' => '_blank']) ->setImage($this->getIco('team', 'library')) ->setText($this->_('Gérer les activités')) - ->setClass('btn btn-sm btn-success mr-3 menu_admin_front_anchor') + ->setClass('manage_activities_button') ->beNotResponsiveText(); - return - $this->_view->div(['class' => 'col-12'], - $this->_view->div(['class' => 'card no_border'], - $this->_view->div(['class' => 'card-header pl-2 pb-0'], - $this->_view->tagAction($link)))); + return $this->_view->renderCollectionActions([$link]); } diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php index 7c0ec6e7f7e6833e50b04c1e5f61e3d202909f29..e4834eac4d57e2cabce668d614917b38329336b4 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php @@ -124,6 +124,8 @@ class Intonation_Library_View_Wrapper_User_RichContent_Settings extends Intonati $form->setAction($this->_view->url(['controller' => 'abonne', 'action' => 'manage-preferences'])); + $form->setAttrib('class', 'user_configuration_form'); + if (!$form->getElements()) return ''; diff --git a/library/templates/Intonation/View/RenderCollection.php b/library/templates/Intonation/View/RenderCollection.php index 29505e62e17beb79bf7174557a42e51ed3065bb8..a4b41d98680928942df59696c8a72915cfd0a6a7 100644 --- a/library/templates/Intonation/View/RenderCollection.php +++ b/library/templates/Intonation/View/RenderCollection.php @@ -33,14 +33,8 @@ class Intonation_View_RenderCollection extends ZendAfi_View_Helper_BaseHelper { if ( ! $action->getClass()) $action->setClass('btn btn-sm btn-success'); - $one_action_class = (1 == count($actions)) - ? 'alone_in_the_list' - : ''; - $html = [$this->view->div(['class' => 'col-12'], - $this->view->renderActions($actions, - ['class' => implode(' ', ['collection_action', - $one_action_class])])), + $this->view->renderCollectionActions($actions)), $this->view->div(['class' => 'col-12'], $this->view->renderTruncateList($collection, $callback, diff --git a/library/templates/Intonation/View/RenderCollectionActions.php b/library/templates/Intonation/View/RenderCollectionActions.php new file mode 100644 index 0000000000000000000000000000000000000000..491c747000bbce51db735074bd87bd575edc6763 --- /dev/null +++ b/library/templates/Intonation/View/RenderCollectionActions.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright (c) 2012-2019, 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 + */ + + +class Intonation_View_RenderCollectionActions extends Intonation_View_RenderActions { + public function renderCollectionActions($actions, $items_attribs = []) { + $classes = ['collection_action']; + + if (1 == count($actions)) + $classes [] = 'alone_in_the_list'; + + if ( isset($items_attribs['class'])) + $classes [] = $items_attribs['class']; + + $classes = implode(' ', $classes); + $items_attribs['class'] = $classes; + + return $this->renderActions($actions, $items_attribs); + } +} diff --git a/library/templates/Intonation/View/Search/History.php b/library/templates/Intonation/View/Search/History.php index 9752908597179e75dc9d418762e49248d48e5565..62e02068287b838209b366ab576434c5306cba17 100644 --- a/library/templates/Intonation/View/Search/History.php +++ b/library/templates/Intonation/View/Search/History.php @@ -57,15 +57,15 @@ class Intonation_View_Search_History extends ZendAfi_View_Helper_BaseHelper { 'action' => 'clear-history']), 'Popup' => true, 'Text' => $this->_('Vider'), - 'Class' => 'btn btn-sm btn-warning', + 'Class' => 'clear_history_button', 'InlineText' => 1, 'Title' => $this->_('Vider l\'historique de recherches'), 'Image' => Class_Template::current()->getIco($this->view, 'delete', 'utils')])]; - $html = [$this->view->div(['class' => 'col-12'], $this->view->renderActions($actions)), - $this->view->div(['class' => 'col-12'], + $html = [$this->view->div(['class' => 'col-12'], $this->view->renderCollectionActions($actions)), + $this->view->div(['class' => 'col-12 mt-3'], $this->view->renderMultipleCarousel(new Storm_Collection($history), $callback))]; $html = $this->view->grid(implode($html)); diff --git a/tests/scenarios/Templates/PolygoneTemplateAbonneAgendaTest.php b/tests/scenarios/Templates/PolygoneTemplateAbonneAgendaTest.php index 3b73a251c234e6937335c8bc13794a98d79a006a..fb83a564e6caad1674bf2976983ec0659297ce93 100644 --- a/tests/scenarios/Templates/PolygoneTemplateAbonneAgendaTest.php +++ b/tests/scenarios/Templates/PolygoneTemplateAbonneAgendaTest.php @@ -559,7 +559,7 @@ class PolygoneTemplateAbonneAgendaWithRightRegisterTest /** @test */ public function pageShouldContainsLinkToAdminActivity() { - $this->assertXPathContentContains('//a[contains(@href, "admin/activity")][@target="_blank"]', + $this->assertXPathContentContains('//a[contains(@href, "admin/activity")][@class="card-link manage_activities_button btn btn-sm btn-success menu_admin_front_anchor"]', 'Gérer les activités'); } diff --git a/tests/scenarios/Templates/TemplatesAbonneTest.php b/tests/scenarios/Templates/TemplatesAbonneTest.php index 29165635d3ec23f75a8c789c23a26dad4fe75c63..44ad09d9f7f40c764d827d8898f5e5d3e8556a3f 100644 --- a/tests/scenarios/Templates/TemplatesAbonneTest.php +++ b/tests/scenarios/Templates/TemplatesAbonneTest.php @@ -785,7 +785,7 @@ class TemplatesDispatchAbonneConfigurationsTest extends TemplatesIntonationAccou /** @test */ public function formActionShouldBeAbonneManagePreferences() { - $this->assertXPath('//form[@action="/abonne/manage-preferences/id_profil/72"]'); + $this->assertXPath('//form[@class="user_configuration_form form row no-gutters"][@action="/abonne/manage-preferences/id_profil/72"]'); } } @@ -1598,3 +1598,46 @@ class TemplatesAbonneSelectionsProfessionnelsAsAdminTest extends Admin_AbstractC $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections-dans-les-domaines")]','Sélections dans les domaines'); } } + + + + +class TemplatesAbonneSearchHistoryTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + + $this->_buildTemplateProfil(['id' => 9]); + + $searcher = $this->fixture('Class_Users', + ['id' => 1, + 'login' => 'Searcher', + 'password' => 'secret', + ]); + + ZendAfi_Auth::getInstance()->logUser($searcher); + + $criteres_potter = (new Class_CriteresRecherche) + ->setParams(['expressionRecherche' => 'Harry Potter', + 'page' => 2]); + + $criteres_davis = (new Class_CriteresRecherche) + ->setParams(['rech_auteurs' => 'Miles Davis', + 'annee_fin' => '1970', + 'page' => 2]); + + $history = new Class_SearchHistory(); + $history->add($criteres_potter); + $history->add($criteres_davis); + + $this->dispatch('/opac/abonne'); + } + + + /** @test */ + public function clearHistoryButtonShouldBePresent() { + $this->assertXPathContentContains('//div[@class="collection_action alone_in_the_list clear_history_button col mr-3 col-3"]/a[@class="card-link clear_history_button btn btn-sm btn-warning"]', 'Vider'); + } +} diff --git a/tests/scenarios/Templates/TemplatesPatronConfigurationsTest.php b/tests/scenarios/Templates/TemplatesPatronConfigurationsTest.php index 65580bb80900e5d4866961d85d6f979781cea27c..f89ea8330a191bee05604654e5a87942cb92a4a5 100644 --- a/tests/scenarios/Templates/TemplatesPatronConfigurationsTest.php +++ b/tests/scenarios/Templates/TemplatesPatronConfigurationsTest.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -require_once 'TemplatesTest.php'; +require_once 'TemplatesAbonneTest.php'; class TemplatesPatronConfigurationsIdentityProvidersNoneAssociatedTest extends TemplatesIntonationAccountTestCase {