Skip to content

Instantly share code, notes, and snippets.

@raynoppe
Last active July 28, 2020 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raynoppe/4bc7b085f6ad311dc8f2a856a2b35386 to your computer and use it in GitHub Desktop.
Save raynoppe/4bc7b085f6ad311dc8f2a856a2b35386 to your computer and use it in GitHub Desktop.
Cocktail Functions
prfs.sendmessage(subject, type, html, text, to);
const mailOptions = {
from: 'dne.life <noreply@dne.life>',
// replyTo: frommail,
to: inbound.nr.email,
subject: `${slottype} confirmation`,
text: textm,
html: cn7,
attachments: [
{ // utf-8 string as an attachment
filename: 'booking.ics',
content: icsout
}
]
};
// get
this.DataGet("/url");
this.DataGet("/url", "rows");
// Post
const newrecord = await this.DataPost("/form", data);
// strings / html
const ntprtxt = data.html.replace(/<[^>]*>?/gm, '');
const pretxt = ntprtxt.substring(0, 150);
str = str.replace(/(?:\r\n|\r|\n)/g, '<br>');
v-html="nt.notehtml"
// Loading
isLoading: true,
<b-loading :active.sync="isLoading" :can-cancel="false" :is-full-page="false"></b-loading>
this.$router.push({ name: 'analytics' });
// open a modal
<b-modal :active.sync="isCardModalActive" :width="640" scroll="keep">
<div class="card modal-card roundedtop roundedbottom">
<div class="card-header roundedtop bluebg10">
<div class="card-header-title white">Title</div>
</div>
<div class="modal-card-body">
<div class="content"></div>
</div>
<footer class="card-footer roundedbottom">
<div class="card-footer-item roundedbottomleft isPointer bluebg1 bluetxt8">Cancel</div>
<div class="card-footer-item roundedbottomright isPointer bluebg10 white txtbold">Save</div>
</footer>
</div>
</b-modal>
const that = this; // re-assign the scope so it doesn't intefere with the modals scope
let useFull = true;
let useCanCancel = false;
const inw = document.body.clientWidth;
if (inw > 750) { useFull = false; useCanCancel = true; }
this.modal = this.$buefy.modal.open({
parent: this,
component: ModalMapForm,
hasModalCard: true,
fullScreen: useFull,
canCancel: useCanCancel,
width: 700,
props: {
data: {},
},
events: {
dataFromModal: value => {
console.log('value', value);
}
}
});
// call event from modal
this.$emit("dataFromModal", sv.data.row);
this.$buefy.snackbar.open({ message: "Message", type: "is-warning", position: "is-bottom" });
// toast
this.$buefy.toast.open({ message: "", position: "is-bottom", type: "is-danger" });
// confirm delete
this.$buefy.dialog.confirm({
title: "",
message:
"Are you sure you want to <b>delete</b> this? This cannot be undone.",
confirmText: "Delete",
type: "is-danger",
hasIcon: true,
icon: 'exclamation',
onConfirm: () => {}
});
// prompt
this.$buefy.dialog.prompt({
message: `Please enter a name for this form`,
inputAttrs: {
placeholder: "Contact form",
maxlength: 10
},
trapFocus: true,
onConfirm: value => this.$buefy.toast.open(`Your form is: ${value}`)
});
this.$buefy.snackbar.open({
message: "Restore this log entry?",
position: "is-bottom",
type: "is-warning",
indefinite: true,
onAction: async () => {
row.deleted = false;
row.deletedreason = '';
const updl = await this.DataSend('put', '/worklog/update', row);
}
});
import { EventBus } from '../event-bus.js';
EventBus.$emit('doc_updated', data);
async created() {
EventBus.$on('doc_updated', data => {
// do something
});
}
destroyed() {
EventBus.$off('doc_updated');
},
EventBus.$emit('show_alert', {title: '', message: 'My message', type: 'is-info', hasIcon: true, icon:'exclamation-triangle', iconPack:'fal'});
EventBus.$emit('show_alert', {title: '', message: 'My message', type: 'is-danger', hasIcon: true, icon:'exclamation-triangle', iconPack:'fal'});
watch:{
$route (to, from){
this.show = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment