Skip to content

Commit

Permalink
Merge pull request #3216 from CalderaWP/feature/3204-2
Browse files Browse the repository at this point in the history
Refactor main admin: phase 1 #3204 #2445 #3213
  • Loading branch information
Josh Pollock authored May 29, 2019
2 parents 0dd8ffa + 2a798d9 commit 43da650
Show file tree
Hide file tree
Showing 1,860 changed files with 377,852 additions and 5,010 deletions.
3 changes: 1 addition & 2 deletions assets/build/css/caldera-forms-front.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/build/js/admin.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion assets/build/js/caldera-clippy.min.js

This file was deleted.

4 changes: 2 additions & 2 deletions assets/build/js/caldera-forms-front.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/build/js/frontend-script-init.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/build/js/state/state.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 61 additions & 2 deletions assets/css/caldera-forms-front.css

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,6 @@ jQuery(document).ready(function($){
});


//setup clippy on admin, not edit
var CFclippy;
if( undefined != typeof CF_CLIPPY && 'object' == typeof CF_CLIPPY ){
CFclippy = new CalderaFormsAdminClippys2( 'caldera-forms-clippy', CF_CLIPPY, $ );
CFclippy.init();
}

$( '.cf-entry-viewer-link' ).on( 'click', function(){
if ( 'object' == typeof CFclippy ){
CFclippy.remove();
}
});


/**
* Delete all entries saved in a form form Settings tab in the form
*
Expand Down
103 changes: 0 additions & 103 deletions assets/js/caldera-clippy.js

This file was deleted.

107 changes: 56 additions & 51 deletions assets/js/caldera-forms-front.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! GENERATED SOURCE FILE caldera-forms - v1.8.5-b.1 - 2019-04-19 */var resBaldrickTriggers;
/*! GENERATED SOURCE FILE caldera-forms - v1.8.4 - 2019-05-28 */var resBaldrickTriggers;

