<#import "lib-vivo-properties.ftl" as vp>
<#include "individual-setup.ftl">

${scripts.add('<script type="text/javascript" src="${urls.base}/themes/iph/js/collapsible_elements.js"></script>')}
${scripts.add('<script async type="text/javascript" src="${urls.base}/themes/iph/js/print.js"></script>')}

<section id="individual-intro" class="vcard person" role="region">
  <span itemscope itemtype="http://schema.org/Person">
    <section id="individual-info" ${infoClass!} role="region" style="width: 100%;">
        <#include "individual-adminPanel.ftl">
        <header>
<div id="articleTitleWrapper">       
            <#if relatedSubject??>
                <h2>${relatedSubject.relatingPredicateDomainPublic} ${i18n().for} ${relatedSubject.name}</h2>
                <p><a href="${relatedSubject.url}" title="${i18n().return_to(relatedSubject.name)}">&larr; ${i18n().return_to(relatedSubject.name)}</a></p>
            <#else>
                <h1 itemprop="name" class="vcard foaf-person fn" <#if !editable>style="width:100%;border-right:1px solid #A6B1B0;"</#if>>
                  <@p.label individual editable labelCount localesCount/>
                </h1>
            </#if>
            
            <#if editable && profilePageTypesEnabled >
                <#include "individual-profilePageTypes.ftl">
            </#if>
</div>
        </header>
    </section>
  </span>
</section>

 <#assign parent = propertyGroups.pullProperty("https://iph.ras.ru/relationships#hasParent")!>
 <#if parent?has_content>
   <div class="label">Родительская рубрика:<#if !parent.statements?has_content> <@p.addLink parent editable /></#if> <@p.verboseDisplay parent /></div>
     <#if parent.statements?has_content >
       <div style="list-style:none;" class="parentRubric">
         <@p.objectProperty parent editable />
       </div>
     </#if>
  </#if>
<#if editable >

 <#assign order = propertyGroups.pullProperty("https://iph.ras.ru/relationships#rubricOrder")!>
 <#if order?has_content>
   <div class="label">Порядок рубрики<#if !order.statements?has_content> <@p.addLink order editable /></#if> <@p.verboseDisplay order /></div>
     <#if order.statements?has_content >
       <div style="list-style:none;" class="rubricOrder">
         <@p.dataPropertyList order editable />
       </div>
     </#if>
  </#if>
</#if>

 <#if childRubrics?has_content>
   <button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Подрубрики</button>
   <div style="display:none;">
    <#list childRubrics as childRubric>
     <#if childRubric?has_content >
       <div class="childRubric">
         <a href="${urls.base}/individual?uri=${childRubric.rubricID?url}"">${childRubric.rubricName}</a>
       </div>
     </#if>
    </#list>
   </div>
 </#if>

 <#if childArticles?has_content>
   <button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Статьи в подрубриках</button>
   <div style="display:none;">
    <#list childArticles as childArticle>
     <#if childArticle?has_content >
       <div class="childArticle">
         <a href="${urls.base}/individual?uri=${childArticle.childArticleID?url}"">${childArticle.childArticleName}</a>
       </div>
     </#if>
    </#list>
   </div>
 </#if>

 <#if childExcerpts?has_content>
   <button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Отрывки в подрубриках</button>
   <div style="display:none;">
    <#list childExcerpts as childExcerpt>
     <#if childExcerpt?has_content >
       <div class="childExcerpt">
         <a href="${urls.base}/individual?uri=${childExcerpt.childExcerptID?url}"">${childExcerpt.childExcerptName}</a>
       </div>
     </#if>
    </#list>
   </div>
 </#if>

 <#if articles?has_content>
   <button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Статьи в данной рубрике</button>
   <div class="articles"  style="display:none;">
    <#list articles as article>
     <#if article?has_content >
       <div style="list-style:none;border:none;padding: 18px;width: 100%;text-align:left;" class="article">
         <a href="${urls.base}/individual?uri=${article.articleID?url}"">${article.articleName}</a>
       </div>
     </#if>
    </#list>
   </div>
 </#if>

 <#if excerpts?has_content>
   <button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Отрывки в данной рубрике</button>
    <div style="display:none;" class="excerpts">
    <#list excerpts as excerpt>
     <#if excerpt?has_content >
       <div style="list-style:none;border:none;padding: 18px;width: 100%;text-align:left;" class="excerpt">
         <a href="${urls.base}/individual?uri=${excerpt.excerptID?url}"">${excerpt.excerptName}</a>
       </div>
     </#if>
    </#list>
    </div>
 </#if>
