From 89033f59774d83b958f20d806a43c4f16c4e2d73 Mon Sep 17 00:00:00 2001
From: Djamil Legato
Date: Tue, 30 Sep 2014 15:49:28 -0700
Subject: [PATCH] Deletion of pages
---
themes/grav/js/pages-all.js | 15 +++++++++++++++
themes/grav/templates/pages.html.twig | 4 ++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/themes/grav/js/pages-all.js b/themes/grav/js/pages-all.js
index f60d6719..33154ef1 100644
--- a/themes/grav/js/pages-all.js
+++ b/themes/grav/js/pages-all.js
@@ -111,6 +111,21 @@ $(function(){
}
});
+ // deletion
+ $('[data-remodal-target="delete"]').on('click', function(){
+ var okdelete = $('[data-remodal-id=delete] a.button');
+
+ okdelete.data('delete-action', $(this).data('delete-url'));
+ });
+
+ $('[data-delete-action]').on('click', function(){
+ var confirm = $.remodal.lookup[$('[data-remodal-id=delete]').data('remodal')],
+ okdelete = $(this).data('delete-action');
+
+ window.location.href = okdelete;
+ confirm.close();
+ });
+
$(window).on('beforeunload', function(){
if (currentValues != getState()){
return "You have made changes on this page that you have not yet confirmed. If you navigate away from this page you will lose your unsaved changes";
diff --git a/themes/grav/templates/pages.html.twig b/themes/grav/templates/pages.html.twig
index c0d10e30..3e472c8b 100644
--- a/themes/grav/templates/pages.html.twig
+++ b/themes/grav/templates/pages.html.twig
@@ -156,8 +156,8 @@