{% extends "repo_master.html" %}
{% from "_formhelper.html" import render_bootstrap_field %}

{% block title %}Edit tag: {{ tagname }} - {{
    repo.namespace + '/' if repo.namespace }}{{ repo.name }}{% endblock %}
{% set tag = "home" %}


{% block repo %}

<section class="edit_tag">
  <div class="col-md-8 col-md-offset-2">
    <div class="card">
      <div class="card-header">
        <strong>Edit tag: {{ tagname }}</strong>
      </div>
      <div class="card-block">
        <form method="post" action="{{ url_for(
              'ui_ns.edit_tag',
              repo=repo.name,
              username=username,
              tag=tagname,
              namespace=repo.namespace) }}" >
            {{ form.csrf_token }}
          {{ render_bootstrap_field(form.tag) }}
          {{ render_bootstrap_field(form.tag_description) }}
          <fieldset class="form-group {% if form.tag.errors %}has-error{% endif %}">
            {% set formclasses = "form-control c-select"%}
            {% if form.tag_color.errors %} {% set formclasses = formclasses + " form-control-error" %} {% endif %}

            <strong>{{ form.tag_color.label }}</strong>
            <input type="color" name="tag_color" class="form-control c-select"
              onchange="clickColor(0, -1, -1, 5)" value="{{ form.tag_color.data }}">

            <div>
              {% if form.tag_color.errors %}
              <span class="pull-xs-right text-danger">
                <small>
                {% for error in form.tag_color.errors %}
                  {{ error }}&nbsp;
                {% endfor %}
                </small>
              </span>
              {% endif %}
            </div>
          </fieldset>
          <input type="submit" class="btn btn-primary" value="Update Tag" />
          <input type="button" class="btn btn-secondary pull-md-right cancel_btn"
            value="Cancel"/>
        </form>
      </div>
    </div>
  </div>
</section>
{% endblock %}
