Skip to content
Snippets Groups Projects
Commit 82550083 authored by gloas's avatar gloas
Browse files

rel #12091 changing html structure

parent 9dc48b0f
Branches
Tags
2 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!4dev#12091 Moulins portail jeunesse
......@@ -30,7 +30,7 @@ if ($this->is_pertinence) {
if ($this->breadcrumb)
echo $this->getHelper('RenderDomainBrowser')
->displayParentsDomains($this->breadcrumb);
->displayDomains($this->current_domain, $this->breadcrumb);
?>
......
......@@ -25,8 +25,7 @@ class ZendAfi_View_Helper_RenderDomainBrowser extends ZendAfi_View_Helper_BaseHe
$current_domain = Class_Catalogue::getRoot();
return
$this->displayParentsDomains($current_breadcrumb).
'<ul>'.$this->displayDomain($current_domain,$current_breadcrumb).'</ul>'.
$this->displayDomains($current_domain,$current_breadcrumb).
$this->displayChildrenDomains($current_domain->getChildren(),
$this->constructBreadcrumb($current_domain,$current_breadcrumb));
}
......@@ -36,7 +35,7 @@ class ZendAfi_View_Helper_RenderDomainBrowser extends ZendAfi_View_Helper_BaseHe
foreach($children_domains as $child) {
$html.=$this->displayDomain($child,$parents_domains);
}
return '<div class="domains_children"><ul>'.$html.'</ul></div>';
return '<div class="children_domains"><ul>'.$html.'</ul></div>';
}
protected function constructBreadcrumb($current_domain,$current_breadcrumb) {
......@@ -46,18 +45,21 @@ class ZendAfi_View_Helper_RenderDomainBrowser extends ZendAfi_View_Helper_BaseHe
: $current_domain->getId();
}
public function displayParentsDomains($breadcrumb) {
public function displayDomains($current_domain, $breadcrumb) {
if (!$breadcrumb)
return '';
$html="<div class='domains_breadcrumb'><ul>";
$parents_domain_html='';
$parents_domains=Class_Catalogue::getDomainsForBreadcrumb($breadcrumb);
$new_breadcrumb='';
foreach($parents_domains as $domain) {
$html.=$this->displayDomain($domain,$new_breadcrumb);
$parents_domain_html.=$this->displayDomain($domain,$new_breadcrumb);
$new_breadcrumb=$this->constructBreadcrumb($domain,$new_breadcrumb);
}
return $html."</ul></div>";
return
'<div class="breadcrumb_domains">'.
'<ul>'.$parents_domain_html.$this->displayDomain($current_domain, $breadcrumb).'</ul>'.
'</div>';
}
protected function displayDomain($domain,$breadcrumb) {
......
......@@ -140,42 +140,42 @@ class RechercheControllerDomainsBrowsing extends DomainsControllerTest {
/** @test */
public function browsingYouthDomainShouldDisplayLinkToLetterADomain() {
$this->dispatch('/domains/browse/id/3');
$this->assertXPath('//a[@href="/domains/browse/id/4/parents/3"]');
$this->assertXPath('//div[@class="children_domains"]/ul/li/a[@href="/domains/browse/id/4/parents/3"]');
}
/** @test */
public function browsingYouthDomainShouldDisplayLinkToLetterCDomain() {
$this->dispatch('/domains/browse/id/3');
$this->assertXPath('//a[@href="/domains/browse/id/6/parents/3"]');
$this->assertXPath('//div[@class="children_domains"]/ul/li/a[@href="/domains/browse/id/6/parents/3"]');
}
/** @test */
public function browsingADomainShouldDisplayLinkAnimalsDomainAsRechercheSimple() {
$this->dispatch('/domains/browse/id/4/parents/3');
$this->assertXPath('//a[@href="/recherche/simple/id/10/parents/3%3B4"]');
$this->assertXPath('//div[@class="children_domains"]/ul/li/a[@href="/recherche/simple/id_catalogue/10/parents/3%3B4"]');
}
/** @test */
public function browsingADomainShouldDisplayLinkADomain() {
$this->dispatch('/domains/browse/id/4/parents/3');
$this->assertXPath('//a[@href="/domains/browse/id/4/parents/3"]');
$this->assertXPath('//div[@class="breadcrumb_domains"]/ul/li/a[@href="/domains/browse/id/4/parents/3"]');
}
/** @test */
public function browsingADomainShouldDisplayLinkToYouthDomain() {
$this->dispatch('/domains/browse/id/4/parents/3');
$this->assertXPath('//a[@href="/domains/browse/id/3"]/img[@src="http://imgs/youth.png"]');
$this->assertXPath('//div[@class="breadcrumb_domains"]/ul/li/a[@href="/domains/browse/id/3"]/img[@src="http://imgs/youth.png"]');
}
/** @test **/
public function browsingCLetterDomainShouldDisplayLinkToCarAndLinkToCinema() {
$this->dispatch('/domains/browse/id/6/parents/3');
$this->assertXPathCount('//a[contains(@href,"/recherche/simple/id")]', 2);
$this->assertXPathCount('//div[@class="children_domains"]/ul/li/a[contains(@href,"/recherche/simple/id")]', 2);
}
......@@ -188,7 +188,7 @@ class RechercheControllerDomainsBrowsing extends DomainsControllerTest {
/** @test */
public function browsingCarDomainShouldDisplayBreadcrumb() {
$this->dispatch('/domains/browse/id/15/parents/3;6',true);
$this->assertXPath('//div[@class="domains_breadcrumb"]//a[@href="/domains/browse/id/3"]', $this->_response->getBody());
$this->assertXPath('//div[@class="breadcrumb_domains"]/ul/li/a[@href="/domains/browse/id/3"]');
}
}
......
......@@ -33,16 +33,20 @@ abstract class ZendAfi_View_Helper_Accueil_DomainBrowserTestCase extends ViewHel
['id' => 1,
'libelle' => 'Metal']);
$this->fixture('Class_Catalogue',
['id' => 2,
'libelle' => 'Jazz',
['id' => 5,
'libelle' => 'Mes domaines',
'sous_domaines' => [
$this->fixture('Class_Catalogue',
['id' => 21,
'libelle' => 'BeBop']),
$this->fixture('Class_Catalogue',
['id' => 22,
'libelle' => 'Acid'])
]]);
['id' => 2,
'libelle' => 'Jazz',
'sous_domaines' => [
$this->fixture('Class_Catalogue',
['id' => 21,
'libelle' => 'BeBop']),
$this->fixture('Class_Catalogue',
['id' => 22,
'libelle' => 'Acid'])
]])]]);
}
}
......@@ -53,12 +57,12 @@ class ZendAfi_View_Helper_Accueil_DomainBrowserWithDomainTest extends ZendAfi_Vi
parent::setUp();
$helper = new ZendAfi_View_Helper_Accueil_DomainBrowser(9, [
'division' => 1,
'type_module' => 'DOMAIN_BROWSER',
'preferences' => [
'boite' => '',
'titre' => 'Browse Jazz domain',
'root_domain_id' => '2']]);
'division' => 1,
'type_module' => 'DOMAIN_BROWSER',
'preferences' => [
'boite' => '',
'titre' => 'Browse Jazz domain',
'root_domain_id' => '2']]);
$helper->setView(new ZendAfi_Controller_Action_Helper_View());
$this->_html = $helper->getBoite();
......@@ -72,14 +76,15 @@ class ZendAfi_View_Helper_Accueil_DomainBrowserWithDomainTest extends ZendAfi_Vi
/** @test */
public function linkForDomainBeBopShouldBePresent() {
$this->assertXPath($this->_html, '//a[contains(@href, "/recherche/simple/id_catalogue/21")]', $this->_html);
$this->assertXPath($this->_html, '//div[@class="domain_children"]//a[contains(@href, "/recherche/simple/id_catalogue/21")]', $this->_html);
}
/** @test */
public function linkForDomainAcidShouldBePresent() {
$this->assertXPath($this->_html, '//a[contains(@href, "/recherche/simple/id_catalogue/22")]', $this->_html);
$this->assertXPath($this->_html, '//div[@class="domain_children"]//a[contains(@href, "/recherche/simple/id_catalogue/22")]', $this->_html);
}
}
......@@ -90,9 +95,9 @@ class ZendAfi_View_Helper_Accueil_DomainBrowserWithoutConfigTest extends ZendAfi
parent::setUp();
$helper = new ZendAfi_View_Helper_Accueil_DomainBrowser(9, [
'division' => 1,
'type_module' => 'DOMAIN_BROWSER',
'preferences' => []]);
'division' => 1,
'type_module' => 'DOMAIN_BROWSER',
'preferences' => []]);
$helper->setView(new ZendAfi_Controller_Action_Helper_View());
$this->_html = $helper->getBoite();
......@@ -101,13 +106,13 @@ class ZendAfi_View_Helper_Accueil_DomainBrowserWithoutConfigTest extends ZendAfi
/** @test */
public function linkForDomainMetalShouldBePresent() {
$this->assertXPath($this->_html, '//div//ul//li//a[contains(@href, "/recherche/simple/id_catalogue/1")]', $this->_html);
$this->assertXPath($this->_html, '//div[@class="domain_children"]//ul//li//a[contains(@href, "/recherche/simple/id_catalogue/1")]', $this->_html);
}
/** @test */
public function linkForDomainJazzShouldBePresent() {
$this->assertXPath($this->_html, '//div//ul//a[contains(@href, "/recherche/simple/id_catalogue/2")]', $this->_html);
$this->assertXPath($this->_html, '//div[@class="domain_children"]//ul//a[contains(@href, "/recherche/simple/id_catalogue/2")]', $this->_html);
}
}
......
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