Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (4)
Showing
with 111 additions and 29 deletions
- correctif #190091 : Page de connexion activée : lien de réservation au niveau de l'exemplaire non actif
\ No newline at end of file
- correctif #190239 : Suppression des favoris: message json au lieu de revenir sur la page
\ No newline at end of file
......@@ -33,7 +33,6 @@ class Class_Button {
$_disable_popup = false,
$_attribs = [];
public function getElement() {
return $this->_element;
}
......@@ -68,6 +67,9 @@ class Class_Button {
public function getUrl() {
if ($this->getDisablePopup())
$this->_url = str_replace('/render/popup', '', $this->_url);
return $this->_url;
}
......@@ -147,7 +149,7 @@ class Class_Button {
public function getAttrib($name, $default=null) {
return $this->hasAttrib($name)
? $this->_attribs[$name]
: $default;
: $default;
}
......
......@@ -31,6 +31,12 @@ trait Trait_AuthenticationProfile {
$this->_after_login_do = $after_login_do;
}
public function popupOnAuthenticateProfile(): bool{
return $this->_authenticateProfile() === null;
}
public function _authenticateProfile() : ?Class_Profil {
if ( $this->_profile)
return $this->_profile;
......
......@@ -58,7 +58,7 @@ class ZendAfi_View_Helper_Button extends ZendAfi_View_Helper_BaseHelper {
if (($url = $button->getUrl()) && is_string($url))
$button->setAttrib('onclick', sprintf('window.location.href = \'%s\';',
$this->_escapeJsAttrib($button->getUrl())));
$this->_escapeJsAttrib($url)));
return $this;
}
......
......@@ -91,10 +91,7 @@ class Intonation_Library_Selection {
$js =
sprintf("event.preventDefault(); event.stopPropagation(); var url = $(this).attr('href'); var anchors = $('a[href=\'' + url + '\']'); $.ajax({type: 'GET', url: '%s', success: function(data) {if (data){return anchors.replaceWith(data.anchor);} return false;}});",
$url);
$popup = Class_Users::getIdentity()
? false
: (null === $this->_authenticateProfile());
$popup = !Class_Users::getIdentity() && $this->popupOnAuthenticateProfile();
return (new Intonation_Library_Link)
->setUrl($url)
......
......@@ -99,11 +99,11 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp
: $this->_view->tag('span', $this->_('Non réservable'), ['class' => 'align-middle text-black-50']);
return (new Intonation_Library_Link)
->setUrl($hold_link)
->setText($secondary_title)
->setTitle($title)
->setAttrib('text-hold', $text)
->setPopup(true);
->setUrl($hold_link)
->setText($secondary_title)
->setTitle($title)
->setAttrib('text-hold', $text)
->setPopup($this->popupOnAuthenticateProfile());
}
......
......@@ -64,7 +64,7 @@ class Intonation_Library_View_Wrapper_ItemWithoutSIGB extends Intonation_Library
->setText($text)
->setImage($this->getSecondaryIco())
->setTitle($title)
->setPopup((null === $this->_authenticateProfile()))];
->setPopup($this->popupOnAuthenticateProfile())];
}
}
......@@ -591,7 +591,7 @@ class Intonation_Library_View_Wrapper_Record
->setText($this->_('Réserver'))
->setTitle($this->_('Réserver le document %s', $this->getMainTitleAsText()))
->setClass('hold_record doctype_id_' . $this->getDocType())
->setPopup((null === $this->_authenticateProfile()));
->setPopup($this->popupOnAuthenticateProfile());
return $actions;
}
......@@ -641,7 +641,7 @@ class Intonation_Library_View_Wrapper_Record
->setScreenReaderText($this->_('%s dans une sélection', $this->_model->getTitrePrincipal(' ')))
->setTitle($this->_('Ajouter %s dans une sélection', $this->_model->getTitrePrincipal(' ')))
->setClass('add_record_to_selection')
->setPopup((null === $this->_authenticateProfile()));
->setPopup($this->popupOnAuthenticateProfile());
}
......
......@@ -193,7 +193,7 @@ class Intonation_Library_View_Wrapper_Review extends Intonation_Library_View_Wra
->setImage($this->getIco('edit', 'utils'))
->setText($this->_('Modifier'))
->setTitle($this->_('Modifier l\'avis %s', $this->_model->getEntete()))
->setPopup((null === $this->_authenticateProfile()));
->setPopup($this->popupOnAuthenticateProfile());
return $actions;
}
......@@ -211,7 +211,7 @@ class Intonation_Library_View_Wrapper_Review extends Intonation_Library_View_Wra
->setText($this->_('Supprimer'))
->setTitle($this->_('Supprimer l\'avis %s', $this->_model->getEntete()))
->setClass('text-danger')
->setPopup((null === $this->_authenticateProfile()));
->setPopup($this->popupOnAuthenticateProfile());
return $actions;
}
......
......@@ -45,7 +45,7 @@ class Intonation_Library_View_Wrapper_ReviewInRecord
->setImage($this->getIco('read-review', 'library'))
->setText($this->_('Lire l\'avis'))
->setTitle($this->_getMainLinkTitle())
->setPopup((null === $this->_authenticateProfile()));
->setPopup($this->popupOnAuthenticateProfile());
}
......
......@@ -137,7 +137,7 @@ class Intonation_Library_View_Wrapper_Search
: $this->_('Ne plus suivre cette recherche.'))
->alwaysDisplayText()
->setScreenReaderText($this->_model->getLabel())
->setPopup((null === $this->_authenticateProfile()))];
->setPopup($this->popupOnAuthenticateProfile())];
}
......
......@@ -209,7 +209,7 @@ class Intonation_Library_View_Wrapper_Selection extends Intonation_Library_View_
->setText($this->_('Exporter'))
->setTitle($this->_('Exporter la sélection %s', $this->_model->getLibelle()))
->setScreenReaderText($this->_('la sélection %s', $this->_model->getLibelle()))
->setPopup((null === $this->_authenticateProfile()));
->setPopup($this->popupOnAuthenticateProfile());
if ( ! $this->_model->canBeEditedByMe())
return $actions;
......@@ -237,7 +237,7 @@ class Intonation_Library_View_Wrapper_Selection extends Intonation_Library_View_
->setText($this->_('Renommer'))
->setTitle($this->_('Renommer la sélection %s', $this->_model->getLibelle()))
->setAriaLabel($this->_('Renommer la sélection %s', $this->_model->getLibelle()))
->setPopup((null === $this->_authenticateProfile()));
->setPopup($this->popupOnAuthenticateProfile());
$actions[] = (new Intonation_Library_Link)
->setUrl($this->_view->url(['controller' => 'panier',
......@@ -247,7 +247,7 @@ class Intonation_Library_View_Wrapper_Selection extends Intonation_Library_View_
->setText($this->_('Domaines liés'))
->setTitle($this->_('Lier la sélection %s à un domaine', $this->_model->getLibelle()))
->setAriaLabel($this->_('Lier la sélection %s à un domaine', $this->_model->getLibelle()))
->setPopup((null === $this->_authenticateProfile()));
->setPopup($this->popupOnAuthenticateProfile());
$actions[] = (new Intonation_Library_Link)
->setUrl($this->_view->url(['controller' => 'abonne',
......@@ -258,7 +258,7 @@ class Intonation_Library_View_Wrapper_Selection extends Intonation_Library_View_
->setTitle($this->_('Supprimer la sélection %s', $this->_model->getLibelle()))
->setAriaLabel($this->_('Supprimer la sélection %s', $this->_model->getLibelle()))
->setClass('text-danger')
->setPopup((null === $this->_authenticateProfile()));
->setPopup($this->popupOnAuthenticateProfile());
return $actions;
}
......
......@@ -63,7 +63,7 @@ class Intonation_View_Search_Preferences extends ZendAfi_View_Helper_Bookmarks {
$url,
$this->view->templateIco('settings', 'library',['title' => $this->_('Modifier mes préférences dans une boîte de dialogue')] ),
['class' => 'bookmarks_edit ml-2',
'data-popup' => (null === $this->_authenticateProfile()),
'data-popup' => $this->popupOnAuthenticateProfile(),
'aria-label' => $this->_('Configuration de mes préférences de recherche')]);
}
......
......@@ -214,8 +214,8 @@ class ChiliItemsWithKohaTest extends AbstractControllerTestCase {
/** @test */
public function pageShouldContainsLinkToHold() {
$this->assertXPathContentContains('//div[@class="items_hold_link col-12 p-3 my-3 text-center"]//a[@href= "/recherche/reservation-pickup-ajax/id/2/id_notice/2/id_int_bib/1/id_bib/1/copy_id/1"]',
public function pageShouldContainsLinkAsDataPopupToHold() {
$this->assertXPathContentContains('//div[@class="items_hold_link col-12 p-3 my-3 text-center"]//a[@href= "/recherche/reservation-pickup-ajax/id/2/id_notice/2/id_int_bib/1/id_bib/1/copy_id/1"][@data-popup="1"]',
utf8_encode('Réserver'));
}
}
......@@ -377,6 +377,27 @@ class TemplatesAbonneSelectionsSupprimerDeLaSelectionTest
class TemplatesAbonneSelectionsSupprimerLaSelectionAjaxTest extends TemplatesAbonneSelectionsTestCase {
/** @test */
public function questionToDeleteShouldBePresent() {
$this->dispatch('/opac/abonne/supprimer-la-selection/selection_id/2/id_profil/72/render/popup');
$json = json_decode($this->_response->getBody(),true);
$this->assertContains('Oui', $json['content']);
$this->assertNotContains('id_profil/72/render/popup/', $json['content']);
}
/** @test */
public function selection2ShouldHaveBeenDeleted() {
$this->dispatch('/opac/abonne/supprimer-la-selection/selection_id/2/id_profil/72/delete/1/render/popup');
$this->assertNull(Class_PanierNotice::find(2));
}
}
class TemplatesAbonneSelectionsSupprimerLaSelectionTest extends TemplatesAbonneSelectionsTestCase {
/** @test */
......
......@@ -731,6 +731,62 @@ abstract class TemplatesSearchWithItemsLinkToSIGBTestCase
class TemplatesSearchDispatchIntentNoticeAjaxResourcesTest
extends TemplatesSearchWithItemsLinkToSIGBTestCase {
protected $_url_path='//div[contains(@class, "card_body_Intonation_Library_View_Wrapper_Item")]//a[contains(@href, "/recherche/reservation-pickup-ajax/id/34/id_notice/34/id_int_bib/2/id_bib/23")][@data-popup="1"]';
/** @test */
public function firstItemShouldHaveLinkToPickupAjax() {
$this->dispatch('/noticeajax/resources/id/34');
$this->assertXPath($this->_url_path);
}
/** @test */
public function firstItemConnectedUserShouldHaveLinkToPickupAjax() {
ZendAfi_Auth::getInstance()
->logUser(Class_Users::newInstanceWithIdAssertSave(332,
['login' => 'bob',
'password' => 'eponge']));
$this->dispatch('/noticeajax/resources/id/34');
$this->assertXPath($this->_url_path);
}
/** @test */
public function firstItemShouldHaveLinkNotDataPopupToPickupAjax() {
$this->_buildTemplateProfil(['id' => 2,
'libelle' => 'auth',
'parent_id' => 1,
'intent' => Class_Profil::INTENT_AUTHENTICATION]);
$this->dispatch('/noticeajax/resources/id/34');
$this->assertNotXPath($this->_url_path);
}
/** @test */
public function firstItemConnectedUserShouldHaveLinkWithDataPopupToPickupAjax() {
ZendAfi_Auth::getInstance()
->logUser(Class_Users::newInstanceWithIdAssertSave(332,
['login' => 'bob',
'password' => 'eponge']));
$this->_buildTemplateProfil(['id' => 2,
'libelle' => 'auth',
'parent_id' => 1,
'intent' => Class_Profil::INTENT_AUTHENTICATION]);
$this->dispatch('/noticeajax/resources/id/34');
$this->assertXPath($this->_url_path);
}
}
class TemplatesSearchDispatchNoticeAjaxResourcesTest
extends TemplatesSearchWithItemsLinkToSIGBTestCase {
......@@ -755,7 +811,7 @@ class TemplatesSearchDispatchNoticeAjaxResourcesTest
/** @test */
public function firstItemShouldHaveLinkToPickupAjax() {
$this->assertXPath('//div[contains(@class, "card_body_Intonation_Library_View_Wrapper_Item")]//a[contains(@href, "/recherche/reservation-pickup-ajax/id/34/id_notice/34/id_int_bib/2/id_bib/23")]');
$this->assertXPath('//div[contains(@class, "card_body_Intonation_Library_View_Wrapper_Item")]//a[contains(@href, "/recherche/reservation-pickup-ajax/id/34/id_notice/34/id_int_bib/2/id_bib/23")][@data-popup="1"]');
}
......@@ -815,7 +871,6 @@ class TemplatesSearchReservationPickupAjaxTest extends TemplatesSearchWithItemsL
$this->_xpath->assertNotXPath($this->_html,
'//div[@class="dropdown"]');
}
}
......@@ -1039,7 +1094,6 @@ class TemplatesSearchDispatchWithWallDefaultRenderingTest extends TemplatesSearc
public function searchResultShouldBeHtml5Valid() {
$this->assertHTML5();
}
}
......