mirror of
https://github.com/processwire/processwire.git
synced 2025-08-17 12:10:45 +02:00
Fix issue with repeater item settings toggle and visibility (as used by RM) not working when ajax repeater item starts collapsed
This commit is contained in:
@@ -156,10 +156,18 @@ function InputfieldRepeater($) {
|
|||||||
var eventSettingsClick = function(e) {
|
var eventSettingsClick = function(e) {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $item = $this.closest('.InputfieldRepeaterItem');
|
var $item = $this.closest('.InputfieldRepeaterItem');
|
||||||
var $settings = $item.children('.InputfieldContent')
|
|
||||||
.children('.Inputfields')
|
// find .InputfieldRepeaterSettings, if applicable (like with RM)
|
||||||
.children('.InputfieldWrapper')
|
// .InputfieldRepeaterItem > .InputfieldContent > .Inputfields > .InputfieldRepeaterSettings
|
||||||
.children('.Inputfields').children('.InputfieldRepeaterSettings');
|
var $settingsParent = $item.children('.InputfieldContent').children('.Inputfields');
|
||||||
|
var $settings = $settingsParent.children('.InputfieldRepeaterSettings'); // ajax loaded item
|
||||||
|
|
||||||
|
if(!$settings.length) {
|
||||||
|
// already open item has more layers
|
||||||
|
// .InputfieldRepeaterItem > .InputfieldContent > .Inputfields > .InputfieldWrapper > .Inputfields > .InputfieldRepeaterSettings
|
||||||
|
$settingsParent = $settingsParent.children('.InputfieldWrapper').children('.Inputfields');
|
||||||
|
$settings = $settingsParent.children('.InputfieldRepeaterSettings');
|
||||||
|
}
|
||||||
|
|
||||||
if($item.hasClass('InputfieldStateCollapsed')) {
|
if($item.hasClass('InputfieldStateCollapsed')) {
|
||||||
$this.closest('.InputfieldHeader').click(); //find('.InputfieldRepeaterToggle').click();
|
$this.closest('.InputfieldHeader').click(); //find('.InputfieldRepeaterToggle').click();
|
||||||
@@ -263,9 +271,14 @@ function InputfieldRepeater($) {
|
|||||||
InputfieldsInit($inputfields);
|
InputfieldsInit($inputfields);
|
||||||
|
|
||||||
var $repeaters = $inputs.find('.InputfieldRepeater');
|
var $repeaters = $inputs.find('.InputfieldRepeater');
|
||||||
if($repeaters.length) $repeaters.each(function() {
|
if($repeaters.length) {
|
||||||
initRepeater($(this));
|
// nested
|
||||||
});
|
$repeaters.each(function() {
|
||||||
|
initRepeater($(this));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$item.find('.InputfieldRepeaterSettings').hide();
|
||||||
|
}
|
||||||
|
|
||||||
$content.slideDown('fast', function() {
|
$content.slideDown('fast', function() {
|
||||||
$spinner.removeClass('fa-spin fa-spinner').addClass('fa-arrows');
|
$spinner.removeClass('fa-spin fa-spinner').addClass('fa-arrows');
|
||||||
@@ -694,7 +707,6 @@ function InputfieldRepeater($) {
|
|||||||
if($t.hasClass('InputfieldRepeaterHeaderInit')) return;
|
if($t.hasClass('InputfieldRepeaterHeaderInit')) return;
|
||||||
var icon = 'fa-arrows';
|
var icon = 'fa-arrows';
|
||||||
var $item = $t.parent();
|
var $item = $t.parent();
|
||||||
var $settings = $t.find('.InputfieldRepeaterSettingsToggle').length > 0;
|
|
||||||
if($item.hasClass('InputfieldRepeaterNewItem')) {
|
if($item.hasClass('InputfieldRepeaterNewItem')) {
|
||||||
// noAjaxAdd mode
|
// noAjaxAdd mode
|
||||||
icon = 'fa-plus';
|
icon = 'fa-plus';
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user