Added dependency plugins

This commit is contained in:
Moris Zen
2018-06-25 00:00:37 +02:00
parent 720a1c31a4
commit f069f6782f
698 changed files with 289637 additions and 1 deletions

View File

@@ -0,0 +1,67 @@
/*---------------------------------------------------------------------------------------------
*
* Flexible Content
*
*---------------------------------------------------------------------------------------------*/
.acf-fc-meta {
margin: 0 0 10px;
padding: 0;
}
.acf-fc-meta li {
margin: 0 0 10px;
padding: 0;
}
.acf-fc-meta .acf-fc-meta-key {
display: none;
}
.acf-fc-meta .acf-fc-meta-display,
.acf-fc-meta .acf-fc-meta-min {
float: left;
width: 33%;
padding-right: 10px;
}
.acf-input-wrap.select {
border-radius: 0 3px 3px 0 !important;
border: #DFDFDF solid 1px;
}
.acf-input-wrap.select select {
margin: 0;
border: 0 none;
padding: 3px;
height: 26px;
}
.acf-fc-meta-label .acf-input-prepend,
.acf-fc-meta-name .acf-input-prepend,
.acf-fc-meta-display .acf-input-prepend {
min-width: 45px;
}
.acf-fl-actions {
visibility: hidden;
}
.acf-field:hover .acf-fl-actions {
visibility: visible;
}
.acf-fl-actions a {
display: block;
line-height: 20px;
padding: 1px 0;
font-size: 13px;
}
.acf-fl-actions a.ui-sortable-handle {
cursor: move;
}
/*---------------------------------------------------------------------------------------------
*
* Clone
*
*---------------------------------------------------------------------------------------------*/
.acf-field-object-clone {
/* group */
/* seamless */
}
.acf-field-object-clone[data-display="seamless"] .acf-field-setting-instructions,
.acf-field-object-clone[data-display="seamless"] .acf-field-setting-layout,
.acf-field-object-clone[data-display="seamless"] .acf-field-setting-wrapper,
.acf-field-object-clone[data-display="seamless"] .acf-field-setting-conditional_logic {
display: none;
}

View File

