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

Version Path
cm-admin-3.0.15 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.14 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.13 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.12 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.11 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.10 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.9 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.8 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.7 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.6 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.5 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.4 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.3 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.2 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.1 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-3.0.0 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.4.6 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.4.5 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.4.4 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.4.3 app/assets/javascripts/cm_admin/custom_action.js