aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-11-14 20:45:04 -0500
committerAndrew Manning <tamanning@zoho.com>2016-11-14 20:45:04 -0500
commitc3e3c32bdcdbcafef33f32118fe95da1fa4cd92e (patch)
tree384a52a1d16ceb2e52ed77d30834dfad2f7a250e /view
parentf5ad1dfbc521223be5ca97f0b878d9267cffabb3 (diff)
downloadvolse-hubzilla-c3e3c32bdcdbcafef33f32118fe95da1fa4cd92e.tar.gz
volse-hubzilla-c3e3c32bdcdbcafef33f32118fe95da1fa4cd92e.tar.bz2
volse-hubzilla-c3e3c32bdcdbcafef33f32118fe95da1fa4cd92e.zip
Moved delete wiki button into new edit wiki form, opened by edit wiki icon in wiki list
Diffstat (limited to 'view')
-rw-r--r--view/tpl/wiki.tpl55
-rw-r--r--view/tpl/wikilist.tpl2
2 files changed, 29 insertions, 28 deletions
diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl
index bba35a0fc..4e76a79be 100644
--- a/view/tpl/wiki.tpl
+++ b/view/tpl/wiki.tpl
@@ -76,11 +76,12 @@
</div>
<div id="edit-wiki-form-wrapper" class="section-content-tools-wrapper" style="display:none;">
- <form id="edit-wiki-form" action="wiki/create/page" method="post" >
+ <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 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>&nbsp;Delete Wiki</button>
</div>
</form> <div class="clear"></div>
<hr>
@@ -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");
@@ -301,8 +295,13 @@
}
$.post("wiki/{{$channel}}/get/page/list/", {resource_id: window.wiki_resource_id}, function (data) {
if (data.success) {
- $('#wiki_page_list_container').html(data.pages);
- $('#wiki_page_list_container').show();
+ $('#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,41 +511,43 @@
'json');
};
- function wiki_hide_forms() {
+ function wiki_show_new_wiki_form() {
$('#new-page-form-wrapper').hide();
$('#edit-wiki-form-wrapper').hide();
- $('#new-wiki-form-wrapper').hide();
- }
-
- function wiki_show_new_wiki_form() {
- wiki_hide_forms();
- openClose('new-wiki-form-wrapper');
+ $('#new-wiki-form-wrapper').toggle();
return false;
}
function wiki_show_new_page_form() {
- wiki_hide_forms();
- openClose('new-page-form-wrapper');
+ $('#edit-wiki-form-wrapper').hide();
+ $('#new-wiki-form-wrapper').hide();
+ $('#new-page-form-wrapper').toggle();
return false;
}
- function wiki_show_edit_wiki_form() {
- wiki_hide_forms();
- openClose('edit-wiki-form-wrapper');
+ 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 $showNewPageButton}}
- $('#new-page-button').show();
+ {{if $showPageControls}}
+ $('#edit-wiki-button').show();
{{else}}
- $('#new-page-button').hide();
+ $('#edit-wiki-button').hide();
{{/if}}
});
</script> \ No newline at end of file
diff --git a/view/tpl/wikilist.tpl b/view/tpl/wikilist.tpl
index c880142e2..42452eb12 100644
--- a/view/tpl/wikilist.tpl
+++ b/view/tpl/wikilist.tpl
@@ -8,7 +8,7 @@
{{foreach $wikis as $wiki}}
<div class="form-group" id="wiki-{{$wiki.resource_id}}">
<a href="/wiki/{{$channel}}/{{$wiki.urlName}}/Home" title="View {{$wiki.title}}"><b>{{$wiki.title}}</b></a>
- <i class="pull-right generic-icons fakelink fa fa-trash-o" onclick="wiki_delete_wiki('{{$wiki.title}}','{{$wiki.resource_id}}'); return false;" title="Delete {{$wiki.title}}"></i>
+ <i id="edit-wiki-button" class="pull-right generic-icons fakelink fa fa-edit" onclick="wiki_show_edit_wiki_form('{{$wiki.title}}', '{{$wiki.resource_id}}');" title="Edit {{$wiki.title}}"></i>
<i class="pull-right generic-icons fakelink fa fa-download" onclick="wiki_download_wiki('{{$wiki.resource_id}}'); return false;" title="Download {{$wiki.title}}"></i>
</div>
{{/foreach}}