From 39367e7b51aeb8857c5f2769ff348c214c7cda91 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 12 Jan 2022 09:34:12 +0200 Subject: [PATCH 01/21] Remove unused --- .../ppcp-onboarding/assets/js/onboarding.js | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/modules/ppcp-onboarding/assets/js/onboarding.js b/modules/ppcp-onboarding/assets/js/onboarding.js index fd63915ff..fa0522d1c 100644 --- a/modules/ppcp-onboarding/assets/js/onboarding.js +++ b/modules/ppcp-onboarding/assets/js/onboarding.js @@ -101,27 +101,6 @@ function ppcp_onboarding_productionCallback(...args) { return ppcp_onboarding.loginSeller('production', ...args); } -/** - * Since the PayPal modal will redirect the user a dirty form - * provokes an alert if the user wants to leave the page. Since the user - * needs to toggle the sandbox switch, we disable this dirty state with the - * following workaround for checkboxes. - * - * @param event - */ -const checkBoxOnClick = (event) => { - const value = event.target.checked; - if (event.target.getAttribute('id') === 'ppcp-sandbox_on') { - toggleSandboxProduction(! value); - } - event.preventDefault(); - event.stopPropagation(); - setTimeout( () => { - event.target.checked = value; - },1 - ); -}; - /** * Toggles the credential input fields. * @@ -274,12 +253,6 @@ const disconnect = (event) => { ); } - // document.querySelectorAll('#mainform input[type="checkbox"]').forEach( - // (checkbox) => { - // checkbox.addEventListener('click', checkBoxOnClick); - // } - // ); - document.querySelectorAll('#field-sandbox_toggle_manual_input button, #field-production_toggle_manual_input button').forEach( (button) => { button.addEventListener( From f5e02e8c936f00d50bb2e9d6b63db28c78098fb5 Mon Sep 17 00:00:00 2001 From: Alex P Date: Thu, 13 Jan 2022 08:24:33 +0200 Subject: [PATCH 02/21] Allow settings items without titles --- .../ppcp-onboarding/assets/css/onboarding.css | 2 +- .../src/Settings/SettingsRenderer.php | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/modules/ppcp-onboarding/assets/css/onboarding.css b/modules/ppcp-onboarding/assets/css/onboarding.css index affc68415..2b40e1ab1 100644 --- a/modules/ppcp-onboarding/assets/css/onboarding.css +++ b/modules/ppcp-onboarding/assets/css/onboarding.css @@ -81,7 +81,7 @@ } /* Probably not the best location for this but will do until there's a general purpose settings CSS file. */ -.ppcp-settings-field-heading td, .ppcp-settings-field-heading th { +.ppcp-settings-field-heading td, .ppcp-settings-field-heading th, .ppcp-settings-no-title-col td { padding-left: 0; } diff --git a/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php b/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php index 39c6c8390..c9f40bc4a 100644 --- a/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php +++ b/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php @@ -377,6 +377,16 @@ $data_rows_html ?> + + + + + fields as $field => $config ) : if ( ! in_array( $this->state->current_state(), $config['screens'], true ) ) { continue; @@ -406,14 +416,17 @@ $data_rows_html $key = 'ppcp[' . $field . ']'; $id = 'ppcp-' . $field; $config['id'] = $id; - $colspan = 'ppcp-heading' !== $config['type'] ? 1 : 2; + $colspan = ( 'ppcp-heading' !== $config['type'] && isset( $config['title'] ) ) ? 1 : 2; $classes = isset( $config['classes'] ) ? $config['classes'] : array(); $classes[] = sprintf( 'ppcp-settings-field-%s', str_replace( 'ppcp-', '', $config['type'] ) ); - $description = isset( $config['description'] ) ? $config['description'] : ''; + if ( 1 !== $colspan ) { + $classes[] = 'ppcp-settings-no-title-col'; + } + $description = isset( $config['description'] ) ? $config['description'] : ''; unset( $config['description'] ); ?> - +