{% extends "base.html" %}
{% block content %}
{% include 'abifbox-snippet.html' %}
{% if webenv.toppage == 'awt' %}
<h2 id="examples">ABIF Examples</h2>
{% endif %}
<div class="example-section">
<ul class="tab-links">
  {% for item in main_file_array %}
  <li data-target="example{{loop.index}}"{% if loop.first %} class="active"{% endif %}>{{loop.index}}. {{item.id}}</li>
  {% endfor %}
  {% if other_files|length > 0 %}
  <li data-target="more">Other {{tag}} examples...</li>
  {% endif %}
  <li data-target="all">All tags</li>
</ul>
{% for item in main_file_array %}
<div class="tab-content{% if loop.first %} active{% endif %}" id="example{{loop.index}}">
  <h3>{{ loop.index }}. {{item.title}}</h3>
  <div class="hatnote">
    🔗 <a href="/id/{{item.id}}">{{item.id}}</a> &nbsp; &nbsp;
    (tags: {% for t in item.taglist %}
    <a href="/tag/{{t}}">{{t}}</a>
    {% if not loop.last %}, {% endif %}
    {% endfor %})
  </div>
  <p>{{ item.desc }}</p>
  <div class="exampleareacontainer">
    <textarea readonly class="vscroll examplearea" id='formtext{{loop.index}}'>{{ item.text }}</textarea>
  </div>
  <button onclick="pushTextFromID('formtext{{loop.index}}')">Replace submission area with example</button> &mdash;
  (<a href="/id/{{item.id}}">{{item.id}} permalink</a>)
  (tags: {% for t in item.taglist %}
  <a href="/tag/{{t}}">{{t}}</a>
  {% if not loop.last %}, {% endif %}
  {% endfor %})
</div>
{% endfor %}
<div class="tab-content" id="more">
  <h3>The remaining ABIF examples</h3>
  {% set mainsize = main_file_array|length %}
  <ul>
  {% for item in other_files %}
  <li>{{loop.index + mainsize}}. <a href="/id/{{item.id}}">{{item.id}}</a>
    &mdash; {{item.title}}</li>
  {% endfor %}
  <li><a href="/tag">Explore elections by tag</a></li>
  <li><a href="/id">Browse list of all elections</a></li>
  </ul>
</div>
{% include 'all-snippet.html' %}
</div>
{% include 'also-note-snippet.html' %}
{% endblock content %}
