{% extends 'layout/page.html' %}

{% block head_title %}
  {% trans %}Keyword editing{% endtrans %}
{% endblock %}

{% block page_header %}
  {% trans %}Keyword editing{% endtrans %}
{% endblock %}

{% block content %}

  <h4>Existing Keywords</h4>
  <ul class='nav nav-pills nav-stacked'>
    {% for keyword in db.keyword.list() %}
      <li class='nav-item'>
        <a class='nav-link {{ 'active' if context.id == keyword.id else '' }}' href='keyword{{ keyword.id }}'>{{ keyword.name.plain()|u }}</a>
      </li>
    {% else %}
      <p class='text-mute'>{% trans %}There are no keywords yet.  Be the first -{% endtrans %}</p>
    {% endfor %}
    {% if context.id %}
    <li class='nav-item'>
      <a class='nav-link close' href='keyword?@template=item' aria-label="Close">
        <span aria-hidden="true">&times;</span>
      </a>
    </li>
    {% endif %}
  </ul>
  <p class='text-warning'>
   {% trans %}To edit an existing keyword (for spelling or typing errors),
   click on its entry above.{% endtrans %}
  </p>


  <form class='form-inline' method="POST" action='{{ context.designator() }}'>
    <input type='text' class='input-xlarge' name='name' value='{{ context.name if context.id else '' }}'>
    <input type="hidden" name="@required" value="name">
    <input type="hidden" name="@template" value="item">
    {{ context.submit(html_kwargs={ 'class': 'btn btn-primary' })|u|safe }}
  </form>
{% endblock %}
