several fixes to payment applet styling & script
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -21,27 +21,7 @@ const initWallet = () => {
|
||||
saveBtn.hidden = false;
|
||||
cancelBtn.hidden = false;
|
||||
const section = addBtn.closest('section');
|
||||
const rowPx = 3 * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||
const updateRows = () => {
|
||||
const sectionTop = section.getBoundingClientRect().top;
|
||||
let maxBottom = sectionTop;
|
||||
for (const child of section.children) {
|
||||
if (child.hidden) continue;
|
||||
maxBottom = Math.max(maxBottom, child.getBoundingClientRect().bottom);
|
||||
}
|
||||
const padBot = parseFloat(getComputedStyle(section).paddingBottom);
|
||||
const rows = Math.ceil((maxBottom - sectionTop + padBot) / rowPx) + 1;
|
||||
section.style.setProperty('--applet-rows', String(rows));
|
||||
};
|
||||
paymentEl.on('ready', () => {
|
||||
updateRows();
|
||||
const stripeContainer = document.getElementById('id_stripe_payment_element');
|
||||
if (stripeContainer) {
|
||||
const obs = new ResizeObserver(updateRows);
|
||||
obs.observe(stripeContainer);
|
||||
section._stripeObs = obs;
|
||||
}
|
||||
});
|
||||
section.style.setProperty('--applet-rows', '15');
|
||||
});
|
||||
|
||||
saveBtn.addEventListener('click', async () => {
|
||||
@@ -68,8 +48,7 @@ const initWallet = () => {
|
||||
saveBtn.hidden = true;
|
||||
cancelBtn.hidden = true;
|
||||
const section = cancelBtn.closest('section');
|
||||
section.style.setProperty('--applet-rows', '2');
|
||||
if (section._stripeObs) { section._stripeObs.disconnect(); section._stripeObs = null; }
|
||||
section.style.setProperty('--applet-rows', '3');
|
||||
});
|
||||
|
||||
cancelBtn.addEventListener('click', () => {
|
||||
@@ -81,8 +60,7 @@ const initWallet = () => {
|
||||
saveBtn.hidden = true;
|
||||
cancelBtn.hidden = true;
|
||||
const section = cancelBtn.closest('section');
|
||||
section.style.setProperty('--applet-rows', '2');
|
||||
if (section._stripeObs) { section._stripeObs.disconnect(); section._stripeObs = null; }
|
||||
section.style.setProperty('--applet-rows', '3');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class WalletViewAppletContextTest(TestCase):
|
||||
)
|
||||
Applet.objects.get_or_create(
|
||||
slug="wallet-payment",
|
||||
defaults={"name": "Payment Methods", "grid_cols": 6, "grid_rows": 2, "context": "wallet"},
|
||||
defaults={"name": "Payment Methods", "grid_cols": 6, "grid_rows": 3, "context": "wallet"},
|
||||
)
|
||||
self.client.force_login(self.user)
|
||||
|
||||
@@ -96,7 +96,7 @@ class ToggleWalletAppletsTest(TestCase):
|
||||
)[0]
|
||||
Applet.objects.get_or_create(
|
||||
slug="wallet-payment",
|
||||
defaults={"name": "Payment Methods", "grid_cols": 6, "grid_rows": 2, "context": "wallet"},
|
||||
defaults={"name": "Payment Methods", "grid_cols": 6, "grid_rows": 3, "context": "wallet"},
|
||||
)
|
||||
self.client.force_login(self.user)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user