From b5d870fd1aab2f040c40c0fbea502ddcff91e5ca Mon Sep 17 00:00:00 2001 From: gloas <gloas@git-test.afi-sa.fr> Date: Thu, 6 Jun 2013 14:00:44 +0000 Subject: [PATCH] Skin: refactoring permalink --- library/ZendAfi/View/Helper/Permalink.php | 23 ++++++---------- public/opac/css/global.css | 27 +++++++++++++++++++ .../controllers/CatalogueControllerTest.php | 4 +-- .../admin/controllers/CmsControllerTest.php | 4 +-- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/library/ZendAfi/View/Helper/Permalink.php b/library/ZendAfi/View/Helper/Permalink.php index ecef2e4ab67..f52f168a29d 100644 --- a/library/ZendAfi/View/Helper/Permalink.php +++ b/library/ZendAfi/View/Helper/Permalink.php @@ -20,14 +20,6 @@ */ class ZendAfi_View_Helper_Permalink extends ZendAfi_View_Helper_BaseHelper { public function permalink($url) { - $onclick="oPm=$(this).next()[0]; - if(oPm.style.display=='block'){oPm.style.display='none'; return;} - oPm.style.display='block'; - nX=getLeftPos(this); - nY=getTopPos(this); - oPm.style.top=nY + this.clientHeight + 3 +'px'; - oPm.style.left=nX + this.clientWidth - oPm.clientWidth + 'px';"; - $icone_permalink= 'reseaux/permalink.png'; $path_icone_permalink = PATH_SKIN.'images/'.$icone_permalink; $url_icone_permalink = file_exists($path_icone_permalink) @@ -40,14 +32,15 @@ class ZendAfi_View_Helper_Permalink extends ZendAfi_View_Helper_BaseHelper { ['class' => 'permalien-img', 'title' => $lien_permanent, 'alt' => $lien_permanent, - 'onclick' => $onclick,]); + 'onclick' => '$(this).next().children().first().toggle()']); - $html.='<div id="permalink" style="background: #FFFFFF; display:none;position:absolute;padding:8px;text-align:center;border:1px solid #C8C8C8">'; - $html.= sprintf('<div style="float:left">%s</div>', $this->translate()->_('Lien permanent')); - $html.= sprintf('<div style="text-align:right"><a href="#" onclick="$(this).parent().parent().hide(); return false">» %s</a></div>', - $this->translate()->_('fermer cette fenêtre')); - $html.='<input type="text" size="66" value="'.$url.'" style="margin:5px;border:1px solid #C8C8C8" />'; - $html.='</div>'; + $html.= '<div><div style="display:none;">'; + $html.= '<div>' . $this->translate()->_('Lien permanent') . '</div>'; + $html.= '<div>' . + '<a href="#" onclick="$(this).parent().parent().hide(); return false">» ' . $this->translate()->_('fermer cette fenêtre') . '</a>'. + '</div>'; + $html.='<input type="text" value="'.$url.'"/>'; + $html.='</div></div>'; return $html; } diff --git a/public/opac/css/global.css b/public/opac/css/global.css index 2d2851a9f65..68519979752 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -1800,4 +1800,31 @@ button.vodeclic_link + img { .permalien-img { margin-right:3px; cursor:pointer; +} + +.permalien-img+div{ + position:relative; +} + +.permalien-img+div>div:first-child { + position:absolute; + left:-382px; + background: #FFFFFF; + padding:8px; + text-align:center; + border:1px solid #C8C8C8; +} + +.permalien-img+div div:first-child div:first-child { + float:left; +} + +.permalien-img+div div:first-child div:first-child+div { + text-align:right; +} + +.permalien-img+div input { + margin:5px; + border:1px solid #C8C8C8; + width: 404px; } \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/CatalogueControllerTest.php b/tests/application/modules/admin/controllers/CatalogueControllerTest.php index 780dd952740..46e88dc44f0 100644 --- a/tests/application/modules/admin/controllers/CatalogueControllerTest.php +++ b/tests/application/modules/admin/controllers/CatalogueControllerTest.php @@ -208,7 +208,7 @@ class CatalogueControllerWithModoPortailIndexTest extends AdminCatalogueControll /** @test */ public function pageShouldContainsPermalinkForCataloguePolitique() { - $this->assertXPath('//div[@id="permalink"]//input[contains(@value, "recherche/simple/id_catalogue/200")]'); + $this->assertXPath('//div//input[contains(@value, "recherche/simple/id_catalogue/200")]'); } @@ -747,7 +747,7 @@ class CatalogueControllerPaniersHistoireTest extends AdminCatalogueControllerTes /** @test */ public function pageShouldContainsPermalinkForPanier() { - $this->assertXPath('//div[@id="permalink"]//input[contains(@value, "recherche/simple/id_panier/8")]'); + $this->assertXPath('//div//input[contains(@value, "recherche/simple/id_panier/8")]'); } diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index f1038abef4a..d86f1bd876f 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -444,7 +444,7 @@ class CmsControllerArticleConcertEditActionTest extends CmsControllerTestCase { /** @test */ function permalinkShouldContainsArticleUrl() { - $this->assertXPath('//div[@id="permalink"]//input[contains(@value, "cms/articleview/id/4")]'); + $this->assertXPath('//div//input[contains(@value, "cms/articleview/id/4")]'); } @@ -1241,7 +1241,7 @@ class CmsControllerArticleExistingTraductionEditTest extends CmsControllerTestCa /** @test */ function permalinkShouldContainsArticleUrl() { - $this->assertXPath('//div[@id="permalink"]//input[contains(@value, "cms/articleview/id/41")]'); + $this->assertXPath('//div//input[contains(@value, "cms/articleview/id/41")]'); } -- GitLab