{% extends "layout.html" %}
{% block body %}
<div class="container">
  <form class="row" method="POST" action="{{url_for(".create_list_POST")}}">
    <div class="col-md-12">
      <h3>Create new mailing list</h3>
    </div>
    <div class="col-md-6">
      {{csrf_token()}}
      <div class="form-group">
        <label for="name">Name</label>
        <input
          type="text"
          name="name"
          id="name"
          class="form-control {{valid.cls("name")}}"
          value="{{ name or "" }}"
          required />
        {{valid.summary("name")}}
      </div>
      <div class="form-group">
        <label for="description">Description</label>
        <textarea
          name="description"
          id="description"
          class="form-control {{valid.cls("description")}}"
          value="{{ description or "" }}"
          placeholder="Markdown supported"
          rows="5"
          aria-describedby="description-help"
        >{{description or ""}}</textarea>
        {{valid.summary("description")}}
      </div>
      {{valid.summary()}}
      <button type="submit" class="btn btn-primary">
        Create {{icon("caret-right")}}
      </button>
    </div>
    <div class="col-md-6 d-flex flex-column">
      <fieldset class="form-group">
        <legend>Mailing List Visibility</legend>
        <div class="form-check">
          <label class="form-check-label">
            <input
              class="form-check-input"
              type="radio"
              name="visibility"
              value="PUBLIC"
              {% if not visibility or visibility == Visibility.PUBLIC %}
              checked
              {% endif %}> Public
            <small id="visibility-public-help" class="form-text text-muted">
              Shown on your profile page
            </small>
          </label>
        </div>
        <div class="form-check">
          <label
              class="form-check-label"
              title="Visible to anyone with the link, but not shown on your profile"
            >
            <input
              class="form-check-input"
              type="radio"
              name="visibility"
              value="UNLISTED"
              {% if visibility == Visibility.UNLISTED %}
              checked
              {% endif %}> Unlisted
            <small id="visibility-unlisted-help" class="form-text text-muted">
              Visible to anyone who knows the URL, but not shown on your profile
            </small>
          </label>
        </div>
        <div class="form-check">
          <label
            class="form-check-label"
            title="Only visible to you and your collaborators"
          >
            <input
              class="form-check-input"
              type="radio"
              name="visibility"
              value="PRIVATE"
              {% if visibility == Visibility.PRIVATE %}
              checked
              {% endif %}> Private
            <small id="visibility-unlisted-help" class="form-text text-muted">
              Only visible to you and your collaborators
            </small>
          </label>
        </div>
      </fieldset>
    </div>
  </form>
</div>
{% endblock %}
