aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/wiki.tpl
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-06-05 16:32:03 -0400
committerAndrew Manning <tamanning@zoho.com>2016-06-05 16:32:03 -0400
commit0a3fbdd128dd3b80868c93cb93901b501edf576c (patch)
treefeff8120476bcc96f5c4c327ac66d0724fcfa2ac /view/tpl/wiki.tpl
parent4bc4fd5b7ebd7c5f25cfc9acfbda5b14a38dedb8 (diff)
downloadvolse-hubzilla-0a3fbdd128dd3b80868c93cb93901b501edf576c.tar.gz
volse-hubzilla-0a3fbdd128dd3b80868c93cb93901b501edf576c.tar.bz2
volse-hubzilla-0a3fbdd128dd3b80868c93cb93901b501edf576c.zip
Basic page reversion implemented. The revert button on the history view replaces the editor text but does not save the page.
Diffstat (limited to 'view/tpl/wiki.tpl')
-rw-r--r--view/tpl/wiki.tpl17
1 files changed, 17 insertions, 0 deletions
diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl
index 6cdfabdb9..d9a490bf8 100644
--- a/view/tpl/wiki.tpl
+++ b/view/tpl/wiki.tpl
@@ -232,4 +232,21 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) {
}, 'json');
ev.preventDefault();
});
+
+ function wiki_revert_page(commitHash) {
+ if (window.wiki_resource_id === '' || window.wiki_page_name === '') {
+ window.console.log('You must have a wiki page open in order to revert pages.');
+ return false;
+ }
+ $.post("wiki/{{$channel}}/revert/page", {commitHash: commitHash, name: window.wiki_page_name, resource_id: window.wiki_resource_id},
+ function (data) {
+ if (data.success) {
+ window.console.log('Reverted content: ' + data.content);
+ // put contents in editor
+ editor.getSession().setValue(data.content);
+ } else {
+ window.console.log('Error reverting page.');
+ }
+ }, 'json');
+ }
</script>