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

{% load i18n %}
{% load hk_generic %}
{% load static %}


{% block head_title %}
{% trans "Reattach a thread" %} - {{ mlist.display_name|default:mlist.name }} - {{ block.super }}
{% endblock %}

{% block content %}

<div class="row reattach-thread">

{% include 'hyperkitty/fragments/month_list.html' %}

    <div class="col-md-7">

        <h1>{% trans "Re-attach a thread to another" %}</h1>

        <p>{% trans "Thread to re-attach:" %}
            <a href="{% url 'hk_thread' mlist_fqdn=mlist.name threadid=thread.thread_id %}"
               >{{ thread.subject }}</a>
            ({% trans "started" %} {{ thread.starting_email.date }}, {% trans "last active:" %} {{ thread.date_active }})
        </p>
        <form action="{% url 'hk_thread_reattach_suggest' mlist_fqdn=mlist.name threadid=thread.thread_id %}"
              method="GET" class="search">
            <p>{% trans "Re-attach it to:" %}
            <span class="input-append">
            <input type="text" name="q" placeholder="{% trans 'Search for the parent thread' %}"
                /><button type="submit" class="btn btn-secondary">{% trans "Search" %}</button>
            </span>
            </p>
        </form>
        <form action="" method="POST">
            {% csrf_token %}
            <ul class="list-unstyled suggestions">
                <img alt="{% trans 'Loading...' %}" class="ajaxloader" src="{% static 'hyperkitty/img/ajax-loader.gif' %}" />
            </ul>
            <ul class="list-unstyled">
                <li class="manual">
                    <input type="radio" name="parent" value="" />
                    <label>{% trans "this thread ID:" %}
                        <input type="text" name="parent-manual" size="32" placeholder="{{ thread.thread_id }}" />
                    </label>
                </li>
            </ul>
            <p class="buttons">
                <button type="submit" class="btn btn-primary">{% trans "Do it" %}</button> {% trans "(there's no undoing!), or" %}
                <a href="{% url 'hk_thread' mlist_fqdn=mlist.name threadid=thread.thread_id %}"
                   >{% trans "go back to the thread" %}</a>.
            </p>
        </form>

    </div>

</div>

{% endblock %}

{% block additionaljs %}
<script type="text/javascript">
    $(document).ready(function() {
        setup_reattach();
    });
</script>
{% endblock %}
