Skip to content

Commit

Permalink
v1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jameelmoses committed Aug 18, 2020
1 parent 37c7e24 commit 2ffbc57
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog ##

## 1.0.6 - 18 Aug 2020
* Resolve issue with modals related to new duplicate layout function in ACF 5.9

## 1.0.5 - 18 Aug 2020
* Resolve JS error if acf.getField() is not defined

Expand Down
4 changes: 2 additions & 2 deletions acf-flexible-content-extended.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Flexible Content Extended for Advanced Custom Fields
Version: 1.0.5
Version: 1.0.6
Plugin URI: https://github.com/jameelmoses/acf-flexible-content-extended
Description: Extends the ACF Flexible Content Field by transforming the layout list into a modal with image previews. Editing the fields layouts also happens in a modal for a better editing user experience.
Author: Jameel Moses
Expand Down Expand Up @@ -34,7 +34,7 @@
}

// Plugin constants
define( 'ACF_FCE_VERSION', '1.0.5' );
define( 'ACF_FCE_VERSION', '1.0.6' );
define( 'ACF_FCE_MIN_PHP_VERSION', '5.6' );

// Plugin URL and PATH
Expand Down
26 changes: 20 additions & 6 deletions assets/js/acf-flexible-content-extended.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,33 @@

// Edit button
const edit = $('<a class="acf-icon -pencil small light" href="#" data-event="edit-layout" title="Edit layout" />');
edit.on('click', ACFFCE.open);
$layout.find('> .acf-fc-layout-controls').append(edit);

// Add modal elements
$layout.prepend('<div class="acf-fc-modal-title" />');
$layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acf-fc-modal-content" />');
// Not a duplicated layout
if (!$layout.find('> .acf-fc-layout-controls a[data-event="edit-layout"]').length) {

// Add edit button
$layout.find('> .acf-fc-layout-controls').append(edit);

// Add modal elements
$layout.prepend('<div class="acf-fc-modal-title" />');
$layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acf-fc-modal-content" />');

// Duplicated layout
} else {
// Remove old edit button copied from existing layout
$layout.find('> .acf-fc-layout-controls a[data-event="edit-layout"]').remove();
// Add new edit button for current layout
$layout.find('> .acf-fc-layout-controls').append(edit);
}

// Bind click event to edit button to open modal
edit.on('click', ACFFCE.open);

},

open() {

const $layout = $(this).parents('.layout:first');

const caption = $layout.find('> .acf-fc-layout-handle').html();
const a = $('<a class="dashicons dashicons-no -cancel" />').on('click', ACFFCE.close);

Expand Down
26 changes: 20 additions & 6 deletions assets/src/acf-flexible-content-extended.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,33 @@

// Edit button
const edit = $('<a class="acf-icon -pencil small light" href="#" data-event="edit-layout" title="Edit layout" />');
edit.on('click', ACFFCE.open);
$layout.find('> .acf-fc-layout-controls').append(edit);

// Add modal elements
$layout.prepend('<div class="acf-fc-modal-title" />');
$layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acf-fc-modal-content" />');
// Not a duplicated layout
if (!$layout.find('> .acf-fc-layout-controls a[data-event="edit-layout"]').length) {

// Add edit button
$layout.find('> .acf-fc-layout-controls').append(edit);

// Add modal elements
$layout.prepend('<div class="acf-fc-modal-title" />');
$layout.find('> .acf-fields, > .acf-table').wrapAll('<div class="acf-fc-modal-content" />');

// Duplicated layout
} else {
// Remove old edit button copied from existing layout
$layout.find('> .acf-fc-layout-controls a[data-event="edit-layout"]').remove();
// Add new edit button for current layout
$layout.find('> .acf-fc-layout-controls').append(edit);
}

// Bind click event to edit button to open modal
edit.on('click', ACFFCE.open);

},

open() {

const $layout = $(this).parents('.layout:first');

const caption = $layout.find('> .acf-fc-layout-handle').html();
const a = $('<a class="dashicons dashicons-no -cancel" />').on('click', ACFFCE.close);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "acf-flexible-content-extended",
"description": "Extends the ACF Flexible Content Field by transforming the layout list into a modal with image previews. Editing the fields layouts also happens in a modal for a better editing user experience.",
"version": "1.0.5",
"version": "1.0.6",
"keywords": [
"WP",
"Advanced Custom Fields",
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: acf, advanced, custom, field, fields, addon, flexible, content, preview, m
Requires at least: 4.7.0
Requires PHP: 5.6
Tested up to: 5.5
Stable tag: 1.0.5
Stable tag: 1.0.6
License: GPLv3 or later
License URI: https://github.com/jameelmoses/acf-flexible-content-extended/blob/master/LICENSE.md

Expand Down Expand Up @@ -69,6 +69,11 @@ From your WordPress dashboard

== Changelog ==

= 1.0.6 =
*Release Date - 18 Aug 2020*

* Resolve issue with modals related to new duplicate layout function in ACF 5.9

= 1.0.5 =
*Release Date - 18 Aug 2020*

Expand Down

0 comments on commit 2ffbc57

Please sign in to comment.