diff options
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> |