diff --git a/VERSIONS_HOTLINE/65092 b/VERSIONS_HOTLINE/65092 new file mode 100644 index 0000000000000000000000000000000000000000..2029c2ed99163af7c40c8d3f1a1e347699567a56 --- /dev/null +++ b/VERSIONS_HOTLINE/65092 @@ -0,0 +1,2 @@ + - ticket #65092 : Administration : correction de l'affichage des boutons de gestion de la vignette d'une notice. + \ No newline at end of file diff --git a/application/modules/opac/views/scripts/recherche/viewnotice.phtml b/application/modules/opac/views/scripts/recherche/viewnotice.phtml index 7ccc61979428d44ba625ce615ade13d53634a274..c13acd9cebf388675fe8f11ce8413b73ff0ded22 100644 --- a/application/modules/opac/views/scripts/recherche/viewnotice.phtml +++ b/application/modules/opac/views/scripts/recherche/viewnotice.phtml @@ -53,21 +53,23 @@ $script_loader = Class_ScriptLoader::getInstance() ZendAfi_View_Helper_Notice_Vignette::MODE_VIEW); if ($this->display_modifier_vignette_link) - echo $this->tagAnchor(['module' => 'admin', 'controller' => 'records', 'action' => 'thumbnail'], - $this->_('Modifier la vignette'), - ['title' => $this->_('Modifier la vignette de la notice "%s"', - $this->notice->getTitrePrincipal()), - 'data-popup' => 'true', - 'class' => 'bouton'] - ); + echo $this->admin_button((new Class_Entity()) + ->setUrl($this->url(['module' => 'admin', + 'controller' => 'records', + 'action' => 'thumbnail'])) + ->setText($this->_('Modifier')) + ->setAttribs(['title' => $this->_('Modifier la vignette de la notice "%s"', + $this->notice->getTitrePrincipal()), + 'data-popup' => 'true'])); if ($this->show_reset_thumbnail_link) - echo $this->tagAnchor(['module' => 'admin', 'controller' => 'records', 'action' => 'reset-thumbnail'], - $this->_('Générer la vignette'), - ['title' => $this->_('Supprimer et re-générer la vignette de la notice "%s"', - $this->notice->getTitrePrincipal()), - 'class' => 'bouton'] - ); + echo $this->admin_button((new Class_Entity()) + ->setUrl($this->url(['module' => 'admin', + 'controller' => 'records', + 'action' => 'reset-thumbnail'])) + ->setText($this->_('Générer')) + ->setAttribs(['title' => $this->_('Supprimer et re-générer la vignette de la notice "%s"', + $this->notice->getTitrePrincipal())])); ?> <div id="reseaux-sociaux"><?php echo $this->reseauxSociaux($this->notice); ?></div> diff --git a/public/opac/js/subModal.js b/public/opac/js/subModal.js index a7b0c32e6ad3a8ba2cbc382abd8e6a75f76e7cf1..3c632ded35add265415650dbd972a4a32dc101c9 100644 --- a/public/opac/js/subModal.js +++ b/public/opac/js/subModal.js @@ -6,13 +6,15 @@ window.initializePopups = function() { $('[data-popup="true"]') - .unbind('click').click(function(event){ + .prop('onclick', null) + .off('click') + .click(function(event){ event.preventDefault(); current_anchor=$(this); addLoadingClass(); - var url = $(this).attr('data-url') - ? $(this).attr('data-url') - : $(this).attr('href'); + var url = $(this).attr('data-url') + ? $(this).attr('data-url') + : $(this).attr('href'); opacDialogFromUrl(addPath(url, '/render/popup')); }); current_anchor = undefined; @@ -32,10 +34,10 @@ form.submit(function(event) { event.preventDefault(); setTimeout( //wait for all bind events to be executed (ex: input manipulation events / treeselect) - function() { - window.doSubmit(form) ; - }, - 1); + function() { + window.doSubmit(form) ; + }, + 1); }); } @@ -176,8 +178,8 @@ window.opacDialog = function(container, data) { container[0].innerHTML = data['content']; var show_modal = (data['show_modal'] && data['show_modal']=='true') - ? true - : false; + ? true + : false; var dialog = null; @@ -185,18 +187,18 @@ title: data['title'], modal:show_modal, close: function(event, ui) { - onClose(event, ui) + onClose(event, ui) }, open: function(event, ui) { - dialog = $(event.target).closest('.ui-widget'); - setTimeout(onOpen(dialog), 100); + dialog = $(event.target).closest('.ui-widget'); + setTimeout(onOpen(dialog), 100); }, resizeStart: function(event, ui) { - dialog.css('position', 'absolute'); + dialog.css('position', 'absolute'); }, resizeStop: function(event, ui) { - dialog.css('position', 'fixed'); - dialog.position({of: $(window)}); + dialog.css('position', 'fixed'); + dialog.position({of: $(window)}); } }); @@ -208,19 +210,19 @@ window.addLoadingClass = function () { var initCurrentAnchor = function() { if (current_anchor != undefined) - return current_anchor; + return current_anchor; var dialog_form = $('#opac-dialog form'); if (!dialog_form.length) - return undefined; + return undefined; current_anchor = undefined; var action = dialog_form[0].getAttribute('action'); $('body').find('a[class*="edit_"], .configuration_module a').each(function() { - var href = $(this)[0].getAttribute('href'); - if(action.indexOf(href) > -1 || href.indexOf(action) > -1) { - return current_anchor = $(this); - } + var href = $(this)[0].getAttribute('href'); + if(action.indexOf(href) > -1 || href.indexOf(action) > -1) { + return current_anchor = $(this); + } }); return current_anchor; }; diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index fdcca390213b0d40f175ab21046e29e705977bf7..346d3e0484bee70513cf3801d5d4daeb2b9472ea 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -799,7 +799,7 @@ class RechercheControllerUploadVignetteTest extends RechercheControllerNoticeTes public function linkToUploadVignetteShouldBePresentForModoBib() { Class_Users::getIdentity()->changeRoleTo(ZendAfi_Acl_AdminControllerRoles::MODO_BIB); $this->dispatch(sprintf('recherche/viewnotice/id/%d', $this->notice->getId()), true); - $this->assertXPathContentContains('//a', 'Modifier la vignette'); + $this->assertXPath('//button[contains(@title, "Modifier la vignette")]'); } @@ -820,7 +820,7 @@ class RechercheControllerUploadVignetteTest extends RechercheControllerNoticeTes 'famille_id' => Class_CodifTypeDoc::LIVRE]); $this->dispatch(sprintf('recherche/viewnotice/id/%d', $this->notice->getId()), true); - $this->assertXPathContentContains('//a', 'Modifier la vignette'); + $this->assertXPath('//button[contains(@title, "Modifier la vignette")]'); } } @@ -833,7 +833,7 @@ class RechercheControllerGenerateThumbnailTest extends RechercheControllerNotice public function linkToGenerateThumbnailShouldNotBePresentForAbonneSIGB() { Class_Users::getIdentity()->beAbonneSIGB(); $this->dispatch(sprintf('recherche/viewnotice/id/%d', $this->notice->getId()), true); - $this->assertNotXPath('//a[contains(@href, "admin/records/reset-thumbnail")]'); + $this->assertNotXPath('//button[contains(@onclick, "admin/records/reset-thumbnail")][contains(@title, "Supprimer et re-générer la vignette")]'); } @@ -841,8 +841,7 @@ class RechercheControllerGenerateThumbnailTest extends RechercheControllerNotice public function linkToGenerateThumbnailShouldBePresentForModoBib() { Class_Users::getIdentity()->changeRoleTo(ZendAfi_Acl_AdminControllerRoles::MODO_BIB); $this->dispatch(sprintf('recherche/viewnotice/id/%d', $this->notice->getId()), true); - $this->assertXPathContentContains('//a[contains(@href, "admin/records/reset-thumbnail")]', - 'Générer la vignette'); + $this->assertXPath('//button[contains(@onclick, "admin/records/reset-thumbnail")][contains(@title, "Supprimer et re-générer la vignette")]'); } } @@ -861,7 +860,7 @@ class RechercheControllerViewNoticeAsAdminTest extends RechercheControllerNotice /** @test */ public function linkToUploadVignetteShouldBePresent() { - $this->assertXPathContentContains('//a', 'Modifier la vignette',$this->_response->getBody()); + $this->assertXPath('//button[contains(@title, "Modifier la vignette")]'); }