diff --git a/classes/views/addons/settings.php b/classes/views/addons/settings.php index fd9baced93..8b28206e76 100644 --- a/classes/views/addons/settings.php +++ b/classes/views/addons/settings.php @@ -21,13 +21,15 @@
- + +

- + +

diff --git a/css/frm_admin.css b/css/frm_admin.css index f75c27977a..0a5a6632b2 100644 --- a/css/frm_admin.css +++ b/css/frm_admin.css @@ -5199,15 +5199,18 @@ label.frm-example-icon { display: none; } -.edd_frm_status_icon.frm_icon_font { - color: #D54E21; +.edd_frm_status_icon.frmsvg { margin: 0 5px; } -.edd_frm_status_icon.frm_icon_font.frm_inactive_icon { +.edd_frm_license_row .frm_action_success .frmsvg { color: green; } +.edd_frm_license_row .frm_action_error .frmsvg { + color: #D54E21; +} + /* Hide the install steps for solutions */ #form_global_settings .tabs-panel .num svg { display: none; diff --git a/js/formidable_admin.js b/js/formidable_admin.js index 5394e6a1e3..bf8dd1a41e 100644 --- a/js/formidable_admin.js +++ b/js/formidable_admin.js @@ -8676,27 +8676,35 @@ function frmAdminBuildJS() { const pluginSlug = this.getAttribute( 'data-plugin' ); const action = buttonName.replace( 'edd_' + pluginSlug + '_license_', '' ); let license = document.getElementById( 'edd_' + pluginSlug + '_license_key' ).value; + button.get(0).disabled = true; jQuery.ajax({ type: 'POST', url: ajaxurl, dataType: 'json', data: {action: 'frm_addon_' + action, license: license, plugin: pluginSlug, nonce: frmGlobal.nonce}, success: function( msg ) { + button.get(0).disabled = false; const thisRow = button.closest( '.edd_frm_license_row' ); if ( action === 'deactivate' ) { license = ''; document.getElementById( 'edd_' + pluginSlug + '_license_key' ).value = ''; } thisRow.find( '.edd_frm_license' ).html( license ); - if ( msg.success === true ) { - thisRow.find( '.frm_icon_font' ).removeClass( 'frm_hidden' ); - thisRow.find( 'div.alignleft' ).toggleClass( 'frm_hidden', 1000 ); - } + const eddWrapper = button.get(0).closest( '.frm_form_field' ); + const actionIsSuccess = msg.success === true; + eddWrapper.querySelector( `.frm_icon_font.frm_action_success` ).classList.toggle( 'frm_hidden', ! actionIsSuccess || action === 'deactivate' ); + eddWrapper.querySelector( `.frm_icon_font.frm_action_error` ).classList.toggle( 'frm_hidden', actionIsSuccess); const messageBox = thisRow.find( '.frm_license_msg' ); messageBox.html( msg.message ); if ( msg.message !== '' ) { setTimeout( function() { messageBox.html( '' ); - }, 15000 ); + thisRow.find( '.frm_icon_font' ).addClass( 'frm_hidden' ); + if ( actionIsSuccess ) { + const actionIsActivate = action === 'activate'; + thisRow.get(0).querySelector( '.edd_frm_unauthorized' ).classList.toggle( 'frm_hidden', actionIsActivate ); + thisRow.get(0).querySelector( '.edd_frm_authorized' ).classList.toggle( 'frm_hidden', ! actionIsActivate ); + } + }, 2000 ); } } });