mirror of
https://github.com/gantry/gantry5.git
synced 2026-08-19 01:15:04 -05:00
Add support for Widgets with checkboxes that use the trick of hidden/checkbox fields with the same name (fixes #1014)
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
3. [WordPress](#wordpress)
|
||||
2. [](#improved)
|
||||
- Gantry 5 Particle Widget is now compatible with WordPress Customizer and will live-refresh on change (#869)
|
||||
- Add support for Widgets with checkboxes that use the trick of hidden/checkbox fields with the same name (#1014)
|
||||
|
||||
# 5.2.18
|
||||
## 27/05/2016
|
||||
|
||||
@@ -161,6 +161,12 @@ var StepTwo = function(data, content, button) {
|
||||
if (!name || input.disabled() || (type == 'radio' && !input.checked())) { return; }
|
||||
|
||||
input = content.find('[name="' + name + '"]' + (type == 'radio' ? ':checked' : ''));
|
||||
|
||||
// workaround for checkboxes trick that has both a hidden and checkbox field
|
||||
if (type === 'checkbox' && content.find('[type="hidden"][name="' + name + '"]')) {
|
||||
input = content.find('[name="' + name + '"][type="checkbox"]');
|
||||
}
|
||||
|
||||
var value = input.type() == 'checkbox' ? Number(input.checked()) : input.value(),
|
||||
parent = input.parent('.settings-param'),
|
||||
override = parent ? parent.find('> input[type="checkbox"]') : null;
|
||||
|
||||
@@ -133,6 +133,12 @@ ready(function() {
|
||||
if (!name || input.disabled() || (type == 'radio' && !input.checked())) { return; }
|
||||
|
||||
input = content.find('[name="' + name + '"]' + (type == 'radio' ? ':checked' : ''));
|
||||
|
||||
// workaround for checkboxes trick that has both a hidden and checkbox field
|
||||
if (type === 'checkbox' && content.find('[type="hidden"][name="' + name + '"]')) {
|
||||
input = content.find('[name="' + name + '"][type="checkbox"]');
|
||||
}
|
||||
|
||||
var value = value = input.type() == 'checkbox' ? Number(input.checked()) : input.value(),
|
||||
parent = input.parent('.settings-param'),
|
||||
override = parent ? parent.find('> input[type="checkbox"]') : null;
|
||||
|
||||
Vendored
+12
@@ -5025,6 +5025,12 @@ var StepTwo = function(data, content, button) {
|
||||
if (!name || input.disabled() || (type == 'radio' && !input.checked())) { return; }
|
||||
|
||||
input = content.find('[name="' + name + '"]' + (type == 'radio' ? ':checked' : ''));
|
||||
|
||||
// workaround for checkboxes trick that has both a hidden and checkbox field
|
||||
if (type === 'checkbox' && content.find('[type="hidden"][name="' + name + '"]')) {
|
||||
input = content.find('[name="' + name + '"][type="checkbox"]');
|
||||
}
|
||||
|
||||
var value = input.type() == 'checkbox' ? Number(input.checked()) : input.value(),
|
||||
parent = input.parent('.settings-param'),
|
||||
override = parent ? parent.find('> input[type="checkbox"]') : null;
|
||||
@@ -8946,6 +8952,12 @@ ready(function() {
|
||||
if (!name || input.disabled() || (type == 'radio' && !input.checked())) { return; }
|
||||
|
||||
input = content.find('[name="' + name + '"]' + (type == 'radio' ? ':checked' : ''));
|
||||
|
||||
// workaround for checkboxes trick that has both a hidden and checkbox field
|
||||
if (type === 'checkbox' && content.find('[type="hidden"][name="' + name + '"]')) {
|
||||
input = content.find('[name="' + name + '"][type="checkbox"]');
|
||||
}
|
||||
|
||||
var value = value = input.type() == 'checkbox' ? Number(input.checked()) : input.value(),
|
||||
parent = input.parent('.settings-param'),
|
||||
override = parent ? parent.find('> input[type="checkbox"]') : null;
|
||||
|
||||
Reference in New Issue
Block a user