Skip to content

Instantly share code, notes, and snippets.

View dparfrey's full-sized avatar

Dave Parfrey dparfrey

View GitHub Profile
@dparfrey
dparfrey / confirm_controller.js
Created April 19, 2021 14:18
Confirmation dialog (non-UJS) for Rails 6, Hotwire/Stimulus, and Bootstrap 5. Uses vanilla Javascript.
// This is a replacement for the built-in Rails ujs confirmation method when using Bootstrap.
// Trying to hook into the built-in stuff is a pain, and changes with every Rails (now Hotwire)
// version.
import { Controller } from "stimulus";
import { Modal } from "bootstrap";
export default class extends Controller {
static values = {
title: String,
message: String,