From 6dcf3602c0c04eb63ee4cf46d3482b9b5993d2f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 7 Jul 2014 19:52:05 +0200 Subject: [PATCH] Show nice diff instead of unix diff in editHistory.tpl --- com.woltlab.wcf/templates/editHistory.tpl | 39 +++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/templates/editHistory.tpl b/com.woltlab.wcf/templates/editHistory.tpl index d3c40fe44c..d14134a54d 100644 --- a/com.woltlab.wcf/templates/editHistory.tpl +++ b/com.woltlab.wcf/templates/editHistory.tpl @@ -16,7 +16,42 @@ {include file='userNotice'} -
{$diff}
+{if $diff} +
+{assign var='prevType' value=''} +{foreach from=$diff->getRawDiff() item='line'} +{if $line[0] !== $prevType} +
+ + {* unmodified, after deletion needs a "fake" insertion *} + {if $line[0] === ' ' && $prevType === '-'}
{/if} + + {* unmodified and deleted start a new container *} + {if $line[0] === ' ' || $line[0] === '-'}
{/if} + + {* adding, without deleting needs a "fake" deletion *} + {if $line[0] === '+' && $prevType !== '-'} + +
+
+
+ {/if} + + {if $line[0] === ' '} +
+ {/if} + {if $line[0] === '-'} +
+ {/if} +
+{/if} +{if $line[0] === ' '}{$line[1]}
{/if} +{if $line[0] === '-'}{$line[1]}
{/if} +{if $line[0] === '+'}{$line[1]}
{/if} +{assign var='prevType' value=$line[0]} +{/foreach} +
+{/if}
@@ -40,7 +75,7 @@ - + {event name='rowButtons'} {lang}wcf.edit.currentVersion{/lang} -- 2.20.1