{% extends "base.html" %}

{% block title %}{% if current_secret %}Update{% else %}Add{% endif %} secret: {{ secret_name }}{% endblock %}

{% block crumbs %}
<p class="crumbs"><a href="{{ urls.path("/") }}">home</a> / <a href="{{ urls.path("/-/secrets") }}">secrets</a></p>
{% endblock %}

{% block content %}
<h1>{% if current_secret %}Update{% else %}Add{% endif %} secret: {{ secret_name }}</h1>

{% if secret_details and secret_details.description_html %}
  <p>{{ secret_details.description_html|safe }}</p>
{% endif %}

{% if error %}
  <p class="message-error">{{ error }}</p>
{% endif %}

<form action="{{ request.path }}" method="post">
  <p>
    <label for="secret">Secret:</label>
  </p>
  <p>
    <textarea name="secret" style="width: 80%; height: 5em" id="secret"{% if not current_secret %} required{% endif %}
      placeholder="{% if current_secret %}Leave this blank to leave the stored secret unchanged{% else %}Enter the secret here{% endif %}"
    ></textarea>
  </p>
  <p>
    <label for="note">Note (optional):</label>
  </p>
  <p>
    <input type="text" name="note" id="note" maxlength="{{ max_note_length}}"
      placeholder="{% if current_secret %}Add a note to the secret{% else %}Optional note{% endif %}"
      value="{% if current_secret %}{{ current_secret.note }}{% endif %}"
  </p>
  <p>
    <input type="submit" value="Add secret">
    <input type="hidden" name="csrftoken" value="{{ csrftoken() }}">
  </p>
</form>

{% endblock %}