From 961539258be90f5b7c989299db0e8c551d0d6c72 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Fri, 17 Jun 2016 06:33:39 -0400 Subject: Wiki page revision comparison tool with diff displayed in modal dialog. Leverages Diff class from http://code.stephenmorley.org/php/diff-implementation with license CC0 1.0 universal http://creativecommons.org/publicdomain/zero/1.0/legalcode --- view/tpl/wiki.tpl | 47 ++++++++++++++++++++++++++++++++---------- view/tpl/wiki_page_history.tpl | 46 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 79 insertions(+), 14 deletions(-) (limited to 'view') diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl index dc78aad9f..990e6c883 100644 --- a/view/tpl/wiki.tpl +++ b/view/tpl/wiki.tpl @@ -96,17 +96,6 @@
- - {{foreach $pageHistory as $commit}} - - {{/foreach}} -
- - - - -
Date{{$commit.date}}
Name{{$commit.name}}
Message{{$commit.title}}
-
@@ -120,16 +109,22 @@ {{/if}} +{{$wikiModal}} + diff --git a/view/tpl/wiki_page_history.tpl b/view/tpl/wiki_page_history.tpl index 6ce3ce204..fef5d93a5 100644 --- a/view/tpl/wiki_page_history.tpl +++ b/view/tpl/wiki_page_history.tpl @@ -1,12 +1,52 @@ + {{foreach $pageHistory as $commit}} {{/foreach}} -
- + +
Date{{$commit.date}} -
Date{{$commit.date}} + +

+ +
Name{{$commit.name}} <{{$commit.email}}>
Message{{$commit.title}}
\ No newline at end of file + -- cgit v1.2.3 From 20b4fc919871433df6111cbb8b3508fd1693123b Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Mon, 20 Jun 2016 13:05:18 -0400 Subject: Do not change active page commit until user reverts the page --- view/tpl/wiki.tpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'view') diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl index 990e6c883..aa0b88545 100644 --- a/view/tpl/wiki.tpl +++ b/view/tpl/wiki.tpl @@ -256,6 +256,7 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) { window.console.log('Page saved successfully.'); window.wiki_page_content = currentContent; $('#id_commitMsg').val(''); // Clear the commit message box + $('#wiki-get-history').click(); } else { alert('Error saving page.'); // TODO: Replace alerts with auto-timeout popups window.console.log('Error saving page.'); @@ -301,6 +302,7 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) { $('#revert-'+commitHash).removeClass('btn-danger'); $('#revert-'+commitHash).addClass('btn-success'); $('#revert-'+commitHash).html('Page reverted
but not saved'); + window.wiki_page_commit = commitHash; // put contents in editor editor.getSession().setValue(data.content); } else { @@ -323,7 +325,6 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) { }, function (data) { if (data.success) { - window.wiki_page_commit = compareCommit; var modalBody = $('#generic-modal-body-{{$wikiModalID}}'); modalBody.html('
'+data.diff+'
'); $('.modal-dialog').width('80%'); -- cgit v1.2.3