From 3066c091d240b5bd7308f0c42159747cbf3113f1 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sat, 27 Apr 2019 20:30:57 +0200 Subject: [PATCH] Feature page preview and switch button for publish and draft --- bl-kernel/admin/controllers/new-content.php | 3 --- bl-kernel/admin/views/edit-content.php | 12 +++++++++++- bl-kernel/admin/views/new-content.php | 20 +++++++++++++++----- bl-kernel/ajax/save-as-draft.php | 5 ----- bl-kernel/ajax/upload-images.php | 3 +++ bl-kernel/boot/rules/69.pages.php | 2 +- 6 files changed, 30 insertions(+), 15 deletions(-) diff --git a/bl-kernel/admin/controllers/new-content.php b/bl-kernel/admin/controllers/new-content.php index 38486fbc..b8239dc7 100644 --- a/bl-kernel/admin/controllers/new-content.php +++ b/bl-kernel/admin/controllers/new-content.php @@ -45,9 +45,6 @@ if (IMAGE_RESTRICT) { define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.DS.'thumbnails'.DS); define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/'); define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/'); - - // Create the directory to store the images - Filesystem::mkdir(PAGE_THUMBNAILS_DIRECTORY, true); } else { define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS)); define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS)); diff --git a/bl-kernel/admin/views/edit-content.php b/bl-kernel/admin/views/edit-content.php index 5018f4b9..1c5f8bc6 100644 --- a/bl-kernel/admin/views/edit-content.php +++ b/bl-kernel/admin/views/edit-content.php @@ -61,7 +61,7 @@ echo Bootstrap::formOpen(array(
- + draft()?$L->g('Draft'):$L->g('Publish')) ?>
@@ -394,6 +394,16 @@ $(document).ready(function() { } }); + // Button preview + $("#jsbuttonPreview").on("click", function() { + var uuid = $("#jsuuid").val(); + var title = $("#jstitle").val(); + var content = editorGetContent(); + var ajax = new bluditAjax(); + ajax.autosave(uuid, title, content, false); + window.open("uuid().'?preview='.md5('autosave-'.$page->uuid()) ?>", "_blank"); + }); + // Button Save $("#jsbuttonSave").on("click", function() { // If the switch is setted to "published", get the value from the selector diff --git a/bl-kernel/admin/views/new-content.php b/bl-kernel/admin/views/new-content.php index 32e4ae82..763f0d80 100644 --- a/bl-kernel/admin/views/new-content.php +++ b/bl-kernel/admin/views/new-content.php @@ -54,9 +54,9 @@ echo Bootstrap::formOpen(array(
- - - p('Publish') ?> + + + p('Publish') ?>