{% set entity = container %}
{% import "entity_macros.html" as entity_macros %}
{% extends "base.html" %}

{% block fullbody %}

<div class="ui stackable mobile reversed grid centered">
<div class="one wide column"></div>
<div class="fifteen wide column">
  <h1 class="ui header">{{ container.name }}
  <span class="sub header"><code>container {{ container.ident }}</code></span></h1>
</div>
</div>

<div class="ui stackable mobile reversed grid centered">
<div class="one wide column"></div>
<div class="ten wide column" style="font-size: 16px;">

{% if (container.extra != None) and (container.extra['urls'] != None) and (container.extra['urls']|length > 0) %}
  <div style="text-overflow: ellipsis; overflow: hidden; width: 100%;">
    <a href="{{ container.extra['urls'][0] }}"><code>{{ container.extra['urls'][0] }}</code></a>
  </div>
{% endif %}
<p>
{% if container.publisher != None %}
  Published by {{ container.publisher }}
{% endif %}

{% if container.issnl %}
<h3>Search Releases from this Container</h3>
<form class="" role="search" action="/release/search" method="get">
  <div class="ui form">
    <div class="ui action input large fluid">
      <input type="text" placeholder="Search Articles..." name="q" aria-label="search release metadata">
      <input type="hidden" name="container_issnl" value="{{ container.issnl }}">
      <button class="ui button">Search</button>
    </div>
  </div>
</form>
{% endif %}


{% if entity.extra %}
  <h3>Extra Metadata (raw JSON)</h3>
  {{ entity_macros.extra_metadata(entity.extra) }}
{% endif %}


</div>
<div class="five wide column">
<div class="ui segment top attached">

{% if container.es and container.es.is_oa == True %}
<i class="icon unlock huge orange"></i><b>Open Access Publisher</b>
{% elif container.es and container.es.is_oa == False  %}
<i class="icon lock huge black"></i><b>Not Open Access</b>
{% else %}
<i class="icon question huge grey"></i><b>Unknown OA Status</b>
{% endif %}
</div><div class="ui segment attached">

{% if container.issnl != None or container.wikidata_qid != None %}
{% if container.issnl != None %}
  <b>ISSN-L<sup><a href="https://en.wikipedia.org/wiki/International_Standard_Serial_Number#Linking_ISSN">?</a></sup></b> 
  &nbsp;<code>{{ container.issnl }}</code>
  {% if container.extra != None and container.extra.ISSNp != None and (container.extra.ISSNp|length > 0) %}
    <br><i class="icon paperclip"></i>Print: &nbsp;<code>{{ container.extra.ISSNp }}</code>
  {% endif %}
  {% if container.extra != None and container.extra.ISSNe != None and (container.extra.ISSNe|length > 0) %}
    <br><i class="icon plug"></i>Electronic: &nbsp;<code>{{ container.extra.ISSNe }}</code>
  {% endif %}
  <br>
{% endif %}
{% if container.wikidata_qid != None %}
  <b>Wikidata</b> &nbsp;<a href="https://wikidata.org/wiki/{{ container.wikidata_qid }}"><code>{{ container.wikidata_qid }}</code></a>
{% endif %}
  </div><div class="ui segment attached">
{% endif %}

{% if container_stats %}
<b>Release Counts</b><br>
  {{ "{:,}".format(container_stats.total) }} total
  {% if container_stats.total >= 1 %}
    <br>{{ "{:,}".format(container_stats.is_preserved) }}
    (<b>{{ "{:.1f}".format(container_stats.is_preserved/container_stats.total*100) }}%</b>) 
    preserved or archived
    <br>{{ "{:,}".format(container_stats.in_web) }}
    (<b>{{ "{:.1f}".format(container_stats.in_web/container_stats.total*100) }}%</b>) 
    fulltext available to read
  {% endif %}
</div><div class="ui segment attached">
{% endif %}

{% if (container.es and container.es != None) %}
<b>Directory Listings</b><br>
  {% if container.es.in_doaj == True %}
    <i class="icon check green"></i> In <a href="https://doaj.org/toc/{{ container.issnl }}">DOAJ</a><br>
  {% elif container.es.in_doaj == False %}
    <i class="icon times grey"></i> Not in <a href="https://doaj.org">DOAJ</a><br>
  {% endif %}

  {% if container.es.in_road == True %}
    <i class="icon check green"></i> In <a href="http://road.issn.org/issn/{{ container.issnl }}">ISSN ROAD</a><br>
  {% elif container.es.in_road == False %}
    <i class="icon times grey"></i> Not in <a href="https://road.issn.org">ISSN ROAD</a><br>
  {% endif %}

  {% if container.es.in_kbart == True %}
    <i class="icon check green"></i> In <a href="https://thekeepers.org/purl/issn/{{ container.issnl }}">Keepers Registery</a><br>
  {% elif container.es.in_kbart == False %}
    <i class="icon times grey"></i> Not in <a href="https://thekeepers.org/journals?query={{ container.issnl }}">Keepers Registry</a><br>
  {% endif %}

  {% if container.extra and container.extra.sherpa_romeo and container.extra.sherpa_romeo.color %}
    SHERPA/RoMEO color: <code>{{ container.extra.sherpa_romeo.color }}</code>
  {% endif %}
</div><div class="ui segment attached">
{% endif %}

<b>Lookup Links</b>
<br><a href="http://www.sherpa.ac.uk/romeo/issn/{{ container.issnl }}/">SHERPA/RoMEO</a> (access policies)
{% if not container.wikidata_qid %}
  <br><a href="https://www.wikidata.org/w/index.php?search={{ container.name|urlencode }}">wikidata.org</a>
{% endif %}
</div>

{{ entity_macros.fatcat_bits(entity, "container", "") }}

</div>
</div>

{% endblock %}