aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-05-27 22:19:05 -0400
committerAndrew Manning <tamanning@zoho.com>2016-05-27 22:19:05 -0400
commit4691c3ec01eda972e7b4cae4ec940c8c24d51b5a (patch)
treeb088f7c8464f02a01d52078c9a8c390b83c75c21 /view/tpl
parentca78ebce6d254f244b4c1fbe25eb3aca40b26952 (diff)
downloadvolse-hubzilla-4691c3ec01eda972e7b4cae4ec940c8c24d51b5a.tar.gz
volse-hubzilla-4691c3ec01eda972e7b4cae4ec940c8c24d51b5a.tar.bz2
volse-hubzilla-4691c3ec01eda972e7b4cae4ec940c8c24d51b5a.zip
Add new page to wiki and redirect to editor page.
Diffstat (limited to 'view/tpl')
-rw-r--r--view/tpl/wiki.tpl19
1 files changed, 19 insertions, 0 deletions
diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl
index 652434c3e..b0824650c 100644
--- a/view/tpl/wiki.tpl
+++ b/view/tpl/wiki.tpl
@@ -76,6 +76,7 @@
</div>
<script>
+ window.wiki_resource_id = '{{$resource_id}}';
$(document).ready(function () {
// Show Edit tab first. Otherwise the Ace editor does not load.
$("#wiki-nav-tabs li:eq(0) a").tab('show');
@@ -112,4 +113,22 @@ function wiki_delete_wiki(wikiName, resource_id) {
}
}, 'json');
}
+
+
+ $('#new-page-submit').click(function (ev) {
+ if (window.wiki_resource_id === '') {
+ window.console.log('You must have a wiki open in order to create pages.');
+ ev.preventDefault();
+ return false;
+ }
+ $.post("wiki/{{$channel}}/create/page", {name: $('#id_pageName').val(), resource_id: window.wiki_resource_id},
+ function (data) {
+ if (data.success) {
+ window.location = data.url;
+ } else {
+ window.console.log('Error creating page.');
+ }
+ }, 'json');
+ ev.preventDefault();
+ });
</script>