Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dialog.confirm(message).then((answer) => {
const completed = Rails.fire(element, "confirm:complete", [answer]);
if (answer && completed) {
// Allow the event to propagate normally and re-dispatch it without
// the confirm data attribute which the Rails internal method is
// checking.
$(element).data("confirm", null);
$(element).removeAttr("data-confirm");
// The submit button click events won't do anything if they are
// dispatched as is. In these cases, just submit the underlying form.
if (ev.type === "click" &&
(
$(element).is('button[type="submit"]') ||
$(element).is('input[type="submit"]')
)
) {
$(element).parents("form").submit();
FavoriteGroup.open_favgroup_dialog = function(e) {
if ($(".add-to-favgroup").length === 1) {
// If the user only has one favorite group we don't need to ask which group to add the post to.
let favgroup = $(".add-to-favgroup").get(0);
Rails.fire(favgroup, "click");
} else {
$("#add-to-favgroup-dialog").dialog("open");
}
e.preventDefault();
}
const allowAction = (ev, element) => {
const message = $(element).data("confirm");
if (!message) {
return true;
}
if (!Rails.fire(element, "confirm")) {
return false;
}
if (TEMPLATE_HTML === null) {
TEMPLATE_HTML = $("#confirm-modal")[0].outerHTML;
$("#confirm-modal").remove();
}
const dialog = new ConfirmDialog(
$(element)
);
dialog.confirm(message).then((answer) => {
const completed = Rails.fire(element, "confirm:complete", [answer]);
if (answer && completed) {
// Allow the event to propagate normally and re-dispatch it without
// the confirm data attribute which the Rails internal method is
paymentMethod(error, payload) {
if (error) {
console.error("Error with payment method:", error)
return
}
this.addHiddenField("processor", "braintree")
this.addHiddenField("card_token", payload.nonce)
Rails.fire(this.formTarget, "submit")
}
"Submit": function() {
let form = $("#add-commentary-dialog #edit-commentary").get(0);
Rails.fire(form, "submit");
$(this).dialog("close");
},
"Cancel": function() {
"Submit": function() {
let form = $dialog.find("form").get(0);
Rails.fire(form, "submit");
},
"Cancel": function() {