{% extends 'html/main.html' %}


{% block title %}{% trans %}Move a page{% endtrans %}{% endblock %}


{% block content %}
	<header>
		<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}/{{pwic.page|urlencode}}">{{pwic.emojis.finger_left}} {% trans %}Move the page and its attachments{% endtrans %}</a></div>
	</header>

	<article>
		<h1>[{{pwic.project|escape}}/{{pwic.page|escape}}] {{pwic.title|escape}}</h1>
		
		<input id="move_src_project" type="hidden" value="{{pwic.project|escape}}">
		<input id="move_src_page" type="hidden" value="{{pwic.page|escape}}">

		<p><strong>{% trans %}Target project:{% endtrans %}</strong><br>
			<select id="move_dst_project">
				{% for proj in pwic.projects %}
					<option value="{{proj.project|escape}}"
						{% if proj.project == pwic.project %} selected="selected" {% endif %}
					>{{proj.description|escape}} [{{proj.project|escape}}]</option>
				{% endfor %}
			</select>
		</p>
		<p><strong>{% trans %}Target page identifier:{% endtrans %}</strong> <input id="move_dst_page" class="pwic_fill" type="text" placeholder="{{pwic.page|escape}}" spellcheck="false"></p>

		<p><input type="button" value="{{pwic.emojis.truck}} {% trans %}Move the page{% endtrans %}" onclick="move_submit()"></p>

		<p class="pwic_italic">
			{% trans %}This form can be used to rename an existing page.{% endtrans %}

			{% if pwic.relations|count > 0 %}
				{% trans %}No link will be updated within the following pages:{% endtrans %}
			{% endif %}
		</p>

		{% if pwic.relations|count > 0 %}
			<table>
				<tr>
					<th>{% trans %}Link{% endtrans %}</th>
					<th>{% trans %}Title{% endtrans %}</th>
					<th>{% trans %}Date{% endtrans %}</th>
				</tr>
				{% for row in pwic.relations %}
					<tr>
						<td><a href="/{{row.project|urlencode}}/{{row.page|urlencode}}">/{{row.project|escape}}/{{row.page|escape}}</a></td>
						<td>{{row.title|escape}}</td>
						<td>{{row.date|escape}}</td>
					</tr>
				{% endfor %}
			</table>
		{% endif %}

		{% include 'js/page-move.js' %}
	</article>
{% endblock %}
