Skip to content
Snippets Groups Projects
Commit 7ca63e34 authored by Laurent's avatar Laurent
Browse files

Merge branch...

Merge branch 'hotline#118409_sitotheque_de_la_bibliotheque_numerique_avoir_toutes_les_infos_dans_le_marcxml' into 'hotline'

hotline#118409 : album display : when displaying website, link to open url in…

See merge request !3727
parents 33cd6223 64af2102
Branches
Tags
1 merge request!3727hotline#118409 : album display : when displaying website, link to open url in…
Pipeline #11663 failed with stage
in 1 hour
- ticket #118409 : Sitothèque : avoir toujours un lien pour pouvoir ouvrir le site dans un nouvel onglet
......@@ -33,32 +33,29 @@ class ZendAfi_View_Helper_TagWebSite extends ZendAfi_View_Helper_BaseHelper {
$this->_tag('section',
$this->_tag('h3', $site->getTitre())
. $this->_tag('p', $site->getDescription())
. $this->renderLink($site));
. implode($this->_tag('br'), $this->renderLink($site)));
}
public function renderLink($site) {
$label = $this->_('Ouvrir le site dans un nouvel onglet');
$options = ['href' => $site->getUrl(),
'target' => '_blank',
'title' => $label];
'target' => '_blank'];
if (!$preview = $this->_previewSite($site)) {
$preview = $label;
unset($options['title']);
}
$html = [];
return $this->_tag('a', $preview, $options);
}
$html [] = $this->_tag('a', $label, $options);
protected function _previewSite($site) {
return ($poster = $site->getPoster())
? $this->_tag('img', null,
if ($poster = $site->getPoster()) {
$options['title'] = $label;
$preview = $this->_tag('img', null,
['src' => $site->getPosterUrl(),
'alt' => '',
'style' => 'max-width: 100%'])
'style' => 'max-width: 100%']);
$html [] = $this->_tag('a', $preview, $options);
: '';
}
return $html;
}
}
......@@ -168,9 +168,16 @@ class RechercheControllerAlbumWebSiteLinuxFrResNumeriquesTest extends RechercheC
/** @test */
public function imageLinuxFRDotJpgShouldBeDisplayedInAnchorToLinuxFR() {
$this->assertXPath('//a[@href="http://www.linuxfr.org"][@title="Ouvrir le site dans un nouvel onglet"]'.
'//img[contains(@src, "linuxfr.jpg")]');
}
/** @test */
public function linkWithHrefLinuxFRDotOrgAndTextOuvrirleSiteShouldBeDisplayed() {
$this->assertXPath('//a[@href="http://www.linuxfr.org"]'.
'//img[contains(@src, "linuxfr.jpg")][@title="Ouvrir le site dans un nouvel onglet"]',
$this->_response->getBody());
'[text()="Ouvrir le site dans un nouvel onglet"]');
}
}
......
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