Commit 4c5e6047 authored by Eric Windham's avatar Eric Windham

fixing conflicts from merge

parents ea5f9d6f 8a36db62
......@@ -3,6 +3,34 @@
margin: 0;
}
.nf-loading-spinner {
width: 40px;
height: 40px;
margin: 15px auto;
background-color: rgba(208,208,208,.5);
border-radius: 100%;
animation: nf-scaleout 1.0s infinite ease-in-out;
}
@-webkit-keyframes nf-scaleout {
0% { transform: scale(0) }
100% {
transform: scale(1.0);
opacity: 0;
}
}
@keyframes nf-scaleout {
0% {
transform: scale(0);
} 100% {
transform: scale(1.0);
opacity: 0;
}
}
.ninja-forms-settings .postbox .item-controls {
display: none;
}
......
/**
* Handles actions related to number field settings.
*
* @package Ninja Forms builder
* @subpackage Fields - Edit Field Drawer
* @copyright (c) 2015 WP Ninjas
* @since 3.0
*/
define( [], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
// Respond to requests for field setting filtering.
nfRadio.channel( 'number' ).reply( 'before:updateSetting', this.updateSetting, this );
},
/**
* Resets value if user enters value below min value or above max value
*
* @since 3.0
* @param Object e event
* @param backbone.model fieldModel field model
* @param string name setting name
* @param backbone.model settingTypeModel field type model
* @return int 1 or 0
*/
updateSetting: function( e, fieldModel, name, settingTypeModel ) {
var minVal = parseInt( settingTypeModel.get( 'min_val' ) );
var maxVal = parseInt( settingTypeModel.get( 'max_val' ) );
e.target.value = parseInt( e.target.value );
/*
* if we gave a min value set, revert to that if the user enters
* a lower number
*/
if( 'undefined' != typeof minVal && null !== minVal ){
if ( e.target.value < minVal ) {
fieldModel.set('value', minVal);
e.target.value = minVal;
}
}
/*
* if we gave a max value set, revert to that if the user enters
* a higher number
*/
if( 'undefined' != typeof maxVal && null !== maxVal ){
if ( e.target.value > maxVal ) {
fieldModel.set('value', maxVal);
e.target.value = maxVal;
}
}
return e.target.value;
}
});
return controller;
} );
\ No newline at end of file
......@@ -35,6 +35,7 @@ define(
'controllers/app/fieldset',
'controllers/app/toggleSetting',
'controllers/app/buttonToggleSetting',
'controllers/app/numberSetting',
'controllers/app/radioSetting',
'controllers/app/itemControls',
'controllers/app/mergeTags',
......@@ -141,6 +142,7 @@ define(
Fieldset,
ToggleSetting,
ButtonToggleSetting,
NumberSetting,
RadioSetting,
ItemControls,
MergeTags,
......@@ -278,6 +280,7 @@ define(
new ChangeSettingDefault();
new ToggleSetting();
new ButtonToggleSetting();
new NumberSetting();
new RadioSetting();
new DrawerSettingChildView();
new FieldsEditActive();
......
......@@ -361,7 +361,64 @@ define( ['views/app/drawer/mergeTagsContent', 'views/app/drawer/settingError'],
} else {
return '';
}
}
},
/**
* Renders min and/or max attributes for the number input
*
* @returns {string}
*/
renderMinMax: function() {
var minMaxStr = '';
// if we have a min value set, then output it
if( 'undefined' != typeof this.min_val && null != this.min_val && jQuery.isNumeric( this.min_val ) ) {
minMaxStr = minMaxStr + "min='" + this.min_val + "'";
}
// if we have a max value set, then output it
if( 'undefined' != typeof this.max_val && '' != this.max_val && jQuery.isNumeric( this.max_val ) ) {
minMaxStr = minMaxStr + " max='" + this.max_val + "'";
}
return minMaxStr;
},
/**
* Returns a string to let the user know the min and/or max
* value for the field
*
* @returns {string}
*/
renderMinMaxHelper: function() {
var minMaxHelperStr = '';
// if we have a min value output it to the helper text
if( 'undefined' != typeof this.min_val && null != this.min_val && jQuery.isNumeric( this.min_val ) ) {
// empty string? then add '('
if( 0 == minMaxHelperStr.length ) {
minMaxHelperStr = "(";
}
minMaxHelperStr = minMaxHelperStr + nfi18n.minVal + ": " + this.min_val;
}
// if we have a max value output it to the helper text
if( 'undefined' != typeof this.max_val && '' != this.max_val && jQuery.isNumeric( this.max_val ) ) {
// empty string? then add '('
if( 0 == minMaxHelperStr.length ) {
minMaxHelperStr = "(";
} else {
// else, we know we have a min so add a comma
minMaxHelperStr = minMaxHelperStr + ", ";
}
minMaxHelperStr = minMaxHelperStr + nfi18n.maxVal + ": " + this.max_val;
}
// if not an empty string, then add ')'
if( 0 < minMaxHelperStr.length ) {
minMaxHelperStr = minMaxHelperStr + ")";
}
return minMaxHelperStr;
}
}
},
......
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.
......@@ -151,9 +151,7 @@ final class NF_Admin_Menus_Settings extends NF_Abstracts_Submenu
}
wp_enqueue_script( 'jBox', Ninja_Forms::$url . 'assets/js/lib/jBox.min.js', array( 'jquery' ) );
wp_enqueue_style( 'nf-dashboard', Ninja_Forms::$url . 'assets/css/dashboard.min.css' );
wp_enqueue_style( 'nf-combobox', Ninja_Forms::$url . 'assets/css/combobox.css' );
wp_enqueue_style( 'nf-combobox', Ninja_Forms::$url . 'assets/css/combobox.css' );
wp_enqueue_style( 'jBox', Ninja_Forms::$url . 'assets/css/jBox.css' );
wp_register_script( 'ninja_forms_admin_menu_settings', Ninja_Forms::$url . 'assets/js/admin-settings.js', array( 'jquery' ), FALSE, TRUE );
wp_localize_script( 'ninja_forms_admin_menu_settings', 'nf_settings', array(
......
......@@ -74,6 +74,8 @@ return apply_filters( 'ninja_forms_action_email_settings', array(
'group' => 'advanced',
'label' => __( 'How long in days until subs expire?', 'ninja-forms' ),
'value' => '90',
'min_val' => 1, // new minimum value setting
'max_val' => null, // new maximum value setting
'width' => 'one-half',
'deps' => array(
'set_subs_to_expire' => 1
......
......@@ -74,6 +74,8 @@ return apply_filters( 'ninja_forms_i18n_builder', array(
'fieldDataDeleteMsg' => sprintf( __( '%sThis will also DELETE all submission data associated with this field.%sYou will not be able to retrieve this data later!%s' ), '<p>', '</p><p>', '</p><br />' ),
'delete' => __( 'Delete' ),
'cancel' => __( 'Cancel' ),
'minVal' => __( 'Min Value' ),
'maxVal' => __( 'Max Value' ),
'valueChars' => __( 'In order to prevent errors, values may only contain'
. ' a specific subset of characters ( a-z, 0-9, -, _, @, space ). You'
. ' can use the option label in your success message(s) or email action(s) by adding'
......
......@@ -468,7 +468,10 @@ Label Three, value-three, 3
<script id="tmpl-nf-edit-setting-number" type="text/template">
<label for="{{{ data.name }}}">{{{ data.label }}} {{{ data.renderTooltip() }}}
<input type="number" class="setting" id="{{{ data.name }}}" value="{{{ data.value }}}" placeholder="{{{ ( 'undefined' != typeof data.placeholder ) ? data.placeholder : '' }}}" />
<input type="number" class="setting" id="{{{ data.name }}}"
value="{{{ data.value }}}" {{{ data.renderMinMax() }}}
placeholder="{{{ ('undefined' != typeof data.placeholder ) ? data.placeholder : '' }}}" />
<em>{{{ data.renderMinMaxHelper() }}}</em>
</label>
</script>
......
......@@ -10,7 +10,7 @@
$wrapper_class = ( ! empty( $form_wrap ) ) ? ' ' . Ninja_Forms()->form( $form_id )->get()->get_setting( 'wrapper_class' ) : '';
?>
<div id="nf-form-<?php echo intval( $form_id ); ?>-cont" class="nf-form-cont<?php echo esc_attr( $wrapper_class ); ?>" aria-live="polite" aria-labelledby="nf-form-title-<?php echo intval( $form_id ) ?>" aria-describedby="nf-form-errors-<?php echo intval( $form_id ); ?>" role="form">
<div id="nf-form-<?php echo $form_id; ?>-cont" class="nf-form-cont<?php echo esc_attr( $wrapper_class ); ?>" aria-live="polite" aria-labelledby="nf-form-title-<?php echo $form_id ?>" aria-describedby="nf-form-errors-<?php echo $form_id; ?>" role="form">
<div class="nf-loading-spinner"></div>
......
......@@ -67,7 +67,7 @@ Want access to everything we offer, or perhaps just our form building toolkit "B
= For Developers =
The Ninja Forms framework is on [GitHub](https://github.com/wpninjas/ninja-forms)! If you're a developer and want to help make Ninja Forms better, check it out. It's also a great resource for developers who are interested in creating add-ons for our online store.
The Ninja Forms framework is on [GitLab](https://git.saturdaydrive.io/ninja-forms/ninja-forms)! If you're a developer and want to help make Ninja Forms better, check it out. It's also a great resource for developers who are interested in creating add-ons for our online store.
If you're a developer and would like to talk about creating some premium extensions for Ninja Forms, send us an email: info@wpninjas.com.
......@@ -93,7 +93,7 @@ Documentation for Ninja Forms can be found at <a href="https://ninjaforms.com/do
= Where can I report a bug? =
Report bugs, suggest ideas, and participate in development at <a href="https://github.com/wpninjas/ninja-forms">https://github.com/wpninjas/ninja-forms</a>.
Report bugs, suggest ideas, and participate in development at <a href="https://git.saturdaydrive.io/ninja-forms/ninja-forms">https://git.saturdaydrive.io/ninja-forms/ninja-forms</a>.
== Installation ==
......
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