@@ -0,0 +1,670 @@
/*--------------------------------------------------------------------------------------------
*
* Vars
*
*--------------------------------------------------------------------------------------------*/
/* colors */
/* acf-field */
/* responsive */
/*--------------------------------------------------------------------------------------------
*
* Mixins
*
*--------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------
*
* Repeater
*
*---------------------------------------------------------------------------------------------*/
.acf-repeater {
/* table */
/* row handle (add/remove) */
/* add in spacer to th (force correct width) */
/* row */
/* sortable */
/* layouts */
/*
&.-row > table > tbody > tr:before,
&.-block > table > tbody > tr:before {
content: "";
display: table-row;
height: 2px;
background: #f00;
}
*/
/* empty */
/* collapsed */
/* collapsed (block layout) */
/* collapsed (table layout) */
}
.acf-repeater > table {
margin: 0 0 8px;
background: #F9F9F9;
}
.acf-repeater .acf-row-handle {
width: 16px;
text-align: center !important;
vertical-align: middle !important;
position: relative;
/* icons */
/* .order */
/* remove */
}
.acf-repeater .acf-row-handle .acf-icon {
display: none;
position: absolute;
top: 0;
margin: -8px 0 0 -2px;
/* minus icon */
}
.acf-repeater .acf-row-handle .acf-icon.-minus {
top: 50%;
/* ie fix */
}
body.browser-msie .acf-repeater .acf-row-handle .acf-icon.-minus {
top: 25px;
}
.acf-repeater .acf-row-handle.order {
background: #f4f4f4;
cursor: move;
color: #aaa;
text-shadow: #fff 0 1px 0;
}
.acf-repeater .acf-row-handle.order:hover {
color: #666;
}
.acf-repeater .acf-row-handle.order + td {
border-left-color: #DFDFDF;
}
.acf-repeater .acf-row-handle.remove {
background: #F9F9F9;
border-left-color: #DFDFDF;
}
.acf-repeater th.acf-row-handle:before {
content: "";
width: 16px;
display: block;
height: 1px;
}
.acf-repeater .acf-row {
/* hide clone */
/* hover */
}
.acf-repeater .acf-row.acf-clone {
display: none !important;
}
.acf-repeater .acf-row:hover,
.acf-repeater .acf-row.-hover {
/* icons */
}
.acf-repeater .acf-row:hover > .acf-row-handle .acf-icon,
.acf-repeater .acf-row.-hover > .acf-row-handle .acf-icon {
display: block;
}
.acf-repeater > table > tbody > tr.ui-sortable-helper {
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}
.acf-repeater > table > tbody > tr.ui-sortable-placeholder {
visibility: visible !important;
}
.acf-repeater > table > tbody > tr.ui-sortable-placeholder td {
background: #F9F9F9;
}
.acf-repeater.-row > table > tbody > tr > td,
.acf-repeater.-block > table > tbody > tr > td {
border-top-color: #E1E1E1;
}
.acf-repeater.-empty > table {
border-bottom: 0 none;
}
.acf-repeater.-empty.-row > table,
.acf-repeater.-empty.-block > table {
display: none;
}
.acf-repeater .acf-row.-collapsed > .acf-field {
display: none !important;
}
.acf-repeater .acf-row.-collapsed > td.acf-field.-collapsed-target {
display: table-cell !important;
}
.acf-repeater .acf-row.-collapsed > .acf-fields > * {
display: none !important;
}
.acf-repeater .acf-row.-collapsed > .acf-fields > .acf-field.-collapsed-target {
display: block !important;
}
.acf-repeater.-table .acf-row.-collapsed .acf-field.-collapsed-target {
border-left-color: #dfdfdf;
}
/*---------------------------------------------------------------------------------------------
*
* Flexible Content
*
*---------------------------------------------------------------------------------------------*/
.acf-flexible-content {
position: relative;
}
.acf-flexible-content > .no-value-message {
padding: 19px;
border: #ccc dashed 2px;
text-align: center;
}
.acf-flexible-content > .clones {
display: none;
}
.acf-flexible-content > .values {
margin: 0 0 8px;
}
.acf-flexible-content .layout {
position: relative;
margin: 20px 0 0;
background: #fff;
border: 1px solid #e1e1e1;
}
.acf-flexible-content .layout:first-child {
margin-top: 0;
}
.acf-flexible-content .layout .acf-fc-layout-handle {
display: block;
position: relative;
padding: 8px 10px;
cursor: move;
border-bottom: #E1E1E1 solid 1px;
color: #333333;
font-size: 14px;
line-height: 1.4em;
}
.acf-flexible-content .layout .acf-fc-layout-order {
display: block;
width: 20px;
height: 20px;
border-radius: 10px;
display: inline-block;
text-align: center;
line-height: 20px;
margin: 0 2px 0 0;
background: #F1F1F1;
font-size: 12px;
color: #666;
}
/* controlls*/
.acf-flexible-content {
/* layout */
}
.acf-flexible-content .layout {
/* controlls */
/* hover */
}
.acf-flexible-content .layout .acf-fc-layout-controlls {
position: absolute;
top: 8px;
right: 8px;
}
.acf-flexible-content .layout .acf-fc-layout-controlls .acf-icon {
display: block;
float: left;
margin: 0 0 0 5px;
}
.acf-flexible-content .layout .acf-fc-layout-controlls .acf-icon.-plus,
.acf-flexible-content .layout .acf-fc-layout-controlls .acf-icon.-minus {
visibility: hidden;
}
.acf-flexible-content .layout .acf-fc-layout-controlls .acf-icon.-collapse {
color: #72777c;
border-color: transparent;
}
.acf-flexible-content .layout .acf-fc-layout-controlls .acf-icon.-collapse:hover {
color: #23282d;
background: transparent;
}
.acf-flexible-content .layout:hover .acf-fc-layout-controlls .acf-icon.-plus,
.acf-flexible-content .layout.-open .acf-fc-layout-controlls .acf-icon.-plus,
.acf-flexible-content .layout:hover .acf-fc-layout-controlls .acf-icon.-minus,
.acf-flexible-content .layout.-open .acf-fc-layout-controlls .acf-icon.-minus {
visibility: visible;
}
.acf-flexible-content > .values > .ui-sortable-placeholder {
visibility: visible !important;
border: 1px dashed #b4b9be;
box-shadow: none;
background: transparent;
}
/* collapsed */
.acf-flexible-content .layout.-collapsed .acf-fc-layout-handle {
border-bottom-width: 0;
}
.acf-flexible-content .layout.-collapsed > .acf-fields,
.acf-flexible-content .layout.-collapsed > .acf-table {
display: none;
}
/* table */
.acf-flexible-content .layout > .acf-table {
border: 0 none;
box-shadow: none;
}
.acf-flexible-content .layout > .acf-table > tbody > tr {
background: #fff;
}
.acf-flexible-content .layout > .acf-table > thead > tr > th {
background: #F9F9F9;
}
/* popup */
.acf-fc-popup {
background: #2F353E;
border-radius: 5px;
color: #fff;
padding: 7px 0;
position: absolute;
font-size: 13px;
z-index: 900000;
min-width: 135px;
/* tip */
/* positions */
/* list */
}
.acf-fc-popup:before {
border: solid;
border-color: transparent;
border-width: 6px;
content: "";
position: absolute;
}
.acf-fc-popup.-top {
margin-top: -8px;
}
.acf-fc-popup.-top:before {
top: 100%;
left: 50%;
margin-left: -6px;
border-top-color: #2F353E;
border-bottom-width: 0;
}
.acf-fc-popup.-bottom {
margin-bottom: -8px;
}
.acf-fc-popup.-bottom:before {
bottom: 100%;
left: 50%;
margin-left: -6px;
border-bottom-color: #2F353E;
border-top-width: 0;
}
.acf-fc-popup.-right:before {
left: 18px;
}
.acf-fc-popup.-left:before {
left: auto;
right: 18px;
}
.acf-fc-popup ul,
.acf-fc-popup li {
list-style: none;
display: block;
margin: 0;
padding: 0;
}
.acf-fc-popup li {
position: relative;
float: none;
white-space: nowrap;
}
.acf-fc-popup .badge {
display: inline-block;
border-radius: 8px;
font-size: 9px;
line-height: 15px;
padding: 0 7px;
background: #d54e21;
text-align: center;
color: #fff;
vertical-align: top;
margin: 0 0 0 5px;
}
.acf-fc-popup a {
color: #eee;
font-size: 13px;
line-height: 16px;
padding: 7px 12px;
display: block;
text-decoration: none;
position: relative;
}
.acf-fc-popup a:hover {
background: #0073aa;
color: #fff;
}
.acf-fc-popup a.disabled {
color: #888;
background: transparent;
}
.acf-fc-popup ul li a:hover .status {
border-color: #fff;
color: #fff;
}
/* rtl */
html[dir="rtl"] .acf-flexible-content .layout .acf-fc-layout-order {
float: right;
margin-right: 0;
margin-left: 5px;
}
html[dir="rtl"] .acf-flexible-content .layout .acf-fc-layout-controlls {
right: auto;
left: 9px;
}
/*---------------------------------------------------------------------------------------------
*
* Galery
*
*---------------------------------------------------------------------------------------------*/
.acf-gallery {
border: #DFDFDF solid 1px;
height: 400px;
position: relative;
/* main */
/* attachments */
/* attachment */
/* toolbar */
/* sidebar */
/* side info */
/* side data */
/* column widths */
/* resizable */
}
.acf-gallery .acf-gallery-main {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #fff;
z-index: 2;
}
.acf-gallery .acf-gallery-attachments {
position: absolute;
top: 0;
right: 0;
bottom: 48px;
left: 0;
padding: 5px;
overflow: auto;
overflow-x: hidden;
}
.acf-gallery .acf-gallery-attachment {
width: 25%;
float: left;
cursor: pointer;
position: relative;
/* hover */
/* sortable */
/* active */
/* icon */
/* rtl */
}
.acf-gallery .acf-gallery-attachment .margin {
margin: 5px;
border: #DFDFDF solid 1px;
position: relative;
overflow: hidden;
background: #eee;
}
.acf-gallery .acf-gallery-attachment .margin:before {
content: "";
display: block;
padding-top: 100%;
}
.acf-gallery .acf-gallery-attachment .thumbnail {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform: translate(50%, 50%);
}
html[dir="rtl"] .acf-gallery .acf-gallery-attachment .thumbnail {
transform: translate(-50%, 50%);
}
.acf-gallery .acf-gallery-attachment .thumbnail img {
display: block;
height: auto;
max-height: 100%;
width: auto;
transform: translate(-50%, -50%);
}
html[dir="rtl"] .acf-gallery .acf-gallery-attachment .thumbnail img {
transform: translate(50%, -50%);
}
.acf-gallery .acf-gallery-attachment .filename {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 5%;
background: #F4F4F4;
background: rgba(255, 255, 255, 0.8);
border-top: #DFDFDF solid 1px;
font-weight: bold;
text-align: center;
word-wrap: break-word;
max-height: 90%;
overflow: hidden;
}
.acf-gallery .acf-gallery-attachment .actions {
position: absolute;
top: 0;
right: 0;
display: none;
}
.acf-gallery .acf-gallery-attachment:hover .actions {
display: block;
}
.acf-gallery .acf-gallery-attachment.ui-sortable-helper .margin {
border: none;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.acf-gallery .acf-gallery-attachment.ui-sortable-placeholder .margin {
background: #F1F1F1;
border: none;
}
.acf-gallery .acf-gallery-attachment.ui-sortable-placeholder .margin * {
display: none !important;
}
.acf-gallery .acf-gallery-attachment.active .margin {
box-shadow: 0 0 0 1px #FFFFFF, 0 0 0 5px #1E8CBE;
}
.acf-gallery .acf-gallery-attachment.-icon .thumbnail img {
transform: translate(-50%, -70%);
}
html[dir="rtl"] .acf-gallery .acf-gallery-attachment {
float: right;
}
.acf-gallery.sidebar-open {
/* hide attachment actions when sidebar is open */
/* allow sidebar to move over main for small widths (widget edit box) */
}
.acf-gallery.sidebar-open .acf-gallery-attachment .actions {
display: none;
}
.acf-gallery.sidebar-open .acf-gallery-side {
z-index: 2;
}
.acf-gallery .acf-gallery-toolbar {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 10px;
border-top: #DFDFDF solid 1px;
background: #fff;
min-height: 28px;
}
.acf-gallery .acf-gallery-toolbar .acf-hl li {
line-height: 24px;
}
.acf-gallery .acf-gallery-toolbar .bulk-actions-select {
width: auto;
margin: 0 1px 0 0;
}
.acf-gallery .acf-gallery-side {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 0;
background: #F9F9F9;
border-left: #DFDFDF solid 1px;
z-index: 1;
overflow: hidden;
}
.acf-gallery .acf-gallery-side .acf-gallery-side-inner {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 349px;
}
.acf-gallery .acf-gallery-side-info {
position: relative;
width: 100%;
padding: 10px;
margin: -10px 0 15px -10px;
background: #F1F1F1;
border-bottom: #DFDFDF solid 1px;
}
.acf-gallery .acf-gallery-side-info:after {
clear: both;
content: "";
display: table;
}
html[dir="rtl"] .acf-gallery .acf-gallery-side-info {
margin-left: 0;
margin-right: -10px;
}
.acf-gallery .acf-gallery-side-info img {
float: left;
width: auto;
max-width: 65px;
max-height: 65px;
margin: 0 10px 1px 0;
background: #FFFFFF;
padding: 3px;
border: #DFDFDF solid 1px;
border-radius: 1px;
/* rtl */
}
html[dir="rtl"] .acf-gallery .acf-gallery-side-info img {
float: right;
margin: 0 0 0 10px;
}
.acf-gallery .acf-gallery-side-info p {
font-size: 13px;
line-height: 15px;
margin: 3px 0;
word-break: break-all;
color: #999999;
}
.acf-gallery .acf-gallery-side-info p strong {
color: #000;
}
.acf-gallery .acf-gallery-side-info a {
text-decoration: none;
}
.acf-gallery .acf-gallery-side-info a.acf-gallery-edit {
color: #21759b;
}
.acf-gallery .acf-gallery-side-info a.acf-gallery-remove {
color: #bc0b0b;
}
.acf-gallery .acf-gallery-side-info a:hover {
text-decoration: underline;
}
.acf-gallery .acf-gallery-side-data {
position: absolute;
top: 0;
right: 0;
bottom: 48px;
left: 0;
overflow: auto;
overflow-x: inherit;
padding: 10px;
}
.acf-gallery .acf-gallery-side-data .acf-label,
.acf-gallery .acf-gallery-side-data th.label {
color: #666666;
font-size: 12px;
line-height: 25px;
padding: 0 4px 8px 0 !important;
width: auto !important;
vertical-align: top;
}
html[dir="rtl"] .acf-gallery .acf-gallery-side-data .acf-label,
html[dir="rtl"] .acf-gallery .acf-gallery-side-data th.label {
padding: 0 0 8px 4px !important;
}
.acf-gallery .acf-gallery-side-data .acf-label label,
.acf-gallery .acf-gallery-side-data th.label label {
font-weight: normal;
}
.acf-gallery .acf-gallery-side-data .acf-input,
.acf-gallery .acf-gallery-side-data td.field {
padding: 0 0 8px !important;
}
.acf-gallery .acf-gallery-side-data textarea {
min-height: 0;
height: 60px;
}
.acf-gallery .acf-gallery-side-data p.help {
font-size: 12px;
}
.acf-gallery .acf-gallery-side-data p.help:hover {
font-weight: normal;
}
.acf-gallery[data-columns="1"] .acf-gallery-attachment {
width: 100%;
}
.acf-gallery[data-columns="2"] .acf-gallery-attachment {
width: 50%;
}
.acf-gallery[data-columns="3"] .acf-gallery-attachment {
width: 33.333%;
}
.acf-gallery[data-columns="4"] .acf-gallery-attachment {
width: 25%;
}
.acf-gallery[data-columns="5"] .acf-gallery-attachment {
width: 20%;
}
.acf-gallery[data-columns="6"] .acf-gallery-attachment {
width: 16.666%;
}
.acf-gallery[data-columns="7"] .acf-gallery-attachment {
width: 14.285%;
}
.acf-gallery[data-columns="8"] .acf-gallery-attachment {
width: 12.5%;
}
.acf-gallery .ui-resizable-handle {
display: block;
position: absolute;
}
.acf-gallery .ui-resizable-s {
bottom: -5px;
cursor: ns-resize;
height: 7px;
left: 0;
width: 100%;
}
/* media modal selected */
.acf-media-modal .attachment.acf-selected {
box-shadow: 0 0 0 3px #fff inset, 0 0 0 7px #0073aa inset !important;
}
.acf-media-modal .attachment.acf-selected .check {
display: none !important;
}
.acf-media-modal .attachment.acf-selected .thumbnail {
opacity: 0.25 !important;
}
.acf-media-modal .attachment.acf-selected .attachment-preview:before {
background: rgba(0, 0, 0, 0.15);
z-index: 1;
position: relative;
}

View File

@@ -0,0 +1,573 @@
(function($){
/*
* Repeater
*
* This field type requires some extra logic for its settings
*
* @type function
* @date 24/10/13
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
var acf_settings_repeater = acf.field_group.field_object.extend({
type: 'repeater',
actions: {
'render_settings': 'render'
},
events: {
'change .acf-field-setting-layout input': '_change_layout',
'focus .acf-field-setting-collapsed select': '_focus_collapsed'
},
focus: function(){
this.$fields = this.$field.find('.acf-field-list:first');
},
render: function(){
this.render_layout();
this.render_collapsed();
},
render_layout: function(){
// vars
var layout = this.setting('layout input:checked').val();
// update data
this.$fields.attr('data-layout', layout);
},
render_collapsed: function(){
// vars
var $select = this.setting('collapsed select');
// collapsed
var choices = [];
// keep 'null' choice
choices.push({
'label': $select.find('option[value=""]').text(),
'value': ''
});
// loop
this.$fields.children('.acf-field-object').each(function(){
// vars
var $field = $(this);
// append
choices.push({
'label': $field.find('.field-label:first').val(),
'value': $field.attr('data-key')
});
});
// render
acf.render_select( $select, choices );
},
_change_layout: function( e ){
this.render_layout();
},
_focus_collapsed: function( e ){
this.render_collapsed();
}
});
/*
* flexible_content
*
* description
*
* @type function
* @date 25/09/2015
* @since 5.2.3
*
* @param $post_id (int)
* @return $post_id (int)
*/
var acf_settings_flexible_content = acf.field_group.field_object.extend({
type: 'flexible_content',
actions: {
'render_settings': 'render'
},
render: function(){
// reference
var self = this,
$field = this.$field;
// sortable
if( ! this.$settings.hasClass('ui-sortable') ) {
// add sortable
this.$settings.sortable({
items: '> .acf-field-setting-fc_layout',
handle: '[data-name="acf-fc-reorder"]',
forceHelperSize: true,
forcePlaceholderSize: true,
scroll: true,
stop: function (event, ui) {
// save flexible content (layout order has changed)
acf.field_group.save_field( $field );
}
});
}
// render layouts
this.$settings.children('.acf-field-setting-fc_layout').each(function(){
self.layout.render( $(this) );
});
},
layout: null
});
acf_settings_flexible_content.layout = acf.model.extend({
actions: {
'update_field_parent': 'update_field_parent'
},
events: {
'change .acf-fc-meta-display select': '_change_display',
'blur .acf-fc-meta-label input': '_blur_label',
'click a[data-name="acf-fc-add"]': '_add',
'click a[data-name="acf-fc-duplicate"]': '_duplicate',
'click a[data-name="acf-fc-delete"]': '_delete'
},
event: function( e ){
return e.$el.closest('.acf-field-setting-fc_layout');
},
update_meta: function( $field, $layout ){
acf.field_group.update_field_meta( $field, 'parent_layout', $layout.attr('data-id') );
},
delete_meta: function( $field ){
acf.field_group.delete_field_meta( $field, 'parent_layout' );
},
/*
* update_field_parent
*
* this function will update a sub field's 'parent_layout' meta data
*
* @type function
* @date 16/11/16
* @since 5.5.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
update_field_parent: function( $el, $parent ){
// vars
var $layout = $el.closest('.acf-field-setting-fc_layout');
// bail early if not a sub field of a flexible content field
// - don't save field as lack of 'parent' will avoid any issues with field's 'parent_layout' setting
if( !$layout.exists() ) {
return this.delete_meta( $el );
}
// update meta
this.update_meta( $el, $layout );
// save field
// - parent_layout meta needs to be saved within the post_content serialized array
acf.field_group.save_field( $el );
},
/*
* render
*
* This function will update the field list class
*
* @type function
* @date 8/04/2014
* @since 5.0.0
*
* @param $field_list
* @return n/a
*/
render: function( $el ){
// reference
var self = this;
// vars
var $key = $el.find('.acf-fc-meta-key:first input'),
$fields = $el.find('.acf-field-list:first'),
display = $el.find('.acf-fc-meta-display:first select').val();
// update key
// - both duplicate and add function need this
$key.val( $el.attr('data-id') );
// update data
$fields.attr('data-layout', display);
// update meta
$fields.children('.acf-field-object').each(function(){
self.update_meta( $(this), $el );
});
},
/*
* events
*
* description
*
* @type function
* @date 25/09/2015
* @since 5.2.3
*
* @param $post_id (int)
* @return $post_id (int)
*/
_change_display: function( $el ){
this.render( $el );
},
_blur_label: function( $el ){
// vars
var $label = $el.find('.acf-fc-meta-label:first input'),
$name = $el.find('.acf-fc-meta-name:first input');
// only if name is empty
if( $name.val() == '' ) {
// vars
var s = $label.val();
// sanitize
s = acf.str_sanitize(s);
// update name
$name.val( s ).trigger('change');
}
},
_add: function( $el ){
// duplicate
var $el2 = acf.duplicate({
$el: $el,
after: function( $el, $el2 ){
// remove sub fields
$el2.find('.acf-field-object').remove();
// show add new message
$el2.find('.no-fields-message').show();
// reset layout meta values
$el2.find('.acf-fc-meta input').val('');
}
});
// render layout
this.render( $el2 );
// save field
acf.field_group.save_field( $el.closest('.acf-field-object') );
},
_duplicate: function( $el ){
// duplicate
$el2 = acf.duplicate( $el );
// fire action 'duplicate_field' and allow acf.pro logic to clean sub fields
acf.do_action('duplicate_field', $el2);
// render layout
this.render( $el2 );
// save field
acf.field_group.save_field( $el.closest('.acf-field-object') );
},
_delete: function( $el ){
// validate
if( $el.siblings('.acf-field-setting-fc_layout').length == 0 ) {
alert( acf._e('flexible_content','layout_warning') );
return false;
}
// delete fields
$el.find('.acf-field-object').each(function(){
// delete without animation
acf.field_group.delete_field( $(this), false );
});
// remove tr
acf.remove_tr( $el );
// save field
acf.field_group.save_field( $el.closest('.acf-field-object') );
}
});
/*
* clone
*
* This field type requires some extra logic for its settings
*
* @type function
* @date 24/10/13
* @since 5.0.0
*
* @param n/a
* @return n/a
*/
var acf_settings_clone = acf.field_group.field_object.extend({
type: 'clone',
actions: {
'render_settings': 'render'
},
events: {
'change .acf-field-setting-display select': 'render_display',
'change .acf-field-setting-prefix_label input': 'render_prefix_label',
'change .acf-field-setting-prefix_name input': 'render_prefix_name'
},
render: function(){
// render
this.render_display();
this.render_prefix_label();
this.render_prefix_name();
},
render_display: function(){
// vars
var display = this.setting('display select').val()
// update data
this.$field.attr('data-display', display);
},
render_prefix_label: function(){
// vars
var s = '%field_label%';
// is checked
if( this.setting('prefix_label input[type="checkbox"]').prop('checked') ) {
s = this.setting('label input[type="text"]').val() + ' ' + s;
}
// update code
this.setting('prefix_label code').html( s );
},
render_prefix_name: function(){
// vars
var s = '%field_name%';
// is checked
if( this.setting('prefix_name input[type="checkbox"]').prop('checked') ) {
s = this.setting('name input[type="text"]').val() + '_' + s;
}
// update code
this.setting('prefix_name code').html( s );
},
select2: null
});
acf_settings_clone.select2 = acf.model.extend({
filters: {
'select2_args': 'select2_args',
'select2_ajax_data': 'select2_ajax_data'
},
select2_args: function( select2_args, $select, args ){
// bail early if not clone
if( args.ajax_action !== 'acf/fields/clone/query' ) return select2_args;
// remain open on select
select2_args.closeOnSelect = false;
// return
return select2_args;
},
select2_ajax_data: function( data, args, params ){
// bail early if not clone
if( args.ajax_action !== 'acf/fields/clone/query' ) return data;
// find current fields
var fields = {};
// loop
$('.acf-field-object').each(function(){
// vars
var $el = $(this),
key = $el.data('key'),
type = $el.data('type'),
label = $el.find('.field-label:first').val(),
$ancestors = $el.parents('.acf-field-object');
// label
fields[ key ] = {
'key': key,
'type': type,
'label': label,
'ancestors': $ancestors.length
};
});
// append fields
data.fields = fields;
// append title
data.title = $('#title').val();
// return
return data;
}
});
})(jQuery);
// @codekit-prepend "../js/field-group.js";

View File

@@ -0,0 +1 @@
!function($){var e=acf.field_group.field_object.extend({type:"repeater",actions:{render_settings:"render"},events:{"change .acf-field-setting-layout input":"_change_layout","focus .acf-field-setting-collapsed select":"_focus_collapsed"},focus:function(){this.$fields=this.$field.find(".acf-field-list:first")},render:function(){this.render_layout(),this.render_collapsed()},render_layout:function(){var e=this.setting("layout input:checked").val();this.$fields.attr("data-layout",e)},render_collapsed:function(){var e=this.setting("collapsed select"),t=[];t.push({label:e.find('option[value=""]').text(),value:""}),this.$fields.children(".acf-field-object").each(function(){var e=$(this);t.push({label:e.find(".field-label:first").val(),value:e.attr("data-key")})}),acf.render_select(e,t)},_change_layout:function(e){this.render_layout()},_focus_collapsed:function(e){this.render_collapsed()}});acf.field_group.field_object.extend({type:"flexible_content",actions:{render_settings:"render"},render:function(){var e=this,t=this.$field;this.$settings.hasClass("ui-sortable")||this.$settings.sortable({items:"> .acf-field-setting-fc_layout",handle:'[data-name="acf-fc-reorder"]',forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,stop:function(e,a){acf.field_group.save_field(t)}}),this.$settings.children(".acf-field-setting-fc_layout").each(function(){e.layout.render($(this))})},layout:null}).layout=acf.model.extend({actions:{update_field_parent:"update_field_parent"},events:{"change .acf-fc-meta-display select":"_change_display","blur .acf-fc-meta-label input":"_blur_label",'click a[data-name="acf-fc-add"]':"_add",'click a[data-name="acf-fc-duplicate"]':"_duplicate",'click a[data-name="acf-fc-delete"]':"_delete"},event:function(e){return e.$el.closest(".acf-field-setting-fc_layout")},update_meta:function(e,t){acf.field_group.update_field_meta(e,"parent_layout",t.attr("data-id"))},delete_meta:function(e){acf.field_group.delete_field_meta(e,"parent_layout")},update_field_parent:function(e,t){var a=e.closest(".acf-field-setting-fc_layout");if(!a.exists())return this.delete_meta(e);this.update_meta(e,a),acf.field_group.save_field(e)},render:function(e){var t=this,a=e.find(".acf-fc-meta-key:first input"),i=e.find(".acf-field-list:first"),l=e.find(".acf-fc-meta-display:first select").val();a.val(e.attr("data-id")),i.attr("data-layout",l),i.children(".acf-field-object").each(function(){t.update_meta($(this),e)})},_change_display:function(e){this.render(e)},_blur_label:function(e){var t=e.find(".acf-fc-meta-label:first input"),a=e.find(".acf-fc-meta-name:first input");if(""==a.val()){var i=t.val();i=acf.str_sanitize(i),a.val(i).trigger("change")}},_add:function(e){var t=acf.duplicate({$el:e,after:function(e,t){t.find(".acf-field-object").remove(),t.find(".no-fields-message").show(),t.find(".acf-fc-meta input").val("")}});this.render(t),acf.field_group.save_field(e.closest(".acf-field-object"))},_duplicate:function(e){$el2=acf.duplicate(e),acf.do_action("duplicate_field",$el2),this.render($el2),acf.field_group.save_field(e.closest(".acf-field-object"))},_delete:function(e){if(0==e.siblings(".acf-field-setting-fc_layout").length)return alert(acf._e("flexible_content","layout_warning")),!1;e.find(".acf-field-object").each(function(){acf.field_group.delete_field($(this),!1)}),acf.remove_tr(e),acf.field_group.save_field(e.closest(".acf-field-object"))}}),acf.field_group.field_object.extend({type:"clone",actions:{render_settings:"render"},events:{"change .acf-field-setting-display select":"render_display","change .acf-field-setting-prefix_label input":"render_prefix_label","change .acf-field-setting-prefix_name input":"render_prefix_name"},render:function(){this.render_display(),this.render_prefix_label(),this.render_prefix_name()},render_display:function(){var e=this.setting("display select").val();this.$field.attr("data-display",e)},render_prefix_label:function(){var e="%field_label%";this.setting('prefix_label input[type="checkbox"]').prop("checked")&&(e=this.setting('label input[type="text"]').val()+" "+e),this.setting("prefix_label code").html(e)},render_prefix_name:function(){var e="%field_name%";this.setting('prefix_name input[type="checkbox"]').prop("checked")&&(e=this.setting('name input[type="text"]').val()+"_"+e),this.setting("prefix_name code").html(e)},select2:null}).select2=acf.model.extend({filters:{select2_args:"select2_args",select2_ajax_data:"select2_ajax_data"},select2_args:function(e,t,a){return"acf/fields/clone/query"!==a.ajax_action?e:(e.closeOnSelect=!1,e)},select2_ajax_data:function(e,t,a){if("acf/fields/clone/query"!==t.ajax_action)return e;var i={};return $(".acf-field-object").each(function(){var e=$(this),t=e.data("key"),a=e.data("type"),l=e.find(".field-label:first").val(),n=e.parents(".acf-field-object");i[t]={key:t,type:a,label:l,ancestors:n.length}}),e.fields=i,e.title=$("#title").val(),e}})}(jQuery);

File diff suppressed because one or more lines are too long