Skip to content
Snippets Groups Projects
Commit 616543e0 authored by Laurent's avatar Laurent
Browse files

dev #59497 add select record in wall mode

parent 9785b799
Branches
Tags
3 merge requests!2869Master,!2831Dev#59497 2 2955 contractuel minsoc09 selectionner pour mise en panier etou imprimer et pouvoir faire tout,!2828Dev#59497 2 2955 contractuel minsoc09 selectionner pour mise en panier etou imprimer et pouvoir faire tout
Pipeline #4981 failed with stage
in 46 minutes and 32 seconds
......@@ -20,6 +20,13 @@
*/
abstract class ZendAfi_View_Helper_ListeNotices_Abstract extends ZendAfi_View_Helper_BaseHelper {
protected function _updatePreferences($preferences) {
return array_merge(['liste_codes' => 'TANE',
'display_add_to_cart' => true,
'display_select_record' => false],
$preferences);
}
protected function _divRecord($html, $record, $class) {
return $this->_tag('div',
$html,
......
......@@ -22,6 +22,7 @@ class ZendAfi_View_Helper_ListeNotices_Mur extends ZendAfi_View_Helper_ListeNoti
public function ListeNotices_Mur($data, $preferences=[]) {
$this->loadScript();
$preferences = $this->_updatePreferences($preferences);
$notices = [];
foreach($data as $notice)
......@@ -35,9 +36,7 @@ class ZendAfi_View_Helper_ListeNotices_Mur extends ZendAfi_View_Helper_ListeNoti
protected function _notice_mur($notice, $preferences=[]) {
$champs = isset($preferences['liste_codes'])
? $preferences['liste_codes']
: 'TANE';
$champs = $preferences['liste_codes'];
$datas = [$this->_tag('span',
$this->view->tagAnchor($this->view->urlNotice($notice, $preferences),
......@@ -63,7 +62,7 @@ class ZendAfi_View_Helper_ListeNotices_Mur extends ZendAfi_View_Helper_ListeNoti
. $this->_tag('div',
implode($datas),
['class' => 'titre_auteur'])
. $this->barreDeLien($notice);
. $this->barreDeLien($notice, $preferences);
$html = $this->_divRecord($html, $notice, 'notice');
......@@ -73,11 +72,12 @@ class ZendAfi_View_Helper_ListeNotices_Mur extends ZendAfi_View_Helper_ListeNoti
}
protected function barreDeLien($notice){
protected function barreDeLien($notice, $preferences){
$html = [$this->_usersReviews($notice),
$this->_adminsReviews($notice),
$this->_socialNetwork($notice),
$this->barreDeLienPanier($notice),
$this->barreDeLienPanier($notice, $preferences),
$this->barreDeLienSelectCheckbox($notice, $preferences),
$this->barreDeLienReserver($notice)];
return implode([$this->_recordAvailability($notice),
......@@ -143,7 +143,19 @@ class ZendAfi_View_Helper_ListeNotices_Mur extends ZendAfi_View_Helper_ListeNoti
}
protected function barreDeLienPanier($notice) {
return $this->view->tag('li', $this->view->tagAddToCart($notice));
protected function barreDeLienPanier($notice, $preferences) {
return ($preferences['display_add_to_cart'])
? $this->view->tag('li',
$this->view->tagAddToCart($notice),
['class' => 'add_to_cart'])
: '';
}
protected function barreDeLienSelectCheckbox($record, $preferences) {
return ($preferences['display_select_record'])
? $this->_tag('li', $this->view->tagSelectRecord($record))
: '';
}
}
\ No newline at end of file
......@@ -25,10 +25,7 @@ class ZendAfi_View_Helper_ListeNotices_Vignettes extends ZendAfi_View_Helper_Lis
public function listeNotices_Vignettes($data, $preferences=[]) {
$this->loadScript();
$preferences = array_merge(['liste_codes' => 'TANE',
'display_add_to_cart' => true,
'display_select_record' => false],
$preferences);
$preferences = $this->_updatePreferences($preferences);
$html = '';
foreach($data as $notice){
......@@ -38,7 +35,9 @@ class ZendAfi_View_Helper_ListeNotices_Vignettes extends ZendAfi_View_Helper_Lis
$preferences);
}
return $this->_tag('div', $html, ['class' => 'liste_vignettes']);
return $this->_tag('div',
$html,
['class' => 'liste_vignettes']);
}
......
......@@ -2510,7 +2510,7 @@ button.vodeclic_link + img {
background: url(../images/bouton/partager.png) no-repeat center center;
}
.barre-de-lien li:first-child+li+li+li{
.barre-de-lien li.add_to_cart {
background: url(../../admin/images/picto/paniers_16.png) no-repeat center center;
}
......
......@@ -255,7 +255,7 @@ class ZendAfi_View_Helper_ListeNotices_Mur_BarreDeLienTest extends ZendAfi_View_
/** @test */
public function barreDeLienShouldContainUrlAjoutPanier() {
$this->assertXPath($this->_html, '//a[contains(@href, "panier/add-record-ajax/id_notice/34")]', $this->_html);
$this->assertXPath($this->_html, '//li[@class="add_to_cart"]//a[contains(@href, "panier/add-record-ajax/id_notice/34")]', $this->_html);
}
......
......@@ -513,4 +513,34 @@ class SearchSelectionPostSwitchCartTest extends SearchSelectionAddToCartWithUser
public function responseShouldBeARedirectToAddSelection() {
$this->assertRedirectTo('/panier/add-selection');
}
}
class SearchSelectionWithSessionViewWallModeTest extends SearchSelectionTestCase {
public function setUp() {
parent::setUp();
Class_Profil::getCurrentProfil()
->setCfgModules(['recherche' =>
['resultatsimple' =>
[
'liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_MUR,
'liste_codes' => "TAN9"]]]);
$this->dispatch('/recherche/simple/expressionRecherche/pomme/facettes/T3/page/1', true);
}
/** @test */
public function pageShouldContainsUCheckboxToSelectMilleniumRecord() {
$this->assertXPath('//ul[@class="barre-de-lien"]/li/input[@type="checkbox"][@value="9"][@name="select_record_9"]');
}
/** @test */
public function pageShouldNotIncludeLinkAddRecordAjaxOnBasket() {
$this->assertNotXPath('//a[contains(@href, "panier/add-record-ajax/")]');
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment