src/rails_admin/ui.js in rails_admin-3.0.0.beta2 vs src/rails_admin/ui.js in rails_admin-3.0.0.rc
- old
+ new
@@ -5,53 +5,11 @@
(function ($) {
$(document).on("click", "#list input.toggle", function () {
$("#list [name='bulk_ids[]']").prop("checked", $(this).is(":checked"));
});
- $(document).on("click", ".pjax", function (event) {
- if (event.which > 1 || event.metaKey || event.ctrlKey) {
- return;
- }
-
- if ($.support.pjax) {
- event.preventDefault();
- $.pjax({
- container: $(this).data("pjax-container") || "[data-pjax-container]",
- url: $(this).data("href") || $(this).attr("href"),
- timeout: 2000,
- });
- return;
- }
-
- if ($(this).data("href")) {
- window.location = $(this).data("href");
- }
- });
-
- $(document).on("submit", ".pjax-form", function (event) {
- if ($.support.pjax) {
- event.preventDefault();
- $.pjax({
- container: $(this).data("pjax-container") || "[data-pjax-container]",
- url:
- this.action +
- (this.action.indexOf("?") !== -1 ? "&" : "?") +
- $(this).serialize(),
- timeout: 2000,
- });
- }
- });
-
- $(document)
- .on("pjax:start", function () {
- return $("#loading").show();
- })
- .on("pjax:end", function () {
- return $("#loading").hide();
- });
-
- $(document).on("click", "[data-target]", function () {
+ $(document).on("click", "[data-bs-target]", function () {
if (!$(this).hasClass("disabled")) {
if ($(this).has("i.fa-chevron-down").length) {
$(this)
.removeClass("active")
.children("i")
@@ -67,11 +25,11 @@
}
}
}
});
- $(document).on("click", ".form-horizontal legend", function () {
+ $(document).on("click", "form legend", function () {
if ($(this).has("i.fa-chevron-down").length) {
$(this).siblings(".control-group:visible").hide("slow");
$(this).children("i").toggleClass("fa-chevron-down fa-chevron-right");
} else {
if ($(this).has("i.fa-chevron-right").length) {
@@ -91,22 +49,17 @@
.siblings("i")
.toggleClass("fa-check fa-trash");
}
);
- $(document).ready(function () {
+ document.addEventListener("turbo:load", function () {
I18n.init($("html").attr("lang"), $("#admin-js").data("i18nOptions"));
const event = new CustomEvent("rails_admin.dom_ready");
document.dispatchEvent(event);
});
- $(document).on("pjax:end", function () {
- const event = new CustomEvent("rails_admin.dom_ready");
- document.dispatchEvent(event);
- });
-
document.addEventListener("rails_admin.dom_ready", function () {
$(".nav.nav-pills li.active").removeClass("active");
$(
'.nav.nav-pills li[data-model="' + $(".page-header").data("model") + '"]'
).addClass("active");
@@ -120,17 +73,14 @@
},
length,
"easeOutQuad"
);
});
- $(".form-horizontal legend")
+ $("form.main legend")
.has("i.fa-chevron-right")
.each(function () {
$(this).siblings(".control-group").hide();
});
- $(".table").tooltip({
- selector: "th[rel=tooltip]",
- });
$("[formnovalidate]").on("click", function () {
$(this).closest("form").attr("novalidate", true);
});
$.each($("#filters_box").data("options"), function () {
$.filters.append(this);