jQuery(function($){
function fieldErrors(fields, $form, $notice) {
Expand Down Expand Up @@ -957,7 +957,7 @@ function CFState(formId, $ ){
}

if (calcVals.hasOwnProperty(id) ) {
if( false === calcVals[id] || null === calcVals[id] ){
if( false === calcVals[id] || null === calcVals[id] || 0 === calcVals[id] ){
//@TODO use let here, when ES6.
var _val = findCalcVal( $( document.getElementById( id ) ) );
if( isString( _val ) ) {
Expand Down Expand Up @@ -7576,6 +7576,8 @@ var cf_jsfields_init, cf_presubmit;
window.addEventListener("load", function(){
(function( $ ) {
'use strict';
//Catch if window.wp is undefined
var wpUndefined = undefined === typeof window.wp;

window.CALDERA_FORMS = {};

Expand All @@ -7593,55 +7595,58 @@ window.addEventListener("load", function(){
if ('object' === typeof CFFIELD_CONFIG[instance] ) {
$form = $( document.getElementById( form_id ));

if ( ! protocolChecked ) {
//check for protocol mis-match on submit url
protocolCheck = new CalderaFormsCrossOriginWarning($el, $, CFFIELD_CONFIG[instance].error_strings);
protocolCheck.maybeWarn();

//don't check twice
protocolChecked = true;
}

if ( ! jQueryChecked && CFFIELD_CONFIG[instance].error_strings.hasOwnProperty( 'jquery_old' ) ) {
//check for old jQuery
jQueryCheck = new CalderaFormsJQueryWarning($el, $, CFFIELD_CONFIG[instance].error_strings);
jQueryCheck.maybeWarn();

//don't check twice
jQueryChecked = true;
}

formId = $el.data( 'form-id' );
config = CFFIELD_CONFIG[instance].configs;

var state = new CFState(formId, $ );
state.init( CFFIELD_CONFIG[instance].fields.defaults,CFFIELD_CONFIG[instance].fields.calcDefaults );

if( 'object' !== typeof window.cfstate ){
window.cfstate = {};
}

window.cfstate[ form_id ] = state;

$form.find( '[data-sync]' ).each( function(){
var $field = $( this );
if ( ! $field.data( 'unsync' ) ) {
new CalderaFormsFieldSync($field, $field.data('binds'), $form, $, state);
}
});


config_object = new Caldera_Forms_Field_Config( config, $(document.getElementById(form_id)), $, state );
config_object.init();
$( document ).trigger( 'cf.form.init',{
$form: $form,
idAttr: form_id,
formId: formId,
state: state,
fieldIds: CFFIELD_CONFIG[instance].fields.hasOwnProperty( 'ids' ) ? CFFIELD_CONFIG[instance].fields.ids : [],
nonce: jQuery( '#_cf_verify_' + formId ).val()
});

if( wpUndefined ){
$( $form.data( 'target' ) ).append( '<div class="alert alert-warning">' + CFFIELD_CONFIG[instance].error_strings.wp_not_defined + '</div>' );
}else{
if ( ! protocolChecked ) {
//check for protocol mis-match on submit url
protocolCheck = new CalderaFormsCrossOriginWarning($el, $, CFFIELD_CONFIG[instance].error_strings);
protocolCheck.maybeWarn();

//don't check twice
protocolChecked = true;
}

if ( ! jQueryChecked && CFFIELD_CONFIG[instance].error_strings.hasOwnProperty( 'jquery_old' ) ) {
//check for old jQuery
jQueryCheck = new CalderaFormsJQueryWarning($el, $, CFFIELD_CONFIG[instance].error_strings);
jQueryCheck.maybeWarn();

//don't check twice
jQueryChecked = true;
}

formId = $el.data( 'form-id' );
config = CFFIELD_CONFIG[instance].configs;

var state = new CFState(formId, $ );
state.init( CFFIELD_CONFIG[instance].fields.defaults,CFFIELD_CONFIG[instance].fields.calcDefaults );

if( 'object' !== typeof window.cfstate ){
window.cfstate = {};
}

window.cfstate[ form_id ] = state;

$form.find( '[data-sync]' ).each( function(){
var $field = $( this );
if ( ! $field.data( 'unsync' ) ) {
new CalderaFormsFieldSync($field, $field.data('binds'), $form, $, state);
}
});


config_object = new Caldera_Forms_Field_Config( config, $(document.getElementById(form_id)), $, state );
config_object.init();
$( document ).trigger( 'cf.form.init',{
$form: $form,
idAttr: form_id,
formId: formId,
state: state,
fieldIds: CFFIELD_CONFIG[instance].fields.hasOwnProperty( 'ids' ) ? CFFIELD_CONFIG[instance].fields.ids : [],
nonce: jQuery( '#_cf_verify_' + formId ).val()
});
}

}
});
Expand Down
2 changes: 1 addition & 1 deletion assets/js/entry-viewer-2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! GENERATED SOURCE FILE caldera-forms - v1.8.5-b.1 - 2019-04-19 *//**
/*! GENERATED SOURCE FILE caldera-forms - v1.8.4 - 2019-05-28 *//**
* API Client for Caldera Forms API for a single form
*
* @since 1.5.0
Expand Down
2 changes: 1 addition & 1 deletion assets/js/parsley.min.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! GENERATED SOURCE FILE caldera-forms - v1.8.5-b.1 - 2019-04-19 *//*!
/*! GENERATED SOURCE FILE caldera-forms - v1.8.4 - 2019-05-28 *//*!
* Parsley.js
* Version 2.8.1 - built Sat, Feb 3rd 2018, 2:27 pm
* http://parsleyjs.org
Expand Down
2 changes: 1 addition & 1 deletion assets/js/vue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! GENERATED SOURCE FILE caldera-forms - v1.8.5-b.1 - 2019-04-19 *//*!
/*! GENERATED SOURCE FILE caldera-forms - v1.8.4 - 2019-05-28 *//*!
* Vue.js v2.1.6
* (c) 2014-2016 Evan You
* Released under the MIT License.
Expand Down
8 changes: 8 additions & 0 deletions caldera-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
die;
}

add_action( 'init', function(){
//hack to make code splitting work.
if( false !== strpos( $_SERVER['REQUEST_URI'], 'wp-admin/clients/') ){
cf_redirect(plugin_dir_url(__FILE__).str_replace( '/wp-admin/', '',$_SERVER['REQUEST_URI']));exit;
}

});

global $wp_version;
if ( !version_compare(PHP_VERSION, '5.6.0', '>=') ) {
function caldera_forms_php_version_nag()
Expand Down
8 changes: 1 addition & 7 deletions classes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1220,15 +1220,9 @@ public function enqueue_admin_stylescripts() {
do_action( 'caldera_forms_admin_enqueue_form_editor' );

} else {

Caldera_Forms_Render_Assets::enqueue_all_fields();


if ( ! empty( $_GET[ 'edit-entry' ] ) ) {
Caldera_Forms_Render_Assets::enqueue_style( 'grid' );
}else{
$clippy = new Caldera_Forms_Admin_Clippy( $this->plugin_slug, site_url() );
$clippy->assets();
Caldera_Forms_Render_Assets::enqueue_style('grid');
}
}

Expand Down
Loading

0 comments on commit 43da650

Please sign in to comment.