Commit 2420426b authored by Eric Windham's avatar Eric Windham Committed by GitHub

Merge pull request #3582 from wpninjas/remove-nonsaving-fields

Remove nonsaving fields
parents df43bd53 8edc8387
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
......@@ -159,6 +159,55 @@ define( ['views/app/drawer/optionRepeaterError'], function( ErrorView ) {
// The template requires a string.
return label.innerHTML;
},
renderNonSaveFieldSelect: function( dataID, value ){
var initialOption, select, emptyContainer, label;
var fields = nfRadio.channel( 'fields' ).request( 'get:collection' );
initialOption = document.createElement( 'option' );
initialOption.value = '';
initialOption.label = '--';
initialOption.innerHTML = '--';
select = document.createElement( 'select' );
select.classList.add( 'setting' );
select.setAttribute( 'data-id', dataID );
select.appendChild( initialOption );
// Build a lookup table for fields we want to remove from our fields list.
var removeFieldsLookup = [ 'html', 'submit', 'hr',
'recaptcha', 'spam', 'creditcard', 'creditcardcvc',
'creditcardexpiration', 'creditcardfullname',
'creditcardnumber', 'creditcardzip' ];
fields.each( function( field ){
// Check for the field type in our lookup array and...
if( jQuery.inArray( field.get( 'type' ), removeFieldsLookup ) !== -1 ) {
// Return if the type is in our lookup array.
return '';
}
var option = document.createElement( 'option' );
if ( value == field.get( 'key' ) ) {
option.setAttribute( 'selected', 'selected' );
}
option.value = field.get( 'key' );
option.innerHTML = field.get( 'label' );
option.label = field.get( 'label' );
select.appendChild( option );
});
label = document.createElement( 'label' );
label.classList.add( 'nf-select' );
label.appendChild( select );
// Select Lists need an empty '<div></div>' for styling purposes.
emptyContainer = document.createElement( 'div' );
label.appendChild( emptyContainer );
// The template requires a string.
return label.innerHTML;
},
renderOptions: function( column, value ) {
if( 'undefined' == typeof that.options.columns[ column ] ) return;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -79,8 +79,7 @@ final class NF_Actions_Save extends NF_Abstracts_Action
if( 'save_all' == $save_all_none ) {
$save_field = true;
// For each exception to that rule...
foreach( $action_settings[ 'exception_fields' ] as
$exception_field ) {
foreach( $action_settings[ 'exception_fields' ] as $exception_field ) {
// Remove it from the list.
if( $field[ 'key' ] == $exception_field[ 'field'] ) {
$save_field = false;
......
......@@ -739,7 +739,7 @@ Label Three, value-three, 3
</div>
<div>
<# try { #>
{{{ data.renderFieldSelect( 'field', data.field ) }}}
{{{ data.renderNonSaveFieldSelect( 'field', data.field ) }}}
<# } catch ( err ) { #>
<input type="text" class="setting" value="{{ data.field }}" data-id="field" >
<# } #>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment