From 095d4c3168769b2aa66490b992b0d2e909c2f276 Mon Sep 17 00:00:00 2001 From: Julian Maurice <julian.maurice@biblibre.com> Date: Wed, 15 Oct 2014 11:18:25 +0200 Subject: [PATCH] hotline #16951 Reset DOM changes in calendar header introduced by #16320 because they break some skins --- .../ZendAfi/View/Helper/Calendar/Table.php | 6 +-- public/opac/js/calendrier.js | 2 +- .../CmsControllerCalendarActionTest.php | 40 +++++++++++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/library/ZendAfi/View/Helper/Calendar/Table.php b/library/ZendAfi/View/Helper/Calendar/Table.php index 074e6825288..e94d680d0c8 100644 --- a/library/ZendAfi/View/Helper/Calendar/Table.php +++ b/library/ZendAfi/View/Helper/Calendar/Table.php @@ -206,9 +206,9 @@ class ZendAfi_View_Helper_Calendar_Table extends Zend_View_Helper_HtmlElement { ' »', $anchor_class); - $tds_content = $this->view->tag('td', $previews_month, ['class' => 'calendar_title_left_arrow']); - $tds_content.= $this->view->tag('td', $current_month, ['class' => 'calendar_title_month']); - $tds_content.= $this->view->tag('td', $next_month, ['class' => 'calendar_title_right_arrow']); + $tds_content = $this->view->tag('td', '', ['class' => 'calendar_title_left_arrow']); + $tds_content .= $this->view->tag('td', $previews_month . $current_month . $next_month, ['class' => 'calendar_title_month']); + $tds_content .= $this->view->tag('td', '', ['class' => 'calendar_title_right_arrow']); return $this->view->tag('tr', $tds_content, ['class' => 'calendar_title']); } diff --git a/public/opac/js/calendrier.js b/public/opac/js/calendrier.js index a70e163d9f4..6f86838fa3c 100644 --- a/public/opac/js/calendrier.js +++ b/public/opac/js/calendrier.js @@ -1,5 +1,5 @@ var ajaxify_calendars = function () { - var month_link = $(".calendar_ajax_ready, .calendar_title_left_arrow a, .calendar_title_right_arrow a, .calendar .month_list a:not(.no_event), .filters a"); + var month_link = $(".calendar_ajax_ready, a.calendar_title_month_clickable:first-child, a.calendar_title_month_clickable:last-child, .calendar .month_list a:not(.no_event), .filters a"); month_link.click(function(event) { var url = $(this).attr('href'); diff --git a/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php b/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php index ac31275605f..a9dc2cab498 100644 --- a/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php @@ -342,4 +342,44 @@ class CmsControllerCalendarActionWithDayTest extends AbstractControllerTestCase $this->assertXPath('//div[@class="calendar"]//table//a[contains(@class, "day_clickable")][contains(@href, "date/2014-09-15")]'); } } + +class CmsControllerCalendarActionHeaderTest extends AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + $this->cfg_accueil = [ + 'modules' => [ + '1' => [ + 'division' => '1', + 'type_module' => 'CALENDAR', + 'preferences' => [ + 'titre' => 'Rendez-vous', + 'rss_avis' => false, + 'id_categorie' => '12-2', + 'display_cat_select' => true, + 'enabled_filters' => 'date;place;custom_field_2;zork', + 'display_event_info' => 'none' + ] + ] + ], + 'options' => [] + ]; + + + $this->fixture('Class_Profil', + ['id' => 3, + 'browser' => 'opac', + 'libelle' => 'Rendez-vous', + 'cfg_accueil' => $this->cfg_accueil]); + + $this->dispatch('/index/index/id_profil/3'); + } + + /** @test */ + public function calendarHeaderShouldContainsThreeLinks() { + $this->assertXPathCount(3, '//td[@class="calendar_title_month"]/a'); + $this->assertXPathContentContains('//td[@class="calendar_title_month"]/a[1]', '«'); + $this->assertXPathContentContains('//td[@class="calendar_title_month"]/a[3]', '»'); + } +} + ?> \ No newline at end of file -- GitLab