diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-05-30 20:59:54 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-05-30 20:59:54 -0400 |
commit | 8d284bab474c7e669ae9a639bdb22f7b28b95cc3 (patch) | |
tree | c08d8569705cea43445cf8c65f8d8ca57beeff5f /view/tpl | |
parent | 82ec40dd80c131dbf0335406fb1a6e4b5b127a18 (diff) | |
download | volse-hubzilla-8d284bab474c7e669ae9a639bdb22f7b28b95cc3.tar.gz volse-hubzilla-8d284bab474c7e669ae9a639bdb22f7b28b95cc3.tar.bz2 volse-hubzilla-8d284bab474c7e669ae9a639bdb22f7b28b95cc3.zip |
Created page history widget to dynamically fetch and display the git commit history for wiki pages.
Diffstat (limited to 'view/tpl')
-rw-r--r-- | view/tpl/wiki.tpl | 29 | ||||
-rw-r--r-- | view/tpl/wiki_page_history.tpl | 11 |
2 files changed, 39 insertions, 1 deletions
diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl index 91c6e64b2..d2ce03f5a 100644 --- a/view/tpl/wiki.tpl +++ b/view/tpl/wiki.tpl @@ -59,6 +59,7 @@ <ul class="nav nav-tabs" id="wiki-nav-tabs"> <li><a data-toggle="tab" href="#edit-pane">Edit</a></li> <li class="active"><a data-toggle="tab" href="#preview-pane" id="wiki-get-preview">Preview</a></li> + <li><a data-toggle="tab" href="#page-history-pane" id="wiki-get-history">History</a></li> {{if $showPageControls}} <li class="dropdown"> <a data-toggle="dropdown" class="dropdown-toggle" href="#">Page <b class="caret"></b></a> @@ -69,7 +70,7 @@ </li> {{/if}} </ul> - <div class="tab-content" id="myTabContent"> + <div class="tab-content" id="wiki-page-tabs"> <div id="edit-pane" class="tab-pane fade"> <div id="ace-editor"></div> @@ -79,6 +80,21 @@ {{$renderedContent}} </div> </div> + <div id="page-history-pane" class="tab-pane fade"> + <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> </div> @@ -110,6 +126,17 @@ ev.preventDefault(); }); + $('#wiki-get-history').click(function (ev) { + $.post("wiki/{{$channel}}/history/page", {name: window.wiki_page_name, resource_id: window.wiki_resource_id}, function (data) { + if (data.success) { + $('#page-history-list').html(data.historyHTML); + } else { + window.console.log('Error getting page history.'); + } + }, 'json'); + ev.preventDefault(); + }); + function wiki_delete_wiki(wikiName, resource_id) { if(!confirm('Are you sure you want to delete the entire wiki: ' + JSON.stringify(wikiName))) { return; diff --git a/view/tpl/wiki_page_history.tpl b/view/tpl/wiki_page_history.tpl new file mode 100644 index 000000000..7efc4aa96 --- /dev/null +++ b/view/tpl/wiki_page_history.tpl @@ -0,0 +1,11 @@ +<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>
\ No newline at end of file |