Fix toggle label clicks, notification positioning, and AJAX nonce issues
This commit is contained in:
@ -620,12 +620,32 @@ input:checked + .wp-toggle-slider:before {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
animation: fadeIn 0.3s ease-in-out;
|
animation: fadeIn 0.3s ease-in-out;
|
||||||
|
height: 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp-setting-notification.error {
|
.wp-setting-notification.error {
|
||||||
background: #d63638;
|
background: #d63638;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add space for notification to prevent layout shifts */
|
||||||
|
.wp-setting-left label,
|
||||||
|
.wp-allstars-toggle-left label,
|
||||||
|
.wp-allstars-setting-row label {
|
||||||
|
position: relative;
|
||||||
|
padding-right: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-setting-left label .wp-setting-notification,
|
||||||
|
.wp-allstars-toggle-left label .wp-setting-notification,
|
||||||
|
.wp-allstars-setting-row label .wp-setting-notification {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
from { opacity: 0; }
|
from { opacity: 0; }
|
||||||
to { opacity: 1; }
|
to { opacity: 1; }
|
||||||
|
@ -52,13 +52,19 @@ jQuery(document).ready(function($) {
|
|||||||
$checkbox.prop('checked', !isChecked).trigger('change');
|
$checkbox.prop('checked', !isChecked).trigger('change');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Prevent label clicks from triggering the toggle
|
||||||
|
$('.wp-setting-label, .wp-allstars-toggle label').on('click', function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
// Handle checkbox changes
|
// Handle checkbox changes
|
||||||
$('.wp-toggle-switch input[type="checkbox"]').on('change', function(e) {
|
$('.wp-toggle-switch input[type="checkbox"]').on('change', function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
var $input = $(this);
|
var $input = $(this);
|
||||||
var option = $input.attr('name');
|
var option = $input.attr('name');
|
||||||
var value = $input.is(':checked') ? 1 : 0;
|
var value = $input.is(':checked') ? 1 : 0;
|
||||||
var $label = $input.closest('.wp-setting-left').find('label');
|
var $label = $input.closest('.wp-setting-left, .wp-allstars-toggle-left').find('label');
|
||||||
|
|
||||||
updateOption(option, value)
|
updateOption(option, value)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
@ -101,6 +107,9 @@ jQuery(document).ready(function($) {
|
|||||||
var option = $input.attr('name');
|
var option = $input.attr('name');
|
||||||
var value = $input.val();
|
var value = $input.val();
|
||||||
var $label = $input.prev('label');
|
var $label = $input.prev('label');
|
||||||
|
if (!$label.length) {
|
||||||
|
$label = $input.closest('.wp-allstars-setting-row').find('label');
|
||||||
|
}
|
||||||
|
|
||||||
updateOption(option, value)
|
updateOption(option, value)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
@ -156,7 +165,7 @@ jQuery(document).ready(function($) {
|
|||||||
data: {
|
data: {
|
||||||
action: 'wp_allstars_get_plugins',
|
action: 'wp_allstars_get_plugins',
|
||||||
category: category || 'minimal',
|
category: category || 'minimal',
|
||||||
_wpnonce: wpAllstars.nonce
|
_ajax_nonce: wpAllstars.nonce
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@ -190,7 +199,7 @@ jQuery(document).ready(function($) {
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {
|
data: {
|
||||||
action: 'wp_allstars_get_theme',
|
action: 'wp_allstars_get_theme',
|
||||||
_wpnonce: wpAllstars.nonce
|
_ajax_nonce: wpAllstars.nonce
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
|
Reference in New Issue
Block a user