I have a collection named Order ( online shopping )
I’d like to add some buttons in the collection entry sidebar, this button simply changes the entry status and then save it.
add_button.php should contain something like this (not tested):
<!-- Lexy templating with double curly brackets - output: <?php echo $text; ?> -->
<p>{{ $text }}</p>
<!-- riot.js with single curly brackets in onclick event -->
<button class="uk-button uk-button-large" value="buttonvalue" onclick="{ changeEntryAndSave }">
<!-- Lexy templating again -->
{{ $button }}
</button>
<script>
changeEntryAndSave = function(e) {
if (e) e.preventDefault();
$this.entry.status = 'Shipping';
$this.update();
$this.submit();
}
</script>
PS: You can use markdown syntax highlighting on discourse by using backticks. It makes code more readable and it prevents copy/paste issues with wrong quotation.