<!-- $Id: gabarit.html,v 1.10.4.3 2026/06/03 14:11:46 jparis Exp $ -->
<article id="{{ list_element.uid }}{{ list_element.id }}" class="pmb-authority">
	<div class="notice-parent" id="{{ list_element.uid }}{{ list_element.id }}Parent">
		<span class="notice-heada">
			<div class="pmb-authority-Name-img">
				<div class="pmb-authority-infos-heada">
					{% block status %}
					{% endblock %}
					<!-- Titre / Nom -->
					{% block element_link %}
					{% if list_element.context_parameters.in_selector %}
					<a class="pmb-authority-name" href="#" title="{{msg.title_link_autority}} {{ list_element.isbd}}"
						data-element-id="{{ list_element.id }}" data-element-type="authorities"
						onclick="set_parent('{{ global.caller | e true }}', '{{ list_element.num_object }}', '{{ list_element.isbd |  escape true }}','{{ global.callback | e true }}')">
						{% else %}
						<a class="pmb-authority-name" href="{{ list_element.permalink }}"
							title="{{msg.title_link_autority}} {{ list_element.isbd}}"
							data-element-id="{{ list_element.id }}" data-element-type="authorities">
							{% endif %}
							{% endblock %}
							{% block element_title %}
							{% if list_element.display %}
							<h3 class="tit1_AuthCourte pmb-title-3">{{ list_element.display | safe }}
								{% if list_element.date %}
								({{list_element.date}})
								{% endif %}
							</h3>
							{% else %}
							<h3 class="tit1_AuthCourte pmb-title-3">{{list_element.isbd | safe}}
								{% if list_element.date %}
								({{list_element.date}})
								{% endif %}
							</h3>
							{% endif %}
							{% endblock %}
				</div>
				</a>
				{% block aut_picture %}
				<!-- Vignette -->
				{% if list_element.thumbnail_url %}
				<div class="vignetteimgAut">
					<div class="vignetteDocAut">
						<div class="vignAut pmb-authority-img">
							<img src="{{thumbnail_url}}"
								alt="{{msg.list_element_thumbnail_url_alt}} {{ list_element.display }}" tabindex="-1" />
						</div>
					</div>
				</div>
				{% endif %}
				{% endblock %}
			</div>
		</span>
		{% block aut_subtitle %}
		{% endblock %}
	</div>
	<div class="notice-child" id="{{ list_element.uid }}{{ list_element.id }}Child">

		<ul class="notice-child-detail" id="{{ list_element.uid }}{{ list_element.id }}Detail">
			{% block element_content %}

			{% block element_author_see %}
			{% if list_element.get_object_instance.author_see %}
			<li class="pmb-authority-detail pmb-authority-author-see">
				<span class="labelNot">
					{{msg.list_element_see}}
				</span>
				<span class="labelContent">
					<a href="./index.php?lvl=author_see&id={{list_element.get_object_instance.see}}"
						title="{{msg.title_link_author}} {{list_element.get_object_instance.author_see}}">{{list_element.get_object_instance.author_see}}</a>
				</span>
			</li>
			{% endif %}
			{% endblock %}

			{% endblock element_content %}
		</ul>

		<div class="clear"></div>
	</div>
</article>

<script>
	document.addEventListener("DOMContentLoaded", function () {
		// Parcours tous les �l�ments parents
		document.querySelectorAll('.pmb-authority-detail-list').forEach(function (parentLi) {
			const childrenItems = parentLi.querySelectorAll('.labelContentItemList');

			if (childrenItems.length > 3) {
				// Masquer les enfants � partir du 4�me
				for (let i = 3; i < childrenItems.length; i++) {
					childrenItems[i].classList.add('pmb_childcache');
				}

				// V�rifie qu?un bouton n?existe pas d�j�
				if (!parentLi.querySelector('.toggle-button')) {
					// Cr�er le bouton "Voir plus" 
					const toggleBtn = document.createElement('button');
					toggleBtn.className = 'toggle-button';
					toggleBtn.textContent = 'Voir plus';

					toggleBtn.addEventListener('click', function () {
						const hiddenChildren = parentLi.querySelectorAll('.pmb_childcache');
						if (hiddenChildren.length > 0) {
							// D�plier
							hiddenChildren.forEach(el => el.classList.remove('pmb_childcache'));
							toggleBtn.textContent = 'Voir moins';
							toggleBtn.className = 'toggle-button-less';
						} else {
							// Replier
							for (let i = 3; i < childrenItems.length; i++) {
								childrenItems[i].classList.add('pmb_childcache');
							}
							toggleBtn.textContent = 'Voir plus';
						}
					});

					// Ajouter le bouton apr�s le dernier <li>
					const lastChild = childrenItems[childrenItems.length - 1];
					parentLi.insertAdjacentElement('afterend', toggleBtn);
				}
			}
		});
	});
</script>