{% extends "bukuserver/base.html" %}

{% block content %}
<div class="container">
  <h1  style="padding-top: 70px;">Tags</h1>
  <br/>
  {{show_flash_message()}}
  <div>
    <table class="table" style="table-layout: fixed; width: 100%">
      <caption>Tags table.</caption>
      <thead> <tr> <th>Entry</th> </tr> </thead>
      <tbody>
        {% for item in result.tags %}
        <tr> <td style="overflow-wrap: break-word;">
          <a href="{{url_for('bookmarks-html', tag=item)}}">{{item}}</a>
          <a class="btn btn-default btn-xs" role="button" data-toggle="collapse"
            href="#collapse-{{loop.index}}" aria-expanded="false" aria-controls="collapse-{{loop.index}}">
            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
            replace
          </a>
          <div class="collapse" id="collapse-{{loop.index}}">
            <div class="well">
              <form action="{{url_for('update_tag-html', tag=item)}}" method="POST">
                  <div class="form-group">
                    <label for="replace-{{loop.index}}">New Tag</label>
                    <input type="text" class="form-control" id="replace-{{loop.index}}" name="tags" placeholder="New Tag">
                  </div>
                <button type="submit" class="btn btn-default">Replace</button>
              </form>
            </div>
          </div>
        </td> <tr>
        {% else %}
        <tr> <td>No entry Found</td> </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</div>
{% endblock %}
