Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACF 5.3.1 support #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions css/acf5_repeater_collapser_admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,23 @@
background: transparent;
}

.acf-fields.-top .field_type-flexible_content .layout.row-layout {
padding-left: 0;
margin-left: 30px;
}

.field_type-flexible_content .field-repeater-toggle-single {
position: absolute;
top: 50%;
margin-top: -15px;
left: 5px;
}
.acf-fields.-top .field_type-flexible_content .field-repeater-toggle-single {
left: auto;
right: 100%;
margin-right: 4px;
}

/* Weird positioning exception */
.field_type-flexible_content .field_type-repeater .field-repeater-toggle-single {
left: 8px;
Expand Down Expand Up @@ -70,16 +81,25 @@
position: relative;
}

.collapsed-row .acf-table tr {
.collapsed-row .acf-table tr,
.collapsed-row .acf-fields.-left .acf-field,
.acf-fields.-top .collapsed-row .acf-fields .acf-field {
display: none;
}

.collapsed-row .acf-table tr:first-child {
display: table-row;
}

.collapsed-row .acf-fields.-left .acf-field:first-child,
.acf-fields.-top .collapsed-row .acf-fields .acf-field:first-child {
display: block;
}

/* "Masks" the first field in order to prevent clicking on it */
.collapsed-row .acf-table tr::after {
.collapsed-row .acf-table tr::after,
.collapsed-row .acf-fields.-left .acf-field::after,
.acf-fields.-top .collapsed-row .acf-fields .acf-field::after {
position: absolute;
top: 0; bottom: 0; left: 0px; right: 0;
display: block;
Expand All @@ -90,3 +110,9 @@
background: -webkit-linear-gradient( rgba( 244, 244, 244, .2 ), rgba( 244, 244, 244, 1 ) );
background: linear-gradient( rgba( 244, 244, 244, .2 ), rgba( 244, 244, 244, 1 ) );
}

/* Clearfix */
.collapsed-row .acf-fields.-left .acf-field,
.acf-fields.-top .collapsed-row .acf-fields .acf-field {
overflow: hidden;
}
10 changes: 6 additions & 4 deletions js/acf5_repeater_collapser_admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jQuery(document).ready(function($) {
var $repeater = $(this);

// only use this on row layout
if( $( '.acf-repeater', $repeater ).hasClass('-row') ) {
if( $( '.acf-input-table.row-layout,.acf-repeater.-row .acf-table', $repeater).length ) {
$repeater.find('.layout').addClass('row-layout');
$repeater.data('acf-rowset-collapsed', false).attr('aria-expanded', false);

Expand All @@ -35,7 +35,9 @@ jQuery(document).ready(function($) {
});

// append single repeater collapse to each row of repeater field
$('.field_type-repeater .row-layout > tbody > .acf-row,.field_type-repeater > tbody > .row-layout .acf-row.clone').each( function() {
$('.field_type-repeater .row-layout > tbody > .acf-row,' +
'.field_type-repeater > tbody > .row-layout .acf-row.clone, ' +
'.field_type-repeater .acf-repeater.-row .acf-table > tbody > .acf-row').each( function() {
var id = 'acf-repeater-' + i,
$that = $(this);

Expand All @@ -55,7 +57,7 @@ jQuery(document).ready(function($) {
var $that = $(this),
id;

if( $('.acf-input-table', $that).hasClass('row-layout') ) {
if( $('.acf-input-table.row-layout, > .acf-fields', $that).length ) {
id = 'acf-repeater-' + i;
i++;

Expand All @@ -76,7 +78,7 @@ jQuery(document).ready(function($) {
'.field-repeater-toggle-all',
acfRepeaterToggleAll
);
$( '.field_type-repeater .row-layout,.field_type-flexible_content' ).on(
$( '.field_type-repeater .row-layout,.field_type-repeater .acf-repeater.-row,.field_type-flexible_content' ).on(
'click',
'.field-repeater-toggle-single',
acfRepeaterToggleSingle
Expand Down