|
|
|
@ -15,24 +15,12 @@
|
|
|
|
|
<div class="section-title-wrapper">
|
|
|
|
|
|
|
|
|
|
<div class="pull-right">
|
|
|
|
|
{{if $showNewWikiButton || $showPageControls}}
|
|
|
|
|
{{if $showPageControls}}
|
|
|
|
|
<div class="btn-group">
|
|
|
|
|
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
|
|
|
|
|
<i class="fa fa-caret-down"></i> {{$tools_label}}
|
|
|
|
|
</button>
|
|
|
|
|
<ul class="dropdown-menu">
|
|
|
|
|
{{if $showNewWikiButton}}
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<a class="nav-link" href="#" onclick="$('#new-page-form-wrapper').hide(); openClose('new-wiki-form-wrapper'); return false;" data-form_id="new-wiki-form"><i class="fa fa-book"></i> New Wiki</a>
|
|
|
|
|
</li>
|
|
|
|
|
{{/if}}
|
|
|
|
|
{{if $showNewPageButton}}
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<a class="nav-link" href="#" onclick="$('#new-wiki-form-wrapper').hide(); openClose('new-page-form-wrapper'); return false;" data-form_id="new-page-form"><i class="fa fa-file-text-o"></i> New Page</a>
|
|
|
|
|
</li>
|
|
|
|
|
{{/if}}
|
|
|
|
|
{{if $showPageControls}}
|
|
|
|
|
<li class="divider"></li>
|
|
|
|
|
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<a id="rename-page" class="nav-link" href="#"><i class="fa fa-edit"></i> Rename Page</a>
|
|
|
|
@ -43,7 +31,7 @@
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<a id="embed-image" class="nav-link" href="#"><i class="fa fa-picture-o"></i> Embed Image</a>
|
|
|
|
|
</li>
|
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@ -87,6 +75,18 @@
|
|
|
|
|
<hr>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="edit-wiki-form-wrapper" class="section-content-tools-wrapper" style="display:none;">
|
|
|
|
|
<form id="edit-wiki-form" action="wiki/edit/wiki" method="post" >
|
|
|
|
|
<div class="clear"></div>
|
|
|
|
|
|
|
|
|
|
<div class="btn-group pull-right">
|
|
|
|
|
<!--<button id="edit-wiki-submit" class="btn btn-success" type="submit" name="submit" >Edit Wiki</button>-->
|
|
|
|
|
<button class="btn btn-md btn-danger" onclick="wiki_delete_wiki(window.wiki_title, window.wiki_resource_id); return false;"><i class="fa fa-trash-o"></i> Delete Wiki</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form> <div class="clear"></div>
|
|
|
|
|
<hr>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="new-page-form-wrapper" class="section-content-tools-wrapper" style="display:none;">
|
|
|
|
|
<form id="new-page-form" action="wiki/create/page" method="post" >
|
|
|
|
|
<div class="clear"></div>
|
|
|
|
@ -178,6 +178,7 @@
|
|
|
|
|
</div><!-- /.modal-dialog -->
|
|
|
|
|
</div><!-- /.modal -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
window.wiki_resource_id = '{{$resource_id}}';
|
|
|
|
|
window.wiki_page_name = '{{$page}}';
|
|
|
|
@ -218,13 +219,6 @@
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
wiki_refresh_page_list();
|
|
|
|
|
$("#wiki-toc").toc({content: "#wiki-preview", headings: "h1,h2,h3,h4"});
|
|
|
|
|
// Show Edit tab first. Otherwise the Ace editor does not load.
|
|
|
|
|
$("#wiki-nav-tabs li:eq(1) a").tab('show');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var editor = ace.edit("ace-editor");
|
|
|
|
|
editor.setTheme("ace/theme/github");
|
|
|
|
|
editor.getSession().setMode("ace/mode/markdown");
|
|
|
|
@ -257,7 +251,7 @@
|
|
|
|
|
ev.preventDefault();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function wiki_delete_wiki(wikiHtmlName, resource_id) {
|
|
|
|
|
function wiki_delete_wiki(wikiHtmlName, resource_id) {
|
|
|
|
|
if(!confirm('Are you sure you want to delete the entire wiki: ' + JSON.stringify(wikiHtmlName))) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -271,12 +265,12 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) {
|
|
|
|
|
window.console.log('Error deleting wiki.');
|
|
|
|
|
}
|
|
|
|
|
}, 'json');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function wiki_download_wiki(resource_id) {
|
|
|
|
|
function wiki_download_wiki(resource_id) {
|
|
|
|
|
window.location = "wiki/{{$channel}}/download/wiki/" + resource_id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#new-page-submit').click(function (ev) {
|
|
|
|
|
if (window.wiki_resource_id === '') {
|
|
|
|
@ -303,6 +297,11 @@ function wiki_download_wiki(resource_id) {
|
|
|
|
|
if (data.success) {
|
|
|
|
|
$('#wiki_page_list_container').html(data.pages);
|
|
|
|
|
$('#wiki_page_list_container').show();
|
|
|
|
|
{{if $showNewPageButton}}
|
|
|
|
|
$('#new-page-button').show();
|
|
|
|
|
{{else}}
|
|
|
|
|
$('#new-page-button').hide();
|
|
|
|
|
{{/if}}
|
|
|
|
|
} else {
|
|
|
|
|
alert('Error fetching page list!');
|
|
|
|
|
window.console.log('Error fetching page list!');
|
|
|
|
@ -512,4 +511,43 @@ function wiki_download_wiki(resource_id) {
|
|
|
|
|
'json');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function wiki_show_new_wiki_form() {
|
|
|
|
|
$('#new-page-form-wrapper').hide();
|
|
|
|
|
$('#edit-wiki-form-wrapper').hide();
|
|
|
|
|
$('#new-wiki-form-wrapper').toggle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function wiki_show_new_page_form() {
|
|
|
|
|
$('#edit-wiki-form-wrapper').hide();
|
|
|
|
|
$('#new-wiki-form-wrapper').hide();
|
|
|
|
|
$('#new-page-form-wrapper').toggle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function wiki_show_edit_wiki_form(wiki_title, wiki_resource_id) {
|
|
|
|
|
window.wiki_resource_id = wiki_resource_id;
|
|
|
|
|
window.wiki_title = wiki_title;
|
|
|
|
|
$('#new-page-form-wrapper').hide();
|
|
|
|
|
$('#new-wiki-form-wrapper').hide();
|
|
|
|
|
$('#edit-wiki-form-wrapper').toggle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
wiki_refresh_page_list();
|
|
|
|
|
$("#wiki-toc").toc({content: "#wiki-preview", headings: "h1,h2,h3,h4"});
|
|
|
|
|
// Show Edit tab first. Otherwise the Ace editor does not load.
|
|
|
|
|
$("#wiki-nav-tabs li:eq(1) a").tab('show');
|
|
|
|
|
{{if $showNewWikiButton}}
|
|
|
|
|
$('#new-wiki-button').show();
|
|
|
|
|
{{else}}
|
|
|
|
|
$('#new-wiki-button').hide();
|
|
|
|
|
{{/if}}
|
|
|
|
|
{{if $showPageControls}}
|
|
|
|
|
$('#edit-wiki-button').show();
|
|
|
|
|
{{else}}
|
|
|
|
|
$('#edit-wiki-button').hide();
|
|
|
|
|
{{/if}}
|
|
|
|
|
});
|
|
|
|
|
</script>
|