mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-23 01:03:21 +00:00
Fix js for switching form partial for new admin payments
All of the functional changes made in this commit came from a future version of Spree:
8a3a80b08a
This commit is contained in:
33
app/assets/javascripts/admin/payments/new.js
Normal file
33
app/assets/javascripts/admin/payments/new.js
Normal file
@@ -0,0 +1,33 @@
|
||||
// Override of Spree's logic in the file of the same name
|
||||
// Changes made as per https://github.com/spree/spree/commit/8a3a80b08abf80fbed2fcee4b429ba1caf68baf1
|
||||
// which allows the form partial in admin/payments/new to be switched using radio buttons
|
||||
// We can remove this file when we reach 2.3.0
|
||||
|
||||
$(document).ready(function() {
|
||||
if ($("#new_payment").is("*")) {
|
||||
$('.payment_methods_radios').click(
|
||||
function() {
|
||||
$('.payment-methods').hide();
|
||||
if (this.checked) {
|
||||
$('#payment_method_' + this.value).show();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$('.payment_methods_radios').each(
|
||||
function() {
|
||||
if (this.checked) {
|
||||
$('#payment_method_' + this.value).show();
|
||||
} else {
|
||||
$('#payment_method_' + this.value).hide();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$(".card_new").radioControlsVisibilityOfElement('.card_form');
|
||||
|
||||
$('select.jump_menu').change(function(){
|
||||
window.location = this.options[this.selectedIndex].value;
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user