Commit 55337b75 authored by KR Moorhouse's avatar KR Moorhouse

Resolved merge conflicts.

parents bc4c4189 8bec0dd7
This diff is collapsed.
......@@ -4,7 +4,7 @@
Tags: form, forms, contact form, custom form, form builder, form creator, form manager, form creation, contact forms, custom forms, forms builder, forms creator, forms manager, forms creation, form administration,
Requires at least: 4.7
Tested up to: 4.9
Stable tag: 3.2.24
Stable tag: 3.3.1
License: GPLv2 or later
With a simple drag and drop interface you can create contact forms, email subscription forms, order forms, payment forms, and any other type of form for your WordPress site.
......
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.
......@@ -178,4 +178,43 @@ jQuery(document).ready(function($) {
$( "#delete_on_uninstall" ).attr( 'checked', true );
} );
// If we're allowed to track site data...
if ( '1' == nf_settings.allow_telemetry ) {
// Show the optout button.
$( '#nfTelOptin' ).addClass( 'hidden' );
$( '#nfTelOptout' ).removeClass( 'hidden' );
} // Otherwise...
else {
// Show the optin button.
$( '#nfTelOptout' ).addClass( 'hidden' );
$( '#nfTelOptin' ).removeClass( 'hidden' );
}
// If optin is clicked...
$( '#nfTelOptin' ).click( function( e ) {
// Hide the button.
$( '#nfTelOptin' ).addClass( 'hidden' );
$( '#nfTelSpinner' ).css( 'display', 'inline-block' );
// Hit AJAX endpoint and opt-in.
$.post( ajaxurl, { action: 'nf_optin', ninja_forms_opt_in: 1 },
function( response ) {
$( '#nfTelOptout' ).removeClass( 'hidden' );
$( '#nfTelSpinner' ).css( 'display', 'none' );
} );
} );
// If optout is clicked...
$( '#nfTelOptout' ).click( function( e ) {
// Hide the button.
$( '#nfTelOptout' ).addClass( 'hidden' );
$( '#nfTelSpinner' ).css( 'display', 'inline-block' );
// Hit AJAX endpoint and opt-out.
$.post( ajaxurl, { action: 'nf_optin', ninja_forms_opt_in: 0 },
function( response ) {
$( '#nfTelOptin' ).removeClass( 'hidden' );
$( '#nfTelSpinner' ).css( 'display', 'none' );
} );
} );
});
......@@ -37,7 +37,7 @@ define( [], function( settingCollection ) {
/*
* We have changed a calculation. Make sure that 'calc' is our payment total type.
*/
if ( 'calculation' != this.get( 'payment_total_type' ) ) {
if ( 'calc' != this.get( 'payment_total_type' ) ) {
return
}
......
/**
* Handles actions related to our toggle field.
* When we change the toggle, the setting value will be 'on' or ''.
* We need to change this to 1 or 0.
*
* @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() {
// We don't want the RTE setting to re-render when the value changes.
nfRadio.channel( 'setting-type-button-toggle' ).reply( 'renderOnChange', function(){ return false; } );
// Respond to requests for field setting filtering.
nfRadio.channel( 'button-toggle' ).reply( 'before:updateSetting', this.updateSetting, this );
},
/**
* Return either 1 or 0, depending upon the toggle position.
*
* @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 ) {
return e.target.value;
}
});
return controller;
} );
\ No newline at end of file
define( [], function() {
var controller = Marionette.Object.extend({
initialize: function () {
// Respond to requests for field setting filtering.
console.log( nfRadio.channel( 'radio' ) );
nfRadio.channel('radio').reply( 'before:updateSetting', this.updateSetting, this);
},
updateSetting: function( e, fieldModel, name, settingTypeModel ) {
console.log( 'test' );
}
});
return controller;
} );
\ No newline at end of file
......@@ -34,6 +34,8 @@ define(
'controllers/app/changeSettingDefault',
'controllers/app/fieldset',
'controllers/app/toggleSetting',
'controllers/app/buttonToggleSetting',
'controllers/app/radioSetting',
'controllers/app/itemControls',
'controllers/app/mergeTags',
'controllers/app/mergeTagBox',
......@@ -137,6 +139,8 @@ define(
ChangeSettingDefault,
Fieldset,
ToggleSetting,
ButtonToggleSetting,
RadioSetting,
ItemControls,
MergeTags,
MergeTagsBox,
......@@ -271,6 +275,8 @@ define(
new MainContentFieldsSortable();
new ChangeSettingDefault();
new ToggleSetting();
new ButtonToggleSetting();
new RadioSetting();
new DrawerSettingChildView();
new FieldsEditActive();
new FieldSettings();
......
......@@ -154,11 +154,62 @@ define( ['views/app/drawer/optionRepeaterError'], function( ErrorView ) {
// Select Lists need an empty '<div></div>' for styling purposes.
emptyContainer = document.createElement( 'div' );
emptyContainer.style.bottom = '6px';
label.appendChild( emptyContainer );
// 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' );
emptyContainer.style.bottom = '6px';
label.appendChild( emptyContainer );
// The template requires a string.
return label.innerHTML;
},
renderOptions: function( column, value ) {
if( 'undefined' == typeof that.options.columns[ column ] ) return;
......
......@@ -21,7 +21,12 @@ define([], function() {
dateChange: function( model ) {
var fieldID = model.get( 'id' );
var value = model.get( 'value' );
var format = model.get( 'format' );
var format = model.get( 'date_format' );
if( 'default' === format) {
format = nfi18n.dateFormat;
}
if ( 0 < value.length ) {
// use moment's isValid to check against the fields format setting
if( moment( value, format ).isValid() ) {
......@@ -68,7 +73,11 @@ define([], function() {
/*
* Get our current date format
*/
var format = model.get( 'format' );
var format = model.get( 'date_format' );
if( 'default' === format) {
format = nfi18n.dateFormat;
}
/*
* Check our value to see if it is a valid email.
......
......@@ -99,6 +99,7 @@ define([], function() {
// }
option.selected = selected;
option.isSelected = selected;
option.required = this.required;
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-listcheckbox-option' );
html += template( option );
}, this );
......
......@@ -60,6 +60,7 @@ define([], function() {
option.classes = this.classes;
option.currentValue = this.value;
option.index = index;
option.required = this.required;
/*
* If we haven't edited this field yet, use the default checked
......
......@@ -27,7 +27,7 @@ define([], function() {
if ( this.value == num ) {
checked = 'checked';
}
var htmlFragment = template( { id: this.id, classes: this.classes, num: num, checked: checked } );
var htmlFragment = template( { id: this.id, classes: this.classes, num: num, checked: checked, required: this.required } );
html.appendChild(
document.createRange().createContextualFragment( htmlFragment )
);
......
......@@ -191,6 +191,14 @@ define( [], function() {
return '';
}
},
maybeRequired: function() {
if ( 1 == this.required ) {
return 'required';
} else {
return '';
}
},
maybeDisableAutocomplete: function() {
if ( 1 == this.disable_browser_autocomplete ) {
......
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.
File mode changed from 100644 to 100755
File mode changed from 100755 to 100644
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.
......@@ -237,6 +237,34 @@
}
}
}
.button-toggle {
text-align: left;
border: #ccc 1px solid;
border-radius: 5px;
background: #f1f1f1;
margin-top: 35px;
padding: 9px 0px;
width: 100%;
label {
width: 48%;
display: inline-block;
margin-left: 1%;
span {
width: 100%;
display: inline-block;
cursor: pointer;
transition: background-color 0.4s;
}
input:checked + span {
background-color: #1ea9ea;
border-color: #1ea9ea;
}
input + span {
background-color: #ccc;
border-color: #ccc;
}
}
}
}
.nf-drawer-buttons {
display: none;
......
......@@ -16,6 +16,10 @@ a {
outline: none !important;
border: 0;
}
a:focus {
outline: none !important;
box-shadow: unset; // Override WP focus state.
}
#wpwrap,
#wpcontent {
......@@ -189,8 +193,10 @@ Sections
---------------------------------------------*/
@import 'sections/widgets';
@import 'sections/services';
@import 'sections/apps';
@import 'sections/memberships';
@import 'sections/promotions';
/*
Widgets
......@@ -228,6 +234,26 @@ jBox
}
}
/*
Progress Bar
---------------------------------------------*/
.nf-progress-bar {
height: 20px;
border-radius: 3px;
margin: 25px 0px;
border: 1px solid #1ea9ea;
position: relative;
overflow: hidden;
.nf-progress-bar-slider {
height: 20px;
width: 0%;
background-color: #1ea9ea;
transition: width 0.3s;
}
}
/*
Loading Spinner
---------------------------------------------*/
......@@ -319,3 +345,33 @@ Loading Spinner
}
/*
Promotions
---------------------------------------------*/
.promotion--wrapper {
> div {
a {
position: relative;
display: block;
background: #f1f1f1;
padding: 16px 80px;
text-align: center;
border-radius: 4px;
font-size: 16px;
color: #ef4748 !important;
overflow: hidden;
line-height: 24px;
> .cta {
font-size: 22px;
}
> .dashicons, .dashicons-before::before {
position: absolute;
left: 0;
top: -20px;
font-size: 90px;
transform: rotate(20deg);
}
}
}
}
\ No newline at end of file
/* This section intentionally left blank. */
\ No newline at end of file
@keyframes nf-connected {
0% {
box-shadow: 0 0 2px rgba(255, 255, 255, 0),
inset 0 0 2px rgba(255, 255, 255, 0);
}
50% {
box-shadow: 0 0 2px #84cc1e,
inset 100vw 0 2px rgba(255, 255, 255, .2);
}
100% {
box-shadow: 0 0 2px rgba(255, 255, 255, 0),
inset 100vw 0 2px rgba(255, 255, 255, 0);
}
}
.nf-notices--oauth {
margin-top: -40px; // Account for the bottom margin on the topbar.
padding-bottom: 20px; // Increase hover target, while maintaining whitespace.
text-align:center;
}
.nf-oauth--checking {
padding: 5px;
}
.nf-oauth--connect {
display:block;
background-color:#1EA9EA;
color:white;
padding: 5px;
text-decoration:none;
}
.nf-oauth--connected {
color: transparent;
padding: 0;
line-height: .5;
transition: all .4s;
background-color:#84CC1E;
}
.nf-oauth--connected:not(:hover) {
animation: nf-connected 8s ease infinite;
animation-delay: 2s;
}
.nf-notices--oauth:hover .nf-oauth--connected {
color:white;
line-height: 2;
padding: 5px;
}
.promotion--wrapper {
width: 100%;
max-width: 50rem;
margin: auto;
margin-bottom: 20px; // Maintain whitespace.
}
.promotion--wrapper a:focus {
box-shadow: unset; // Override WP focus state.
}
@keyframes nf-service-installing {
100% {
transform:rotate(360deg);
}
}
.dashicons-update-spin {
animation: nf-service-installing 1s linear infinite;
}
.services {
.nf-extend.full {
flex-basis: 100%;
}
.nf-extend-buttons a {
margin-top: 20px;
}
.nf-extend-buttons .nf-button {
margin-top: auto; // Reset from anchor.
margin-bottom: 10px; // Account for toggle.
}
}
.jBox-Confirm-button {
height: auto !important;
font-size: 17px !important;
padding: 10px 30px !important;
}
.jBox-Confirm-button-submit {
background: #1ea9ea !important;
border: 1px solid #fff !important;
color: #fff !important;
}
.jBox-Confirm-button-cancel {
background: #fff !important;
border: 1px solid #1ea9ea !important;
color: #1ea9ea !important;
}
......@@ -102,10 +102,13 @@ th {
flex-wrap: wrap;
& > div {
display: flex;
width: 50%;
}
.template {
display: grid;
width: 100%;
a {
color: #424242;
display: block;
......@@ -147,7 +150,7 @@ table .forms-table-row li {
display: inline-block;
}
.modal-ad {
.modal-template {
padding: 20px;
img {
width: 100%;
......
define([ 'models/oauthModel' ], function( OAuthModel ) {
var controller = Marionette.Object.extend( {
initialize: function() {
this.oauth = new OAuthModel();
nfRadio.channel( 'dashboard' ).reply( 'get:oauth', this.getOAuth, this );
nfRadio.channel( 'dashboard' ).reply( 'disconnect:oauth', this.disconnect, this );
this.initOAuth();
},
getOAuth: function() {
return this.oauth;
},
/*
* Fetch the OAuth Model add and notify via nfRadio.
*/
initOAuth: function() {
this.oauth.fetch({
success: function( model ){
nfRadio.channel( 'dashboard' ).trigger( 'fetch:oauth' );
}
});
},
/**
* Confirm disconnecting services, then POST to the server to to disconnect.
*/
disconnect: function() {
var that = this;
new jBox('Confirm', {
width: 750,
content: 'Disconnecting from my.ninjaforms.com will disrupt the functionality of all services.',
confirmButton: 'Disconnect',
cancelButton: 'Stay Connected',
closeOnConfirm: true,
confirm: function(){
jQuery.ajax({
type: "POST",
url: ajaxurl + '?action=nf_oauth_disconnect',
success: function( response ){
console.log( response );
that.initOAuth();
}
});
}
}).open();
}
});
return controller;
} );
define([ 'models/serviceCollection' ], function( ServiceCollection ) {
var controller = Marionette.Object.extend( {
initialize: function() {
this.services = new ServiceCollection();
nfRadio.channel( 'dashboard' ).reply( 'install:service', this.installService, this );
nfRadio.channel( 'dashboard' ).reply( 'get:services', this.getServices, this );
this.fetchServices();
},
getServices: function() {
return this.services;
},
/*
* Fetch services, with an optional callback function.
*/
fetchServices: function( callback ) {
this.services.fetch({
success: function( model ){
if( callback ) callback( model );
nfRadio.channel( 'dashboard' ).trigger( 'fetch:services' );
}
});
},
/*
* Request the remote install of the service's corresponding plugin.
*/
installService: function( serviceModel ) {
var that = this;
if ( ! ( serviceModel instanceof Backbone.Model ) ) {
var serviceModel = this.services.find( function( model ) {
return serviceModel == model.get( 'slug' );
});
}
serviceModel.set( 'is_installing', true );
var slug = serviceModel.get( 'slug' );
var installPath = serviceModel.get( 'installPath' );
// Request to Install the service plugin.
jQuery.post( ajaxurl, { action: 'nf_services_install', plugin: slug, install_path: installPath }, function( response ){
that.fetchServices(function(){
nfRadio.channel( 'dashboard' ).request( 'install:service:' + slug );
});
} );
}
});
return controller;
} );
var nfRadio = Backbone.Radio;
var nfDebug = false;
if( ! useServices ){
/**
* If the feature flag isn't set then filter out the "Services" tab.
*/
nfDashItems = nfDashItems.filter(function(item){
return 'services' !== item.slug;