Issue #0001820: [Liens inter-entreprises] Afficher les documents liés (3 ou plus)

This commit is contained in:
Aram HARUTYUNYAN 2014-02-28 08:06:51 +00:00
parent 0d5bbe188a
commit c195387ef1

View File

@ -1,8 +1,10 @@
<?php if (count($this->docs)==0) {?>
Aucun document.
<?php } else {?>
<?php foreach ( $this->docs as $doc ) {?>
<?php } else {
$limit = 3;
foreach ( $this->docs as $key=>$doc ) {
$class = ($key<$limit)?'first':'all';?>
<div class="<?=$class?>" id="<?=$key ?>">
<a target="_blank" href="/fichier/groupes/<?=$doc->url?>" id="<?=$doc->date?>" class="lienDocDate"><?=$doc->label?></a>
<?php if ($this->edition) {?>
<a class="dialog" title="Supprimer le document" href="<?=$this->url(array('controller'=>'saisie','action'=>'liendoc','mode'=>'delete','id'=>$doc->id), null, true)?>">
@ -10,6 +12,29 @@ Aucun document.
</a>
<?php }?>
<br/>
</div>
<?php }?>
<div class="affiche" id="show" style="cursor:pointer;">Afficher tous les documents</div><br/>
<script>
$(document).ready(function(){
if (<?=$key?> >2) {
$("div.affiche").show();
} else {
$("div.affiche").hide();
}
$("div.all").hide();
});
<?php }?>
$("div.affiche").on("click", function(){
if ($(this).attr("id")=="show") {
$(this).attr("id", "hide");
$(this).text("Afficher les <?=$limit?> derniers documents");
$("div.all").show();
} else {
$(this).attr("id", "show");
$(this).text("Afficher tous les documents");
$("div.all").hide();
}
});
</script>
<?php }?>