Skip to content

Commit

Permalink
fix(pat registry): Fix record editing modals.
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki committed Dec 9, 2022
1 parent 0b3d7ac commit b71f707
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions src/pat/controlpanels/registry--implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import $ from "jquery";
import registry from "@patternslib/patternslib/src/core/registry";
import utils from "../../core/utils";
import Modal from "../modal/modal";
import Base from "@patternslib/patternslib/src/core/base";

export default class ConfigRegistry {
constructor(el) {
this.el = el;
}
loadModals() {
$(".recordsEditLink").each(function () {
$(".recordsEditLink, .recordsDeleteLink").each(function () {
var $el = $(this);
var options = {
actionOptions: {
Expand All @@ -36,50 +35,39 @@ export default class ConfigRegistry {
/* ajax retrieval of paging */
$("#recordsContainer").on(
"click",
"nav.pagination a, div.listingBar a",
function () {
".pagination a, .listingBar a",
function (e) {
e.preventDefault();
var $el = $(this);
utils.loading.show();
$("#recordsContainer").load(
$el.attr("href") + " #recordsTable",
$("#recordsTable").load(
$el.attr("href") + " #recordsTable > *",
function () {
/* scan registry */
registry.scan($("#recordsTable"));
self.loadModals();
utils.loading.hide();
}
);
return false;
}
);

/* ajax form submission */
$("#recordsContainer").on("submit", "#searchrow form", function (e) {
e.preventDefault();
var $el = $(this);
utils.loading.show();
$("#recordsContainer").load(
$("body").attr("data-base-url") +
"?" +
$el.serialize() +
" #recordsTable",
$("#recordsTable").load(
$("body").attr("data-base-url")
+ "?" + $el.serialize() + " #recordsTable > *",
function () {
$("#spinner").hide();
$('#searchrow input[name="q"]').trigger("keypress");
registry.scan($("#recordsTable"));
self.loadModals();
utils.loading.hide();
}
);
e.preventDefault();
return false;
});

/* force submit on select change */
$("#recordsContainer").on("change", "#searchrow select", function () {
$("#searchrow form#registry-filter").trigger("submit");
});

/* some init */
$('#searchrow input[name="q"]').trigger("keypress");
}
}

0 comments on commit b71f707

Please sign in to comment.