diff --git a/bl-kernel/admin/views/edit-content.php b/bl-kernel/admin/views/edit-content.php index 2055eb70..a4c0d3b6 100644 --- a/bl-kernel/admin/views/edit-content.php +++ b/bl-kernel/admin/views/edit-content.php @@ -51,7 +51,7 @@ echo Bootstrap::formInputHidden(array(
- draft() ? $L->g('Draft') : $L->g('Publish')) ?> + scheduled()) : ?>
p('scheduled') ?>: date(SCHEDULED_DATE_FORMAT) ?>
@@ -59,8 +59,8 @@ echo Bootstrap::formInputHidden(array(
- - + +
@@ -484,19 +484,6 @@ foreach ($customFields as $field => $options) { }; } - // Button switch - $("#jsswitchButton").on("click", function() { - if ($(this).data("switch") == "publish") { - $(this).html('p('Draft') ?>'); - $(this).data("switch", "draft"); - $(this).attr('class', "ms-2 btn-outline-secondary btn"); - } else { - $(this).html('p('Publish') ?>'); - $(this).data("switch", "publish"); - $(this).attr('class', "ms-2 btn-outline-success btn"); - } - }); - // Button preview $("#jsbuttonPreview").on("click", function() { var uuid = $("#jsuuid").val(); @@ -511,13 +498,8 @@ foreach ($customFields as $field => $options) { // Button Save $("#jsbuttonSave").on("click", function() { - // If the switch is setted to "published", get the value from the selector - if ($("#jsswitchButton").data("switch") == "publish") { - var value = $("#jstypeSelector option:selected").val(); - $("#jstype").val(value); - } else { - $("#jstype").val("draft"); - } + var value = $("#jstypeSelector option:selected").val(); + $("#jstype").val(value); // Get the content $("#jscontent").val(editorGetContent()); diff --git a/bl-kernel/admin/views/new-content.php b/bl-kernel/admin/views/new-content.php index 42b23158..144d56a6 100644 --- a/bl-kernel/admin/views/new-content.php +++ b/bl-kernel/admin/views/new-content.php @@ -44,11 +44,11 @@ echo Bootstrap::formInputHidden(array(
- p('Publish') ?> +
- +
@@ -439,19 +439,6 @@ foreach ($customFields as $field => $options) { }; } - // Button switch - $("#jsswitchButton").on("click", function() { - if ($(this).data("switch") == "publish") { - $(this).html('p('Draft') ?>'); - $(this).data("switch", "draft"); - $(this).attr('class', "ms-2 btn-outline-secondary btn"); - } else { - $(this).html('p('Publish') ?>'); - $(this).data("switch", "publish"); - $(this).attr('class', "ms-2 btn-outline-success btn"); - } - }); - // Button preview $("#jsbuttonPreview").on("click", function() { var uuid = $("#jsuuid").val(); @@ -467,15 +454,24 @@ foreach ($customFields as $field => $options) { $("#jsbuttonSave").on("click", function() { let actionParameters = ''; - // If the switch is setted to "published", get the value from the selector - if ($("#jsbuttonSwitch").data("switch") == "publish") { - var value = $("#jstypeSelector option:selected").val(); - $("#jstype").val(value); - actionParameters = '#' + value; - } else { - $("#jstype").val("draft"); - actionParameters = '#draft'; - } + var value = $("#jstypeSelector option:selected").val(); + $("#jstype").val(value); + actionParameters = '#' + value; + + // Get the content + $("#jscontent").val(editorGetContent()); + + // Submit the form + $("#jsform").attr('action', actionParameters); + $("#jsform").submit(); + }); + + // Button Draft + $("#jsbuttonDraft").on("click", function() { + let actionParameters = ''; + + $("#jstype").val("draft"); + actionParameters = '#draft'; // Get the content $("#jscontent").val(editorGetContent());