Small cleanup and improvements

This commit is contained in:
wandji20
2024-10-29 11:12:14 +01:00
parent 696c42cba4
commit 1b70ff904f
3 changed files with 3 additions and 16 deletions

View File

@@ -13,6 +13,9 @@ export default class extends Controller {
document.removeEventListener('modal-close', this.modalClose);
}
// Manually submit request for bulk print invoics since selected orders
// cannot be passed directly as params in haml template. So we use JS (#getSelectedIds)
// to get selected orders inorder to print the appropriate invoices.
printInvoices(e) {
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
const data = { bulk_ids: this.getSelectedIds() };

View File

@@ -66,19 +66,6 @@ export default class extends Controller {
}, 200);
}
resend_confirmation(event) {
fetch("/user/spree_user/confirmation", {
method: "POST",
body: JSON.stringify({
spree_user: { email: this.emailValue },
tab: event.currentTarget.dataset.tab,
}),
headers: { "Content-type": "application/json; charset=UTF-8" },
})
.then(response => response.text())
.then(html => { Turbo.renderStreamMessage(html) });
}
returnHome() {
window.location = "/";
}

View File

@@ -951,12 +951,10 @@ RSpec.describe '
order.finalize! # ensure order has a payment to capture
order.payments << create(:check_payment, order:, amount: order.total)
order.payments.first.capture!
login_as_admin
visit spree.edit_admin_order_path(order)
end
it "ships the order and shipment email is sent" do
login_as_admin
expect(order.reload.shipped?).to be false
click_button 'Ship'
@@ -974,7 +972,6 @@ RSpec.describe '
end
it "ships the order without sending email" do
login_as_admin
expect(order.reload.shipped?).to be false
click_button 'Ship'