🚸 (content): Use a draft button instead of the current system
This commit is contained in:
parent
33c8cec5d5
commit
aa4d3ac726
2 changed files with 25 additions and 47 deletions
|
@ -51,7 +51,7 @@ echo Bootstrap::formInputHidden(array(
|
||||||
<!-- TOOLBAR -->
|
<!-- TOOLBAR -->
|
||||||
<div class="mb-3 col-lg-6">
|
<div class="mb-3 col-lg-6">
|
||||||
<button type="button" class="btn btn-light" data-bs-toggle="modal" data-bs-target="#jsmediaManagerModal"><span class="fa fa-image"></span> <?php $L->p('Images') ?></button>
|
<button type="button" class="btn btn-light" data-bs-toggle="modal" data-bs-target="#jsmediaManagerModal"><span class="fa fa-image"></span> <?php $L->p('Images') ?></button>
|
||||||
<span id="jsswitchButton" data-switch="<?php echo ($page->draft() ? 'draft' : 'publish') ?>" class="ms-2 btn-outline-<?php echo ($page->draft() ? 'light' : 'success') ?> btn"><?php echo ($page->draft() ? $L->g('Draft') : $L->g('Publish')) ?></span>
|
<button id="jsbuttonPreview" type="button" class="btn btn-secondary"><?php $L->p('Preview') ?></button>
|
||||||
|
|
||||||
<?php if ($page->scheduled()) : ?>
|
<?php if ($page->scheduled()) : ?>
|
||||||
<div class="alert alert-warning p-1 mt-1 mb-0"><?php $L->p('scheduled') ?>: <?php echo $page->date(SCHEDULED_DATE_FORMAT) ?></div>
|
<div class="alert alert-warning p-1 mt-1 mb-0"><?php $L->p('scheduled') ?>: <?php echo $page->date(SCHEDULED_DATE_FORMAT) ?></div>
|
||||||
|
@ -59,8 +59,8 @@ echo Bootstrap::formInputHidden(array(
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-6 text-end">
|
<div class="col-lg-6 text-end">
|
||||||
<button id="jsbuttonPreview" type="button" class="btn btn-secondary"><?php $L->p('Preview') ?></button>
|
<button type="button" class="btn btn-secondary" id="jsbuttonDraft" ><?php $L->p('Draft') ?></button>
|
||||||
<button type="button" class="btn btn-primary" id="jsbuttonSave"><?php echo $L->g('Save') ?></button>
|
<button type="button" class="btn btn-primary" id="jsbuttonSave"><?php echo $L->g('Publish') ?></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -484,19 +484,6 @@ foreach ($customFields as $field => $options) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Button switch
|
|
||||||
$("#jsswitchButton").on("click", function() {
|
|
||||||
if ($(this).data("switch") == "publish") {
|
|
||||||
$(this).html('<?php $L->p('Draft') ?>');
|
|
||||||
$(this).data("switch", "draft");
|
|
||||||
$(this).attr('class', "ms-2 btn-outline-secondary btn");
|
|
||||||
} else {
|
|
||||||
$(this).html('<?php $L->p('Publish') ?>');
|
|
||||||
$(this).data("switch", "publish");
|
|
||||||
$(this).attr('class', "ms-2 btn-outline-success btn");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Button preview
|
// Button preview
|
||||||
$("#jsbuttonPreview").on("click", function() {
|
$("#jsbuttonPreview").on("click", function() {
|
||||||
var uuid = $("#jsuuid").val();
|
var uuid = $("#jsuuid").val();
|
||||||
|
@ -511,13 +498,8 @@ foreach ($customFields as $field => $options) {
|
||||||
|
|
||||||
// Button Save
|
// Button Save
|
||||||
$("#jsbuttonSave").on("click", function() {
|
$("#jsbuttonSave").on("click", function() {
|
||||||
// If the switch is setted to "published", get the value from the selector
|
var value = $("#jstypeSelector option:selected").val();
|
||||||
if ($("#jsswitchButton").data("switch") == "publish") {
|
$("#jstype").val(value);
|
||||||
var value = $("#jstypeSelector option:selected").val();
|
|
||||||
$("#jstype").val(value);
|
|
||||||
} else {
|
|
||||||
$("#jstype").val("draft");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the content
|
// Get the content
|
||||||
$("#jscontent").val(editorGetContent());
|
$("#jscontent").val(editorGetContent());
|
||||||
|
|
|
@ -44,11 +44,11 @@ echo Bootstrap::formInputHidden(array(
|
||||||
<!-- TOOLBAR -->
|
<!-- TOOLBAR -->
|
||||||
<div class="mb-3 col-lg-6">
|
<div class="mb-3 col-lg-6">
|
||||||
<button type="button" class="btn btn-light" data-bs-toggle="modal" data-bs-target="#jsmediaManagerModal"><span class="fa fa-image"></span> <?php $L->p('Images') ?></button>
|
<button type="button" class="btn btn-light" data-bs-toggle="modal" data-bs-target="#jsmediaManagerModal"><span class="fa fa-image"></span> <?php $L->p('Images') ?></button>
|
||||||
<span id="jsswitchButton" data-switch="publish" class="ms-2 btn-outline-success btn"><?php $L->p('Publish') ?></span>
|
<button id="jsbuttonPreview" type="button" class="btn btn-secondary"><?php $L->p('Preview') ?></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-6 text-end">
|
<div class="col-lg-6 text-end">
|
||||||
<button id="jsbuttonPreview" type="button" class="btn btn-secondary"><?php $L->p('Preview') ?></button>
|
<button type="button" class="btn btn-secondary" id="jsbuttonDraft"><?php $L->p('Draft') ?></button>
|
||||||
<button type="button" class="btn btn-primary" id="jsbuttonSave"><?php echo $L->g('Save') ?></button>
|
<button type="button" class="btn btn-primary" id="jsbuttonSave"><?php echo $L->g('Save') ?></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -439,19 +439,6 @@ foreach ($customFields as $field => $options) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Button switch
|
|
||||||
$("#jsswitchButton").on("click", function() {
|
|
||||||
if ($(this).data("switch") == "publish") {
|
|
||||||
$(this).html('<?php $L->p('Draft') ?>');
|
|
||||||
$(this).data("switch", "draft");
|
|
||||||
$(this).attr('class', "ms-2 btn-outline-secondary btn");
|
|
||||||
} else {
|
|
||||||
$(this).html('<?php $L->p('Publish') ?>');
|
|
||||||
$(this).data("switch", "publish");
|
|
||||||
$(this).attr('class', "ms-2 btn-outline-success btn");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Button preview
|
// Button preview
|
||||||
$("#jsbuttonPreview").on("click", function() {
|
$("#jsbuttonPreview").on("click", function() {
|
||||||
var uuid = $("#jsuuid").val();
|
var uuid = $("#jsuuid").val();
|
||||||
|
@ -467,15 +454,24 @@ foreach ($customFields as $field => $options) {
|
||||||
$("#jsbuttonSave").on("click", function() {
|
$("#jsbuttonSave").on("click", function() {
|
||||||
let actionParameters = '';
|
let actionParameters = '';
|
||||||
|
|
||||||
// If the switch is setted to "published", get the value from the selector
|
var value = $("#jstypeSelector option:selected").val();
|
||||||
if ($("#jsbuttonSwitch").data("switch") == "publish") {
|
$("#jstype").val(value);
|
||||||
var value = $("#jstypeSelector option:selected").val();
|
actionParameters = '#' + value;
|
||||||
$("#jstype").val(value);
|
|
||||||
actionParameters = '#' + value;
|
// Get the content
|
||||||
} else {
|
$("#jscontent").val(editorGetContent());
|
||||||
$("#jstype").val("draft");
|
|
||||||
actionParameters = '#draft';
|
// 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
|
// Get the content
|
||||||
$("#jscontent").val(editorGetContent());
|
$("#jscontent").val(editorGetContent());
|
||||||
|
|
Loading…
Add table
Reference in a new issue