aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Wiki.php12
-rw-r--r--view/tpl/wiki.tpl14
2 files changed, 18 insertions, 8 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 76c07f2bc..a53cb3f6a 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -63,12 +63,14 @@ class Wiki extends \Zotlabs\Web\Controller {
}
if(argc()<3) {
$wikiheader = t('Wiki Sandbox');
- $content = '# Wiki Sandbox\nContent you **edit** and **preview** here *will not be saved*.';
+ $content = '"# Wiki Sandbox\n\nContent you **edit** and **preview** here *will not be saved*."';
$hide_editor = false;
+ $showPageControls = false;
} elseif (argc()<4) {
$wikiheader = rawurldecode(argv(2)); // show wiki name
$content = '';
- $hide_editor = true;
+ $hide_editor = true;
+ $showPageControls = true;
} elseif (argc()<5) {
$wikiheader = rawurldecode(argv(2)) . ': ' . rawurldecode(argv(3)); // show wiki name and page
$p = wiki_get_page_content(array('wiki_resource_id' => $resource_id, 'page' => argv(3)));
@@ -78,17 +80,23 @@ class Wiki extends \Zotlabs\Web\Controller {
}
$content = $p['content'];
$hide_editor = false;
+ $showPageControls = true;
}
+ $parsedown = new Parsedown();
+ $renderedContent = $parsedown->text(json_decode($content));
+
$o .= replace_macros(get_markup_template('wiki.tpl'),array(
'$wikiheader' => $wikiheader,
'$hideEditor' => $hide_editor,
+ '$showPageControls' => $showPageControls,
'$channel' => $channel['channel_address'],
'$resource_id' => $resource_id,
'$lockstate' => $x['lockstate'],
'$acl' => $x['acl'],
'$bang' => $x['bang'],
'$content' => $content,
+ '$renderedContent' => $renderedContent,
'$wikiName' => array('wikiName', t('Enter the name of your new wiki:'), '', ''),
'$pageName' => array('pageName', t('Enter the name of the new page:'), '', '')
));
diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl
index 26258e7c2..9610eea63 100644
--- a/view/tpl/wiki.tpl
+++ b/view/tpl/wiki.tpl
@@ -49,8 +49,9 @@
<div id="wiki-content-container" class="section-content-wrapper" {{if $hideEditor}}style="display: none;"{{/if}}>
<ul class="nav nav-tabs" id="wiki-nav-tabs">
- <li class="active"><a data-toggle="tab" href="#edit-pane">Edit</a></li>
- <li><a data-toggle="tab" href="#preview-pane" id="wiki-get-preview">Preview</a></li>
+ <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>
+ {{if $showPageControls}}
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu">
@@ -58,15 +59,16 @@
<li><a data-toggle="tab" href="#delete">Delete</a></li>
</ul>
</li>
+ {{/if}}
</ul>
<div class="tab-content" id="myTabContent">
- <div id="edit-pane" class="tab-pane fade in active">
+ <div id="edit-pane" class="tab-pane fade">
<div id="ace-editor"></div>
</div>
- <div id="preview-pane" class="tab-pane fade">
+ <div id="preview-pane" class="tab-pane fade in active">
<div id="wiki-preview" class="section-content-wrapper">
-
+ {{$renderedContent}}
</div>
</div>
@@ -80,7 +82,7 @@
$(document).ready(function () {
wiki_refresh_page_list();
// Show Edit tab first. Otherwise the Ace editor does not load.
- $("#wiki-nav-tabs li:eq(0) a").tab('show');
+ $("#wiki-nav-tabs li:eq(1) a").tab('show');
});
var editor = ace.edit("ace-editor");