diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-06-17 06:33:39 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-06-17 06:33:39 -0400 |
commit | 961539258be90f5b7c989299db0e8c551d0d6c72 (patch) | |
tree | 8c1e37dd56e06ed157feb9288fba7867f18e0034 /view/tpl/wiki.tpl | |
parent | aa77b04860a68370d829f1081418e69777d0e1f9 (diff) | |
download | volse-hubzilla-961539258be90f5b7c989299db0e8c551d0d6c72.tar.gz volse-hubzilla-961539258be90f5b7c989299db0e8c551d0d6c72.tar.bz2 volse-hubzilla-961539258be90f5b7c989299db0e8c551d0d6c72.zip |
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
Diffstat (limited to 'view/tpl/wiki.tpl')
-rw-r--r-- | view/tpl/wiki.tpl | 47 |
1 files changed, 36 insertions, 11 deletions
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 @@ </div> <div id="page-history-pane" class="tab-pane fade" {{if $hidePageHistory}}style="display: none;"{{/if}}> <div id="page-history-list" class="section-content-wrapper"> - <table class="table-striped table-responsive table-hover" style="width: 100%;"> - {{foreach $pageHistory as $commit}} - <tr><td> - <table> - <tr><td>Date</td><td>{{$commit.date}}</td></tr> - <tr><td>Name</td><td>{{$commit.name}}</td></tr> - <tr><td>Message</td><td>{{$commit.title}}</td></tr> - </table> - </td></tr> - {{/foreach}} - </table> </div> </div> @@ -120,16 +109,22 @@ {{/if}} </div> +{{$wikiModal}} + <script> window.wiki_resource_id = '{{$resource_id}}'; window.wiki_page_name = '{{$page}}'; window.wiki_page_content = {{$content}}; + window.wiki_page_commit = '{{$commit}}'; if (window.wiki_page_name === 'Home') { $('#delete-page').hide(); $('#rename-page').hide(); } + $("#generic-modal-ok-{{$wikiModalID}}").removeClass('btn-primary'); + $("#generic-modal-ok-{{$wikiModalID}}").addClass('btn-danger'); + $('#rename-page').click(function (ev) { $('#rename-page-form-wrapper').show(); }); @@ -313,4 +308,34 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) { } }, 'json'); } + + function wiki_compare_page(compareCommit) { + if (window.wiki_resource_id === '' || window.wiki_page_name === '' || window.wiki_page_commit === '') { + window.console.log('You must have a wiki page open in order to revert pages.'); + return false; + } + $.post("wiki/{{$channel}}/compare/page", + { + compareCommit: compareCommit, + currentCommit: window.wiki_page_commit, + name: window.wiki_page_name, + resource_id: window.wiki_resource_id + }, + function (data) { + if (data.success) { + window.wiki_page_commit = compareCommit; + var modalBody = $('#generic-modal-body-{{$wikiModalID}}'); + modalBody.html('<div class="descriptive-text">'+data.diff+'</div>'); + $('.modal-dialog').width('80%'); + $("#generic-modal-ok-{{$wikiModalID}}").off('click'); + $("#generic-modal-ok-{{$wikiModalID}}").click(function () { + wiki_revert_page(compareCommit); + $('#generic-modal-{{$wikiModalID}}').modal('hide'); + }); + $('#generic-modal-{{$wikiModalID}}').modal(); + } else { + window.console.log('Error comparing page.'); + } + }, 'json'); + } </script> |