aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-06-04 18:00:32 -0400
committerAndrew Manning <tamanning@zoho.com>2016-06-04 18:00:32 -0400
commit4bc4fd5b7ebd7c5f25cfc9acfbda5b14a38dedb8 (patch)
treea083e9b77bf662a049aa94599c0ab83f6e5b0453 /view/tpl
parenta92241d3cf609b60cb9dbaa0ef5a7ff7237e7faa (diff)
downloadvolse-hubzilla-4bc4fd5b7ebd7c5f25cfc9acfbda5b14a38dedb8.tar.gz
volse-hubzilla-4bc4fd5b7ebd7c5f25cfc9acfbda5b14a38dedb8.tar.bz2
volse-hubzilla-4bc4fd5b7ebd7c5f25cfc9acfbda5b14a38dedb8.zip
Page deletion implemented. Hide the delete button and disallow for Home page.
Diffstat (limited to 'view/tpl')
-rw-r--r--view/tpl/wiki.tpl34
1 files changed, 30 insertions, 4 deletions
diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl
index 384dc796d..6cdfabdb9 100644
--- a/view/tpl/wiki.tpl
+++ b/view/tpl/wiki.tpl
@@ -5,10 +5,10 @@
height: 500px;
}
.fade.in {
- -webkit-transition: opacity 2s 1s ease;
- -moz-transition: opacity 2s 1s ease;
- -o-transition: opacity 2s 1s ease;
- transition: opacity 2s 1s ease;
+ -webkit-transition: opacity 0.5s 0.5s ease;
+ -moz-transition: opacity 0.5s 0.5s ease;
+ -o-transition: opacity 0.5s 0.5s ease;
+ transition: opacity 0.5s 0.5s ease;
}
</style>
<div class="generic-content-wrapper">
@@ -106,6 +106,9 @@
<script>
window.wiki_resource_id = '{{$resource_id}}';
window.wiki_page_name = '{{$page}}';
+ if (window.wiki_page_name === 'Home') {
+ $('#delete-page').hide();
+ }
$(document).ready(function () {
wiki_refresh_page_list();
// Show Edit tab first. Otherwise the Ace editor does not load.
@@ -206,4 +209,27 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) {
}, 'json');
ev.preventDefault();
});
+
+ $('#delete-page').click(function (ev) {
+ if (window.wiki_resource_id === '' || window.wiki_page_name === '' || window.wiki_page_name === 'Home') {
+ window.console.log('You must have a wiki page open in order to delete pages.');
+ ev.preventDefault();
+ return false;
+ }
+ $.post("wiki/{{$channel}}/delete/page", {name: window.wiki_page_name, resource_id: window.wiki_resource_id},
+ function (data) {
+ if (data.success) {
+ window.console.log('Page deleted successfully.');
+ var url = window.location.href;
+ if (url.substr(-1) == '/') url = url.substr(0, url.length - 2);
+ url = url.split('/');
+ url.pop();
+ window.location = url.join('/');
+ } else {
+ alert('Error deleting page.'); // TODO: Replace alerts with auto-timeout popups
+ window.console.log('Error deleting page.');
+ }
+ }, 'json');
+ ev.preventDefault();
+ });
</script>