Sha256: 27333de65f8ab0a0badae99fac3f26fa53ee45913fd51bf24f7e6839efba500a
Contents?: true
Size: 1021 Bytes
Versions: 55
Compression:
Stored size: 1021 Bytes
Contents
import * as bootstrap from "bootstrap"; window.bootstrap = bootstrap; document.addEventListener("turbo:load", function () { $('[data-action="fetch-modal"]').on("click", function (e) { const actionName = $(this).attr("data-action_name"); const modelName = $(this).attr("data-model_name"); const recordId = $(this).attr("data-record_id"); const modalContainer = $( "[data-behaviour='custom-action-modal-container']" ); const routeMount = document.location.href.split("/")[3]; if (!actionName || !modelName || !recordId || !modalContainer) return; $.ajax({ url: `/${routeMount}/${modelName}/${recordId}/custom_action_modal/${actionName}`, method: "GET", success: function (response) { modalContainer.html(response); const actionModal = new bootstrap.Modal( modalContainer.children().first() ); actionModal.show(); }, error: function (error) { console.error("Error:", error); }, }); }); });
Version data entries
55 entries across 55 versions & 1 rubygems