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-2.4.2 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.4.1 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.4.0 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.3.4 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.3.3 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.3.2 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.3.1 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.3.0 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.2.1 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.2.0 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.1.5 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.1.4 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.1.3 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.1.2 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.1.1 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.1.0 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.0.2 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.0.1 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-2.0.0 app/assets/javascripts/cm_admin/custom_action.js
cm-admin-1.5.56 app/assets/javascripts/cm_admin/custom_action.js