<xf:title>{{ phrase('merge_template_changes:') }} {$template.title}</xf:title>

<xf:css src="public:diff.less" />
<xf:js src="xf/form.js, xf/template_merge.js" min="1" />

<xf:form action="{{ link('templates/merge-outdated', $template) }}" data-xf-init="template-merger" class="block">
	<div class="block-container">
		<div class="block-body">
			<div class="block-row block-row--separated">
				<div class="diffListContainer" dir="ltr">
					<ol class="diffList diffList--code diffList--wrapped diffList--editable">
					<xf:foreach loop="$diffs" value="$diff">
						<xf:set var="$diffHtml" value="{$diff.1|escape|join('<br />')}" />
						<xf:if is="$diff.0 == 'c'">
							<li class="diffList-conflict js-conflictContainer">
								<xf:set var="$parentHtml" value="{$diff.3|escape|join('<br />')}" />
								<div class="diffList-line js-diffParent"><xf:trim>
									<xf:if is="$diff.3">
										<span>{{ trim($parentHtml) !== '' ? $parentHtml|raw : '&nbsp;' }}</span><xf:hiddenval name="" value="{$diff.3|join("
")}" />
									<xf:else />
										<i>{{ phrase('deleted') }}</i>
									</xf:if>
								</xf:trim></div>
								<div class="diffList-resolve">

									<xf:button class="js-resolveButton" data-target=".js-diffParent">
										&uarr; {{ phrase('resolve_using_parent_version') }}
									</xf:button>
									<xf:button class="js-resolveButton" data-target=".js-diffParent, .js-diffCustom">
										{{ phrase('resolve_using_both') }}
									</xf:button>
									<xf:button class="js-resolveButton" data-target=".js-diffCustom">
										{{ phrase('resolve_using_custom_version') }} &darr;
									</xf:button>

									<xf:hiddenval name="merged[]" class="js-mergedInput" value="{{ $diff.3|join("
") }}" />
								</div>
								<div class="diffList-line js-diffCustom"><xf:trim>
									<xf:if is="$diff.1">
										<span>{{ trim($diffHtml) !== '' ? $diffHtml|raw : '&nbsp;' }}</span><xf:hiddenval name="" value="{{ $diff.1|join("
") }}" />
									<xf:else />
										<i>{{ phrase('deleted') }}</i>
									</xf:if>
								</xf:trim></div>
							</li>
						<xf:else />
							<li class="diffList-line diffList-line--{$diff.0}"><xf:trim>
								<xf:if is="$diff.1">
									<span>{{ trim($diffHtml) !== '' ? $diffHtml|raw : '&nbsp;' }}</span><xf:hiddenval name="merged[]" value="{{ $diff.1|join("
") }}" />
								<xf:else />
									<i>{{ phrase('deleted') }}</i>
								</xf:if>
							</xf:trim></li>
						</xf:if>
					</xf:foreach>
					</ol>
				</div>
			</div>
			<div class="block-row block-row--separated">
				{{ phrase('you_may_click_on_update_to_edit_it') }}
			</div>
		</div>
		<xf:submitrow submit="{{ phrase('merge') }}" rowtype="simple" icon="save" />
	</div>
</xf:form>