Version Description
- Change underscores style templating to account for when ASP tags are turned on.
Download this release
Release Info
Developer | tlovett1 |
Plugin | Custom Contact Forms |
Version | 6.3.2 |
Comparing to | |
See all releases |
Code changes from version 6.3.1 to 6.3.2
- build/js/form-cpt-preview.min.js +1 -1
- build/js/form-manager.js +45 -34
- build/js/form-manager.min.js +2 -2
- build/js/form-mce.min.js +1 -1
- build/js/form.min.js +1 -1
- classes/class-ccf-form-manager.php +256 -256
- custom-contact-forms.php +1 -1
- js/form-cpt-preview.js +2 -2
- js/form-mce.js +3 -3
- js/manager/utils.js +11 -0
- js/manager/views.js +34 -34
- readme.txt +5 -2
build/js/form-cpt-preview.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(e,t){"use strict";wp.ccf.preview=function(t,i){var l=this;l.id=parseInt(t),l.form=null;var s=l.fetch();e.when(s).done(function(){null===l.form?l.form=wp.ccf.forms.findWhere({ID:l.id}):(wp.ccf.forms.add(l.form),delete wp.ccf.forms.formsFetching[l.id]),l.renderPreviews.call(l),i.innerHTML=l.template({form:l.form.toJSON()})}),wp.ccf.dispatcher.on("saveFormComplete",function(){l.renderPreviews(),i.innerHTML=l.template({form:l.form.toJSON()})})},wp.ccf.preview.prototype={template:
|
1 |
+
(function(e,t){"use strict";wp.ccf.preview=function(t,i){var l=this;l.id=parseInt(t),l.form=null;var s=l.fetch();e.when(s).done(function(){null===l.form?l.form=wp.ccf.forms.findWhere({ID:l.id}):(wp.ccf.forms.add(l.form),delete wp.ccf.forms.formsFetching[l.id]),l.renderPreviews.call(l),i.innerHTML=l.template({form:l.form.toJSON()})}),wp.ccf.dispatcher.on("saveFormComplete",function(){l.renderPreviews(),i.innerHTML=l.template({form:l.form.toJSON()})})},wp.ccf.preview.prototype={template:wp.ccf.utils.template(document.getElementById("ccf-form-mce-preview").innerHTML),fetch:function(){var e=this,t=wp.ccf.forms.findWhere({ID:e.id});if(!t){var i;return wp.ccf.forms.formsFetching[e.id]!==void 0?i=wp.ccf.forms.formsFetching[e.id]:(e.form=new wp.ccf.models.Form({ID:e.id}),i=e.form.fetch(),wp.ccf.forms.formsFetching[e.id]=i),i}return!0},renderPreviews:function(){var e=this,t=e.form.get("fields");t.each(function(e){var t=document.getElementById("ccf-"+e.get("type")+"-preview-template");if(t){var i=wp.ccf.utils.template(t.innerHTML)({field:e.toJSON(),mce:!0});e.set("preview",i)}})}};var i=document.querySelectorAll(".ccf-form-cpt-preview");t.each(i,function(e){var t=parseInt(e.getAttribute("data-form-id"));new wp.ccf.preview(t,e)})})(jQuery,_);
|
build/js/form-manager.js
CHANGED
@@ -14,6 +14,17 @@
|
|
14 |
delete object.modified_tz;
|
15 |
};
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
wp.ccf.utils.insertFormShortcode = function( form ) {
|
18 |
var existingForm = wp.ccf.forms.findWhere( { ID: form.get( 'ID' ) } );
|
19 |
if ( ! existingForm ) {
|
@@ -807,7 +818,7 @@
|
|
807 |
|
808 |
wp.ccf.views.FieldChoice = Backbone.View.extend(
|
809 |
{
|
810 |
-
template:
|
811 |
className: 'choice',
|
812 |
|
813 |
events: {
|
@@ -949,7 +960,7 @@
|
|
949 |
|
950 |
wp.ccf.views.Fields['single-line-text'] = wp.ccf.views.Fields['single-line-text'] || wp.ccf.views.FieldBase.extend(
|
951 |
{
|
952 |
-
template:
|
953 |
|
954 |
initialize: function() {
|
955 |
|
@@ -971,7 +982,7 @@
|
|
971 |
|
972 |
wp.ccf.views.Fields.recaptcha = wp.ccf.views.Fields.recaptcha || wp.ccf.views.FieldBase.extend(
|
973 |
{
|
974 |
-
template:
|
975 |
|
976 |
initialize: function() {
|
977 |
|
@@ -990,7 +1001,7 @@
|
|
990 |
|
991 |
wp.ccf.views.Fields['section-header'] = wp.ccf.views.Fields['section-header'] || wp.ccf.views.FieldBase.extend(
|
992 |
{
|
993 |
-
template:
|
994 |
|
995 |
initialize: function() {
|
996 |
|
@@ -1008,7 +1019,7 @@
|
|
1008 |
|
1009 |
wp.ccf.views.Fields.html = wp.ccf.views.Fields.html || wp.ccf.views.FieldBase.extend(
|
1010 |
{
|
1011 |
-
template:
|
1012 |
|
1013 |
initialize: function() {
|
1014 |
|
@@ -1025,7 +1036,7 @@
|
|
1025 |
|
1026 |
wp.ccf.views.Fields['paragraph-text'] = wp.ccf.views.Fields['paragraph-text'] || wp.ccf.views.FieldBase.extend(
|
1027 |
{
|
1028 |
-
template:
|
1029 |
|
1030 |
saveField: function() {
|
1031 |
|
@@ -1043,7 +1054,7 @@
|
|
1043 |
|
1044 |
wp.ccf.views.Fields.hidden = wp.ccf.views.Fields.hidden || wp.ccf.views.FieldBase.extend(
|
1045 |
{
|
1046 |
-
template:
|
1047 |
|
1048 |
saveField: function() {
|
1049 |
|
@@ -1058,7 +1069,7 @@
|
|
1058 |
|
1059 |
wp.ccf.views.Fields.date = wp.ccf.views.Fields.date || wp.ccf.views.FieldBase.extend(
|
1060 |
{
|
1061 |
-
template:
|
1062 |
|
1063 |
saveField: function() {
|
1064 |
|
@@ -1090,7 +1101,7 @@
|
|
1090 |
|
1091 |
wp.ccf.views.Fields.name = wp.ccf.views.Fields.name || wp.ccf.views.FieldBase.extend(
|
1092 |
{
|
1093 |
-
template:
|
1094 |
|
1095 |
saveField: function() {
|
1096 |
|
@@ -1106,7 +1117,7 @@
|
|
1106 |
|
1107 |
wp.ccf.views.Fields.website = wp.ccf.views.Fields.website || wp.ccf.views.FieldBase.extend(
|
1108 |
{
|
1109 |
-
template:
|
1110 |
|
1111 |
saveField: function() {
|
1112 |
|
@@ -1124,7 +1135,7 @@
|
|
1124 |
|
1125 |
wp.ccf.views.Fields.phone = wp.ccf.views.Fields.phone || wp.ccf.views.FieldBase.extend(
|
1126 |
{
|
1127 |
-
template:
|
1128 |
|
1129 |
saveField: function() {
|
1130 |
|
@@ -1143,7 +1154,7 @@
|
|
1143 |
|
1144 |
wp.ccf.views.Fields.address = wp.ccf.views.Fields.address || wp.ccf.views.FieldBase.extend(
|
1145 |
{
|
1146 |
-
template:
|
1147 |
|
1148 |
saveField: function() {
|
1149 |
|
@@ -1160,7 +1171,7 @@
|
|
1160 |
|
1161 |
wp.ccf.views.Fields.email = wp.ccf.views.Fields.email || wp.ccf.views.FieldBase.extend(
|
1162 |
{
|
1163 |
-
template:
|
1164 |
|
1165 |
saveField: function() {
|
1166 |
|
@@ -1196,7 +1207,7 @@
|
|
1196 |
|
1197 |
wp.ccf.views.ChoiceableField = wp.ccf.views.ChoiceableField || wp.ccf.views.FieldBase.extend(
|
1198 |
{
|
1199 |
-
template:
|
1200 |
|
1201 |
initialize: function() {
|
1202 |
var choices = this.model.get( 'choices' );
|
@@ -1267,7 +1278,7 @@
|
|
1267 |
|
1268 |
wp.ccf.views.Fields.dropdown = wp.ccf.views.Fields.dropdown || wp.ccf.views.ChoiceableField.extend(
|
1269 |
{
|
1270 |
-
template:
|
1271 |
events: function() {
|
1272 |
return this.constructor.__super__.events;
|
1273 |
}
|
@@ -1276,7 +1287,7 @@
|
|
1276 |
|
1277 |
wp.ccf.views.Fields.radio = wp.ccf.views.Fields.radio || wp.ccf.views.ChoiceableField.extend(
|
1278 |
{
|
1279 |
-
template:
|
1280 |
events: function() {
|
1281 |
return this.constructor.__super__.events;
|
1282 |
}
|
@@ -1285,7 +1296,7 @@
|
|
1285 |
|
1286 |
wp.ccf.views.Fields.checkboxes = wp.ccf.views.Fields.checkboxes || wp.ccf.views.ChoiceableField.extend(
|
1287 |
{
|
1288 |
-
template:
|
1289 |
events: function() {
|
1290 |
return this.constructor.__super__.events;
|
1291 |
}
|
@@ -1331,7 +1342,7 @@
|
|
1331 |
var context = {};
|
1332 |
|
1333 |
if ( ! field ) {
|
1334 |
-
var template =
|
1335 |
this.el.innerHTML = template( context );
|
1336 |
} else {
|
1337 |
var type = field.get( 'type' );
|
@@ -1366,7 +1377,7 @@
|
|
1366 |
|
1367 |
wp.ccf.views.FieldRowPlaceholder = wp.ccf.views.FieldRowPlaceholder || Backbone.View.extend(
|
1368 |
{
|
1369 |
-
template:
|
1370 |
tagName: 'div',
|
1371 |
className: 'field',
|
1372 |
|
@@ -1387,7 +1398,7 @@
|
|
1387 |
|
1388 |
wp.ccf.views.FieldRow = wp.ccf.views.FieldRow || Backbone.View.extend(
|
1389 |
{
|
1390 |
-
template:
|
1391 |
tagName: 'div',
|
1392 |
className: 'field',
|
1393 |
|
@@ -1471,7 +1482,7 @@
|
|
1471 |
if ( previewTemplate ) {
|
1472 |
var preview = this.el.querySelectorAll( '.preview' )[0];
|
1473 |
preview.style.display = 'block';
|
1474 |
-
preview.innerHTML =
|
1475 |
}
|
1476 |
|
1477 |
return this;
|
@@ -1481,7 +1492,7 @@
|
|
1481 |
|
1482 |
wp.ccf.views.FormSettings = wp.ccf.views.FormSettings || Backbone.View.extend(
|
1483 |
{
|
1484 |
-
template:
|
1485 |
|
1486 |
events: {
|
1487 |
'blur input': 'save',
|
@@ -1564,7 +1575,7 @@
|
|
1564 |
|
1565 |
wp.ccf.views.FormNotifications = wp.ccf.views.FormNotifications || Backbone.View.extend(
|
1566 |
{
|
1567 |
-
template:
|
1568 |
|
1569 |
events: {
|
1570 |
'blur input': 'save',
|
@@ -1677,7 +1688,7 @@
|
|
1677 |
|
1678 |
wp.ccf.views.FormPane = wp.ccf.views.FormPane || Backbone.View.extend( _.defaults(
|
1679 |
{
|
1680 |
-
template:
|
1681 |
subViews: {
|
1682 |
'field-sidebar': wp.ccf.views.FieldSidebar,
|
1683 |
'form-settings': wp.ccf.views.FormSettings,
|
@@ -1931,7 +1942,7 @@
|
|
1931 |
wp.ccf.views.ExistingFormTableRow = wp.ccf.views.ExistingFormTableRow || Backbone.View.extend(
|
1932 |
{
|
1933 |
tagName: 'tr',
|
1934 |
-
template:
|
1935 |
events: {
|
1936 |
'click .edit': 'triggerMainViewChange',
|
1937 |
'click .delete': 'triggerDelete',
|
@@ -1980,7 +1991,7 @@
|
|
1980 |
wp.ccf.views.EmptyFormTableRow = wp.ccf.views.EmptyFormTableRow || Backbone.View.extend(
|
1981 |
{
|
1982 |
tagName: 'tr',
|
1983 |
-
template:
|
1984 |
|
1985 |
render: function() {
|
1986 |
this.$el.html( this.template() );
|
@@ -1991,7 +2002,7 @@
|
|
1991 |
|
1992 |
wp.ccf.views.ExistingFormTable = wp.ccf.views.ExistingFormTable || Backbone.View.extend(
|
1993 |
{
|
1994 |
-
template:
|
1995 |
|
1996 |
initialize: function() {
|
1997 |
this.parent = arguments.parent;
|
@@ -2056,7 +2067,7 @@
|
|
2056 |
|
2057 |
wp.ccf.views.ExistingFormPane = wp.ccf.views.ExistingFormPane || Backbone.View.extend( _.defaults(
|
2058 |
{
|
2059 |
-
template:
|
2060 |
subViews: {
|
2061 |
'existing-form-table': wp.ccf.views.ExistingFormTable
|
2062 |
},
|
@@ -2081,7 +2092,7 @@
|
|
2081 |
{
|
2082 |
tagName: 'div',
|
2083 |
className: 'ccf-main-modal',
|
2084 |
-
template:
|
2085 |
events: {
|
2086 |
'click .close-icon': 'hide',
|
2087 |
'click .main-menu a': 'menuClick'
|
@@ -2177,7 +2188,7 @@
|
|
2177 |
wp.ccf.views.SubmissionRow = wp.ccf.views.SubmissionRow || Backbone.View.extend(
|
2178 |
{
|
2179 |
tagName: 'tr',
|
2180 |
-
template:
|
2181 |
events: {
|
2182 |
'click .view': 'view',
|
2183 |
'click .delete': 'delete'
|
@@ -2237,7 +2248,7 @@
|
|
2237 |
|
2238 |
wp.ccf.views.SubmissionsTable = wp.ccf.views.SubmissionsTable || Backbone.View.extend(
|
2239 |
{
|
2240 |
-
template:
|
2241 |
events: {
|
2242 |
'click .prev:not(.disabled)': 'previousPage',
|
2243 |
'click .next:not(.disabled)': 'nextPage',
|
@@ -2313,7 +2324,7 @@
|
|
2313 |
|
2314 |
wp.ccf.views.Pagination = wp.ccf.views.Pagination || Backbone.View.extend(
|
2315 |
{
|
2316 |
-
template:
|
2317 |
|
2318 |
events: {
|
2319 |
'click .prev:not(.disabled)': 'previousPage',
|
@@ -2369,7 +2380,7 @@
|
|
2369 |
wp.ccf.views.EmptySubmissionTableRow = wp.ccf.views.EmptySubmissionTableRow || Backbone.View.extend(
|
2370 |
{
|
2371 |
tagName: 'tr',
|
2372 |
-
template:
|
2373 |
|
2374 |
initialize: function( options ) {
|
2375 |
this.parent = options.parent;
|
@@ -2384,7 +2395,7 @@
|
|
2384 |
|
2385 |
wp.ccf.views.SubmissionColumnController = wp.ccf.views.SubmissionColumnController || Backbone.View.extend(
|
2386 |
{
|
2387 |
-
template:
|
2388 |
|
2389 |
events: {
|
2390 |
'click input[type=checkbox]': 'triggerTableRebuild'
|
14 |
delete object.modified_tz;
|
15 |
};
|
16 |
|
17 |
+
wp.ccf.utils.template = function ( template ) {
|
18 |
+
// Use WordPress style Backbone template syntax
|
19 |
+
var options = {
|
20 |
+
evaluate: /<#([\s\S]+?)#>/g,
|
21 |
+
interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
|
22 |
+
escape: /\{\{([^\}]+?)\}\}(?!\})/g
|
23 |
+
};
|
24 |
+
|
25 |
+
return _.template( template, null, options );
|
26 |
+
};
|
27 |
+
|
28 |
wp.ccf.utils.insertFormShortcode = function( form ) {
|
29 |
var existingForm = wp.ccf.forms.findWhere( { ID: form.get( 'ID' ) } );
|
30 |
if ( ! existingForm ) {
|
818 |
|
819 |
wp.ccf.views.FieldChoice = Backbone.View.extend(
|
820 |
{
|
821 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-field-choice-template' ).innerHTML ),
|
822 |
className: 'choice',
|
823 |
|
824 |
events: {
|
960 |
|
961 |
wp.ccf.views.Fields['single-line-text'] = wp.ccf.views.Fields['single-line-text'] || wp.ccf.views.FieldBase.extend(
|
962 |
{
|
963 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-single-line-text-template' ).innerHTML ),
|
964 |
|
965 |
initialize: function() {
|
966 |
|
982 |
|
983 |
wp.ccf.views.Fields.recaptcha = wp.ccf.views.Fields.recaptcha || wp.ccf.views.FieldBase.extend(
|
984 |
{
|
985 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-recaptcha-template' ).innerHTML ),
|
986 |
|
987 |
initialize: function() {
|
988 |
|
1001 |
|
1002 |
wp.ccf.views.Fields['section-header'] = wp.ccf.views.Fields['section-header'] || wp.ccf.views.FieldBase.extend(
|
1003 |
{
|
1004 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-section-header-template' ).innerHTML ),
|
1005 |
|
1006 |
initialize: function() {
|
1007 |
|
1019 |
|
1020 |
wp.ccf.views.Fields.html = wp.ccf.views.Fields.html || wp.ccf.views.FieldBase.extend(
|
1021 |
{
|
1022 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-html-template' ).innerHTML ),
|
1023 |
|
1024 |
initialize: function() {
|
1025 |
|
1036 |
|
1037 |
wp.ccf.views.Fields['paragraph-text'] = wp.ccf.views.Fields['paragraph-text'] || wp.ccf.views.FieldBase.extend(
|
1038 |
{
|
1039 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-paragraph-text-template' ).innerHTML ),
|
1040 |
|
1041 |
saveField: function() {
|
1042 |
|
1054 |
|
1055 |
wp.ccf.views.Fields.hidden = wp.ccf.views.Fields.hidden || wp.ccf.views.FieldBase.extend(
|
1056 |
{
|
1057 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-hidden-template' ).innerHTML ),
|
1058 |
|
1059 |
saveField: function() {
|
1060 |
|
1069 |
|
1070 |
wp.ccf.views.Fields.date = wp.ccf.views.Fields.date || wp.ccf.views.FieldBase.extend(
|
1071 |
{
|
1072 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-date-template' ).innerHTML ),
|
1073 |
|
1074 |
saveField: function() {
|
1075 |
|
1101 |
|
1102 |
wp.ccf.views.Fields.name = wp.ccf.views.Fields.name || wp.ccf.views.FieldBase.extend(
|
1103 |
{
|
1104 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-name-template' ).innerHTML ),
|
1105 |
|
1106 |
saveField: function() {
|
1107 |
|
1117 |
|
1118 |
wp.ccf.views.Fields.website = wp.ccf.views.Fields.website || wp.ccf.views.FieldBase.extend(
|
1119 |
{
|
1120 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-website-template' ).innerHTML ),
|
1121 |
|
1122 |
saveField: function() {
|
1123 |
|
1135 |
|
1136 |
wp.ccf.views.Fields.phone = wp.ccf.views.Fields.phone || wp.ccf.views.FieldBase.extend(
|
1137 |
{
|
1138 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-phone-template' ).innerHTML ),
|
1139 |
|
1140 |
saveField: function() {
|
1141 |
|
1154 |
|
1155 |
wp.ccf.views.Fields.address = wp.ccf.views.Fields.address || wp.ccf.views.FieldBase.extend(
|
1156 |
{
|
1157 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-address-template' ).innerHTML ),
|
1158 |
|
1159 |
saveField: function() {
|
1160 |
|
1171 |
|
1172 |
wp.ccf.views.Fields.email = wp.ccf.views.Fields.email || wp.ccf.views.FieldBase.extend(
|
1173 |
{
|
1174 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-email-template' ).innerHTML ),
|
1175 |
|
1176 |
saveField: function() {
|
1177 |
|
1207 |
|
1208 |
wp.ccf.views.ChoiceableField = wp.ccf.views.ChoiceableField || wp.ccf.views.FieldBase.extend(
|
1209 |
{
|
1210 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-dropdown-template' ).innerHTML ),
|
1211 |
|
1212 |
initialize: function() {
|
1213 |
var choices = this.model.get( 'choices' );
|
1278 |
|
1279 |
wp.ccf.views.Fields.dropdown = wp.ccf.views.Fields.dropdown || wp.ccf.views.ChoiceableField.extend(
|
1280 |
{
|
1281 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-dropdown-template' ).innerHTML ),
|
1282 |
events: function() {
|
1283 |
return this.constructor.__super__.events;
|
1284 |
}
|
1287 |
|
1288 |
wp.ccf.views.Fields.radio = wp.ccf.views.Fields.radio || wp.ccf.views.ChoiceableField.extend(
|
1289 |
{
|
1290 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-radio-template' ).innerHTML ),
|
1291 |
events: function() {
|
1292 |
return this.constructor.__super__.events;
|
1293 |
}
|
1296 |
|
1297 |
wp.ccf.views.Fields.checkboxes = wp.ccf.views.Fields.checkboxes || wp.ccf.views.ChoiceableField.extend(
|
1298 |
{
|
1299 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-checkboxes-template' ).innerHTML ),
|
1300 |
events: function() {
|
1301 |
return this.constructor.__super__.events;
|
1302 |
}
|
1342 |
var context = {};
|
1343 |
|
1344 |
if ( ! field ) {
|
1345 |
+
var template = wp.ccf.utils.template( document.getElementById( 'ccf-empty-field-template' ).innerHTML );
|
1346 |
this.el.innerHTML = template( context );
|
1347 |
} else {
|
1348 |
var type = field.get( 'type' );
|
1377 |
|
1378 |
wp.ccf.views.FieldRowPlaceholder = wp.ccf.views.FieldRowPlaceholder || Backbone.View.extend(
|
1379 |
{
|
1380 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-field-row-template').innerHTML ),
|
1381 |
tagName: 'div',
|
1382 |
className: 'field',
|
1383 |
|
1398 |
|
1399 |
wp.ccf.views.FieldRow = wp.ccf.views.FieldRow || Backbone.View.extend(
|
1400 |
{
|
1401 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-field-row-template').innerHTML ),
|
1402 |
tagName: 'div',
|
1403 |
className: 'field',
|
1404 |
|
1482 |
if ( previewTemplate ) {
|
1483 |
var preview = this.el.querySelectorAll( '.preview' )[0];
|
1484 |
preview.style.display = 'block';
|
1485 |
+
preview.innerHTML = wp.ccf.utils.template( previewTemplate.innerHTML )( { field: this.model.toJSON() } );
|
1486 |
}
|
1487 |
|
1488 |
return this;
|
1492 |
|
1493 |
wp.ccf.views.FormSettings = wp.ccf.views.FormSettings || Backbone.View.extend(
|
1494 |
{
|
1495 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-form-settings-template' ).innerHTML ),
|
1496 |
|
1497 |
events: {
|
1498 |
'blur input': 'save',
|
1575 |
|
1576 |
wp.ccf.views.FormNotifications = wp.ccf.views.FormNotifications || Backbone.View.extend(
|
1577 |
{
|
1578 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-form-notifications-template' ).innerHTML ),
|
1579 |
|
1580 |
events: {
|
1581 |
'blur input': 'save',
|
1688 |
|
1689 |
wp.ccf.views.FormPane = wp.ccf.views.FormPane || Backbone.View.extend( _.defaults(
|
1690 |
{
|
1691 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-form-pane-template' ).innerHTML ),
|
1692 |
subViews: {
|
1693 |
'field-sidebar': wp.ccf.views.FieldSidebar,
|
1694 |
'form-settings': wp.ccf.views.FormSettings,
|
1942 |
wp.ccf.views.ExistingFormTableRow = wp.ccf.views.ExistingFormTableRow || Backbone.View.extend(
|
1943 |
{
|
1944 |
tagName: 'tr',
|
1945 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-existing-form-table-row-template').innerHTML ),
|
1946 |
events: {
|
1947 |
'click .edit': 'triggerMainViewChange',
|
1948 |
'click .delete': 'triggerDelete',
|
1991 |
wp.ccf.views.EmptyFormTableRow = wp.ccf.views.EmptyFormTableRow || Backbone.View.extend(
|
1992 |
{
|
1993 |
tagName: 'tr',
|
1994 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-empty-form-table-row-template').innerHTML ),
|
1995 |
|
1996 |
render: function() {
|
1997 |
this.$el.html( this.template() );
|
2002 |
|
2003 |
wp.ccf.views.ExistingFormTable = wp.ccf.views.ExistingFormTable || Backbone.View.extend(
|
2004 |
{
|
2005 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-existing-form-table-template').innerHTML ),
|
2006 |
|
2007 |
initialize: function() {
|
2008 |
this.parent = arguments.parent;
|
2067 |
|
2068 |
wp.ccf.views.ExistingFormPane = wp.ccf.views.ExistingFormPane || Backbone.View.extend( _.defaults(
|
2069 |
{
|
2070 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-existing-form-pane-template' ).innerHTML ),
|
2071 |
subViews: {
|
2072 |
'existing-form-table': wp.ccf.views.ExistingFormTable
|
2073 |
},
|
2092 |
{
|
2093 |
tagName: 'div',
|
2094 |
className: 'ccf-main-modal',
|
2095 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-main-modal-template' ).innerHTML ),
|
2096 |
events: {
|
2097 |
'click .close-icon': 'hide',
|
2098 |
'click .main-menu a': 'menuClick'
|
2188 |
wp.ccf.views.SubmissionRow = wp.ccf.views.SubmissionRow || Backbone.View.extend(
|
2189 |
{
|
2190 |
tagName: 'tr',
|
2191 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-submission-row-template' ).innerHTML ),
|
2192 |
events: {
|
2193 |
'click .view': 'view',
|
2194 |
'click .delete': 'delete'
|
2248 |
|
2249 |
wp.ccf.views.SubmissionsTable = wp.ccf.views.SubmissionsTable || Backbone.View.extend(
|
2250 |
{
|
2251 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-submission-table-template' ).innerHTML ),
|
2252 |
events: {
|
2253 |
'click .prev:not(.disabled)': 'previousPage',
|
2254 |
'click .next:not(.disabled)': 'nextPage',
|
2324 |
|
2325 |
wp.ccf.views.Pagination = wp.ccf.views.Pagination || Backbone.View.extend(
|
2326 |
{
|
2327 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-pagination-template' ).innerHTML ),
|
2328 |
|
2329 |
events: {
|
2330 |
'click .prev:not(.disabled)': 'previousPage',
|
2380 |
wp.ccf.views.EmptySubmissionTableRow = wp.ccf.views.EmptySubmissionTableRow || Backbone.View.extend(
|
2381 |
{
|
2382 |
tagName: 'tr',
|
2383 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-no-submissions-row-template').innerHTML ),
|
2384 |
|
2385 |
initialize: function( options ) {
|
2386 |
this.parent = options.parent;
|
2395 |
|
2396 |
wp.ccf.views.SubmissionColumnController = wp.ccf.views.SubmissionColumnController || Backbone.View.extend(
|
2397 |
{
|
2398 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-submissions-controller-template').innerHTML ),
|
2399 |
|
2400 |
events: {
|
2401 |
'click input[type=checkbox]': 'triggerTableRebuild'
|
build/js/form-manager.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
(function(e,t,i,l){"use strict";window.wp=window.wp||{},wp.ccf=wp.ccf||{},wp.ccf.utils=wp.ccf.utils||{},wp.ccf.utils.cleanDateFields=function(e){delete e.date,delete e.date_gmt,delete e.modified,delete e.modified_gmt,delete e.date_tz,delete e.modified_tz},wp.ccf.utils.insertFormShortcode=function(e){var t=wp.ccf.forms.findWhere({ID:e.get("ID")});t||wp.ccf.forms.add(e);var i=tinymce.get(wpActiveEditor),l='[ccf_form id="'+e.get("ID")+'"]';i&&!i.isHidden()?tinymce.activeEditor.execCommand("mceInsertContent",!1,l):document.getElementById(wpActiveEditor).value+=l},wp.ccf.utils.getPrettyPostDate=function(e){return e=moment(e),e.format("h:mm a M/D/YYYY")},wp.ccf.utils.wordChop=function(e,t){var i=e.substr(0,t);return i.substr(0,Math.min(i.length,i.lastIndexOf(" "))),i.length<e.length&&(i+="..."),i},wp.ccf.utils.isFieldDate=function(e){return e.date!==void 0||e.hour!==void 0&&e.minute!==void 0&&e["am-pm"]!==void 0?!0:!1},wp.ccf.utils.isFieldName=function(e){return e.name!==void 0||e.last!==void 0?!0:!1},wp.ccf.utils.isFieldAddress=function(e){return e.street!==void 0&&e.city!==void 0&&e.zipcode!==void 0&&e.line_two!==void 0?!0:!1},wp.ccf.utils.getPrettyFieldDate=function(e){var t="",i="";if(e.hour&&e.minute&&e["am-pm"]&&(t+=e.hour+":"+e.minute+" "+e["am-pm"]),e.date&&(t+=" "+e.date),!t)return"-";var s=moment(t);return s.isValid()?(e.hour&&e.minute&&e["am-pm"]&&(i+=s.format("h:mm a")),e.date&&(i&&(i+=" "),i+=s.format("M/D/YYYY")),i):l.invalidDate},wp.ccf.utils.getPrettyFieldName=function(e){var t=e.first;return t.length>0&&(t+=" "),e.last&&(t+=e.last),t||(t="-"),t},wp.ccf.utils.getPrettyFieldAddress=function(e){if(!e.street||!e.city)return"-";var t=e.street;return e.line_two&&(t+=" "+e.line_two),t+=", "+e.city,e.state&&(t+=", "+e.state),e.zipcode&&(t+=" "+e.zipcode),e.country&&(t+=" "+e.country),t}})(jQuery,Backbone,_,ccfSettings),function(e,t,i){"use strict";wp.ccf.mixins=wp.ccf.mixins||{},wp.ccf.mixins.subViewable=wp.ccf.mixins.subViewable||{subViews:{},initRenderSubViews:function(e,t,l){this.renderedSubViews||(this.renderedSubViews={});for(var s in this.subViews){var c={el:this.$el.find(".ccf-"+s),parent:this};l&&i.extend(c,l),this.renderedSubViews[s]&&this.renderedSubViews[s].destroy&&this.renderedSubViews[s].destroy(),(t||!this.renderedSubViews[s])&&(this.renderedSubViews[s]=new this.subViews[s](c)),this.renderedSubViews[s].render(),e&&(this.renderedSubViews[s].el.style.display="block")}return this},showView:function(e,t,i){if(this.renderedSubViews!==void 0&&this.renderedSubViews[e]!==void 0){var l=this.renderedSubViews[e];i||l.render(t),l.el.style.display="block",this.currentView=e;for(var s in this.subViews)s!==e&&(this.renderedSubViews[s].el.style.display="none")}}}}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l,s){"use strict";wp.ccf.models=wp.ccf.models||{},wp.ccf.models.Fields=wp.ccf.models.Fields||{};var c=function(e,i,l){return"object"!=typeof i&&""===i&&(i=""),t.Model.prototype.set.call(this,e,i,l)},n=function(e){for(var t in this.attributes)if(-1===e.indexOf(t)){var i=this.get(t);"string"==typeof i&&""!==i&&(i=(i+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/“/g,"”").replace(/”/g,"”").replace(/‘/g,"‘").replace(/'/g,"'"),this.set(t,i))}return this};wp.ccf.models.FieldChoice=wp.ccf.models.FieldChoice||t.Model.extend({defaults:{label:"",value:"",selected:!1},decode:function(){return n.call(this,[])},set:c}),wp.ccf.models.Form=wp.ccf.models.Form||wp.api.models.Post.extend({urlRoot:s.root+"/ccf/forms",set:c,initialize:function(){this.on("sync",this.decode,this)},defaults:function(){var e={fields:new wp.ccf.collections.Fields,type:"ccf_form",status:"publish",description:"",buttonText:"Submit Form",completionActionType:"text",completionRedirectUrl:"",completionMessage:"",sendEmailNotifications:!1,emailNotificationAddresses:l.adminEmail,emailNotificationFromType:"default",emailNotificationFromAddress:"",emailNotificationFromField:""};return e=i.defaults(e,this.constructor.__super__.defaults),wp.ccf.utils.cleanDateFields(e),e},decode:function(){var e=i.keys(wp.api.models.Post.prototype.defaults);return e=i.without(e,"title"),n.call(this,e)},getFieldSlugs:function(e){var t=wp.ccf.currentForm.get("fields"),i=[];return t.each(function(t){e&&t.isImmutable||i.push(t.get("slug"))}),i},parse:function(e){var t=this;if(e.fields){var l=t.get("fields");if(l&&l.length>0){for(var s=0;e.fields.length>s;s++){var c=e.fields[s],n=l.findWhere({slug:c.slug});if(n){if(c.choices!==void 0){var r=t.get("choices");if(r&&r.length>0)for(var o=0;c.choices>o;o++){var a=r.at(o);a.set(c.choices[o]),a.decode()}delete e.fields[s].choices}n.set(c),n.decode()}}delete e.fields}else{var d=[];i.each(e.fields,function(e){var t=new wp.ccf.models.Fields[e.type](e);t.decode(),d.push(t)}),e.fields=new wp.ccf.collections.Fields(d,{formId:e.ID})}}return this.constructor.__super__.parse.call(this,e)},toJSON:function(){var e=this.constructor.__super__.toJSON.call(this);return e.fields&&(e.fields=e.fields.toJSON()),e.author&&(e.author=e.author.toJSON()),e}}),wp.ccf.models.Submission=wp.api.models.Submission||wp.api.models.Post.extend({idAttribute:"ID",defaults:{ID:null,data:{}}}),wp.ccf.models.Field=wp.api.models.Field||wp.api.models.Post.extend({idAttribute:"ID",defaults:{ID:null},set:c,required:function(){return["slug"]},decode:function(){return n.call(this,i.keys(wp.api.models.Post.prototype.defaults))},hasRequiredAttributes:function(){var e=this,t=!0;return i.each(this.required(),function(i){(e.get(i)===void 0||""===e.get(i))&&(t=!1)}),t}}),wp.ccf.models.StandardField=wp.ccf.models.StandardField||wp.ccf.models.Field.extend({idAttribute:"ID",defaults:function(){var e={label:"Field Label",value:"",placeholder:"",slug:"",type:"",required:!1,className:""};return i.defaults(e,this.constructor.__super__.defaults)}}),wp.ccf.models.Fields["single-line-text"]=wp.ccf.models.Fields["single-line-text"]||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"single-line-text"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields["paragraph-text"]=wp.ccf.models.Fields["paragraph-text"]||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"paragraph-text"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.hidden=wp.ccf.models.Fields.hidden||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"hidden"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.email=wp.ccf.models.Fields.email||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"email",emailConfirmation:!1};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.website=wp.ccf.models.Fields.website||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"website"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.phone=wp.ccf.models.Fields.phone||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"phone",phoneFormat:"us"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.date=wp.ccf.models.Fields.date||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"date",showDate:!0,showTime:!0};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.name=wp.ccf.models.Fields.name||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"name"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.recaptcha=wp.ccf.models.Fields.recaptcha||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"recaptcha",siteKey:"",secretKey:""};return i.defaults(e,this.constructor.__super__.defaults())},required:function(){return["siteKey","secretKey"]},isImmutable:!0}),wp.ccf.models.Fields.address=wp.ccf.models.Fields.address||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"address",addressType:"us"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields["section-header"]=wp.ccf.models.Fields["section-header"]||wp.ccf.models.Field.extend({defaults:function(){var e={type:"section-header",slug:"",heading:"",subheading:"",className:""};return i.defaults(e,this.constructor.__super__.defaults)},required:function(){return[]},isImmutable:!0}),wp.ccf.models.Fields.html=wp.ccf.models.Fields.html||wp.ccf.models.Field.extend({defaults:function(){var e={type:"html",slug:"",html:"",className:""};return i.defaults(e,this.constructor.__super__.defaults)},required:function(){return[]},isImmutable:!0}),wp.ccf.models.ChoiceableField=wp.ccf.models.ChoiceableField||wp.ccf.models.StandardField.extend({defaults:function(){var e={choices:new wp.ccf.collections.FieldChoices};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(e){if("object"==typeof e&&e.choices){var t=[];i.each(e.choices,function(e){var i=new wp.ccf.models.FieldChoice(e);i.decode(),t.push(i)}),this.set("choices",new wp.ccf.collections.FieldChoices(t))}}}),wp.ccf.models.Fields.radio=wp.ccf.models.Fields.radio||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"radio"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}}),wp.ccf.models.Fields.checkboxes=wp.ccf.models.Fields.checkboxes||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"checkboxes"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}}),wp.ccf.models.Fields.dropdown=wp.ccf.models.Fields.dropdown||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"dropdown"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}})}(jQuery,Backbone,_,ccfSettings,WP_API_Settings),function(e,t,i){"use strict";wp.ccf.collections=wp.ccf.collections||{},wp.ccf.collections.Forms=wp.ccf.collections.Forms||wp.api.collections.Posts.extend({model:wp.ccf.models.Form,url:WP_API_Settings.root+"/ccf/forms",formsFetching:{},initialize:function(){this.constructor.__super__.initialize(),this.formsFetching={}},remove:function(e,t){t=t||{};var l=this.constructor.__super__.remove.call(this,e,t);return t.destroy&&(e instanceof Array?i.each(e,function(e){e.destroy()}):e.destroy()),l}}),wp.ccf.collections.Fields=wp.ccf.collections.Fields||wp.api.collections.Posts.extend({model:wp.ccf.models.Field,url:function(){return WP_API_Settings.root+"/ccf/forms/"+this.formId+"/fields"},initialize:function(e,t){t&&t.formId&&(this.formId=t.formId)}}),wp.ccf.collections.Submissions=wp.ccf.collections.Submissions||wp.api.collections.Posts.extend({model:wp.ccf.models.Submission,url:function(){return WP_API_Settings.root+"/ccf/forms/"+this.formId+"/submissions"},initialize:function(e,t){this.constructor.__super__.initialize.apply(this,arguments),t&&t.formId&&(this.formId=t.formId)}}),wp.ccf.collections.FieldChoices=wp.ccf.collections.FieldChoices||t.Collection.extend({model:wp.ccf.models.FieldChoice})}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l){"use strict";wp.ccf.views=wp.ccf.views||{},wp.ccf.views.Fields=wp.ccf.views.Fields||{},wp.ccf.views.FieldChoice=t.View.extend({template:i.template(document.getElementById("ccf-field-choice-template").innerHTML),className:"choice",events:{"click .add":"triggerAdd","click .delete":"triggerDelete","blur input":"saveChoice",saveChoice:"saveChoice",sorted:"triggerUpdateSort"},initialize:function(e){this.field=e.field},destroy:function(){wp.ccf.dispatcher.off("mainViewChange",this.saveChoice),this.unbind()},triggerUpdateSort:function(e,t){this.field.get("choices").remove(this.model,{silent:!0}),this.field.get("choices").add(this.model,{at:t,silent:!0})},saveChoice:function(){if(""!==this.el.innerHTML){var e=this.el.querySelectorAll(".choice-label")[0].value,t=this.el.querySelectorAll(".choice-value")[0].value;this.model.set("label",e),this.model.set("value",t);var i=this.el.querySelectorAll(".choice-selected")[0],l=i.checked?!0:!1;return this.model.set("selected",l),this}},render:function(){var e={};return this.model&&(e.choice=this.model.toJSON()),this.el.innerHTML=this.template(e),wp.ccf.dispatcher.on("mainViewChange",this.saveChoice,this),this},triggerAdd:function(){this.field.get("choices").add(new wp.ccf.models.FieldChoice)},triggerDelete:function(){var e=this.field.get("choices");if(e.length>1)e.remove(this.model),this.destroy(),this.remove();else{for(var t=this.el.querySelectorAll(".choice-label, .choice-value"),i=this.el.querySelectorAll(".choice-selected"),l=0;t.length>l;l++)t[l].value="";i[0].checked=!1}}}),wp.ccf.views.FieldBase=wp.ccf.views.FieldBase||t.View.extend({events:{"blur input":"saveField","blur input.field-slug":"checkSlug","blur textarea":"saveField","change select":"saveField",'change input[type="checkbox"]':"saveField"},checkSlug:function(){var e=this.el.querySelectorAll(".field-slug");if(e.length>0){var t=e[0],i=!1;t.parentNode.className=t.value&&!t.value.match(/^[a-zA-Z0-9\-_]+$/)?t.parentNode.className.replace(/ field-error/i,"")+" field-error":t.parentNode.className.replace(/ field-error/i,""),this.collection.length>0&&""!==t.value?(this.collection.each(function(e){e!==this.model&&t.value===e.get("slug")&&(i=!0)},this),t.parentNode.className=i?t.parentNode.className.replace(/ field-duplicate-slug/i,"")+" field-duplicate-slug":t.parentNode.className.replace(/ field-duplicate-slug/i,"")):t.parentNode.className=t.parentNode.className.replace(/ field-duplicate-slug/i,"")}},destroy:function(){this.unbind()},render:function(){return this.el.innerHTML=this.template({field:this.model.toJSON()}),this.checkSlug(),this}}),wp.ccf.views.Fields["single-line-text"]=wp.ccf.views.Fields["single-line-text"]||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-single-line-text-template").innerHTML),initialize:function(){},saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.recaptcha=wp.ccf.views.Fields.recaptcha||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-recaptcha-template").innerHTML),initialize:function(){},saveField:function(){return this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("siteKey",this.el.querySelectorAll(".field-site-key")[0].value),this.model.set("secretKey",this.el.querySelectorAll(".field-secret-key")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this}}),wp.ccf.views.Fields["section-header"]=wp.ccf.views.Fields["section-header"]||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-section-header-template").innerHTML),initialize:function(){},saveField:function(){return this.model.set("heading",this.el.querySelectorAll(".field-heading")[0].value),this.model.set("subheading",this.el.querySelectorAll(".field-subheading")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this}}),wp.ccf.views.Fields.html=wp.ccf.views.Fields.html||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-html-template").innerHTML),initialize:function(){},saveField:function(){return this.model.set("html",this.el.querySelectorAll(".field-html")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this}}),wp.ccf.views.Fields["paragraph-text"]=wp.ccf.views.Fields["paragraph-text"]||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-paragraph-text-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.hidden=wp.ccf.views.Fields.hidden||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-hidden-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this}}),wp.ccf.views.Fields.date=wp.ccf.views.Fields.date||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-date-template").innerHTML),saveField:function(){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value);var e=this.el.querySelectorAll(".field-value");e.length>0&&this.model.set("value",e[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("showDate",this.el.querySelectorAll(".field-show-date")[0].checked?!0:!1);var t=this.model.get("showTime"),i=this.el.querySelectorAll(".field-show-time")[0].checked?!0:!1;return this.model.set("showTime",i),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),i!=t&&this.render(),this}}),wp.ccf.views.Fields.name=wp.ccf.views.Fields.name||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-name-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.website=wp.ccf.views.Fields.website||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-website-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.phone=wp.ccf.views.Fields.phone||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-phone-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("phoneFormat",this.el.querySelectorAll(".field-phone-format")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.address=wp.ccf.views.Fields.address||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-address-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("addressType",this.el.querySelectorAll(".field-address-type")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.email=wp.ccf.views.Fields.email||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-email-template").innerHTML),saveField:function(){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value);var e=this.el.querySelectorAll(".field-value");e.length&&this.model.set("value",e[0].value);var t=this.el.querySelectorAll(".field-placeholder");t.length&&this.model.set("placeholder",t[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1);var i=1==this.el.querySelectorAll(".field-email-confirmation")[0].value?!0:!1,l=this.model.get("emailConfirmation");return this.model.set("emailConfirmation",i),l!=i&&this.render(),this}}),wp.ccf.views.ChoiceableField=wp.ccf.views.ChoiceableField||wp.ccf.views.FieldBase.extend({template:i.template(document.getElementById("ccf-dropdown-template").innerHTML),initialize:function(){var e=this.model.get("choices");this.listenTo(e,"add",this.addChoice)},addChoice:function(e){var t=new wp.ccf.views.FieldChoice({model:e,field:this.model}).render(),i=this.el.querySelectorAll(".repeatable-choices")[0];i.appendChild(t.el)},saveField:function(){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1);var t=this.el.querySelectorAll(".repeatable-choices")[0].querySelectorAll(".choice");return i.each(t,function(t){e(t).trigger("saveChoice")}),this},render:function(){var t=this;t.el.innerHTML=t.template({field:t.model.toJSON()}),t.checkSlug();var i=t.model.get("choices"),l=this.el.querySelectorAll(".repeatable-choices")[0];if(i.length>=1)i.each(function(e){var i=new wp.ccf.views.FieldChoice({model:e,field:t.model}).render();l.appendChild(i.el)});else{var s=new wp.ccf.models.FieldChoice;i.add(s)}return l=this.el.querySelectorAll(".repeatable-choices")[0],e(l).sortable({handle:".move",axis:"y",stop:function(e,t){t.item.trigger("sorted",t.item.index())}}),t}}),wp.ccf.views.Fields.dropdown=wp.ccf.views.Fields.dropdown||wp.ccf.views.ChoiceableField.extend({template:i.template(document.getElementById("ccf-dropdown-template").innerHTML),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.Fields.radio=wp.ccf.views.Fields.radio||wp.ccf.views.ChoiceableField.extend({template:i.template(document.getElementById("ccf-radio-template").innerHTML),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.Fields.checkboxes=wp.ccf.views.Fields.checkboxes||wp.ccf.views.ChoiceableField.extend({template:i.template(document.getElementById("ccf-checkboxes-template").innerHTML),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.FieldSidebar=wp.ccf.views.FieldSidebar||t.View.extend({initialize:function(e){this.currentFieldView=null,this.form=e.form},save:function(e){this.currentFieldView&&""!==this.currentFieldView.el.innerHTML&&this.currentFieldView.saveField(),e&&e instanceof Object&&e.resolve()},fieldRemoved:function(){this.currentFieldView&&(this.form.get("fields").get(this.currentFieldView.model)||this.render())},destroy:function(){wp.ccf.dispatcher.off("saveField",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save),this.unbind()},render:function(e){var t={};if(e){var l=e.get("type");this.currentFieldView&&(this.currentFieldView.saveField(),this.currentFieldView.destroy&&this.currentFieldView.destroy()),this.currentFieldView=new wp.ccf.views.Fields[l]({model:e,collection:this.form.get("fields")}),this.currentFieldView.render(),this.el.innerHTML="",this.el.appendChild(this.currentFieldView.el);var s=this.form.get("fields");this.listenTo(s,"remove",this.fieldRemoved)}else{var c=i.template(document.getElementById("ccf-empty-field-template").innerHTML);this.el.innerHTML=c(t)}return wp.ccf.dispatcher.on("saveField",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this}}),wp.ccf.views.FieldRowPlaceholder=wp.ccf.views.FieldRowPlaceholder||t.View.extend({template:i.template(document.getElementById("ccf-field-row-template").innerHTML),tagName:"div",className:"field",initialize:function(e){this.type=e.type},render:function(){return this.el.innerHTML=this.template({label:l.allLabels[this.type]}),this.el.setAttribute("data-field-type",this.type),this.el.className+=" "+this.type,this}}),wp.ccf.views.FieldRow=wp.ccf.views.FieldRow||t.View.extend({template:i.template(document.getElementById("ccf-field-row-template").innerHTML),tagName:"div",className:"field",events:{"click .delete":"triggerDelete","click h4":"triggerEdit",sorted:"triggerUpdateSort"},initialize:function(e){i.bindAll(this,"triggerDelete"),this.form=e.form,this.listenTo(this.model,"change",this.handleChange,this),this.listenTo(this.model,"requirementsNotMet",this.requirementsNotMet,this),this.listenTo(this.model,"requirementsMet",this.requirementsMet,this),this.listenTo(this.model,"duplicateSlug",this.duplicateSlug,this),this.model.attributes.choices&&this.listenTo(this.model.attributes.choices,"change",this.handleChange,this)},duplicateSlug:function(){this.requirementsMet(),this.el.className+=" field-duplicate-slug"},requirementsNotMet:function(){this.requirementsMet(),this.el.className+=" field-incomplete"},requirementsMet:function(){this.el.className=this.el.className.replace(/(field-incomplete|field-duplicate-slug)/i,"")},triggerUpdateSort:function(e,t){this.form.get("fields").remove(this.model),this.form.get("fields").add(this.model,{at:t})},handleChange:function(){this.render()},triggerDelete:function(e){e.stopPropagation(),this.form.get("fields").remove(this.model),this.undelegateEvents(),this.remove()},triggerEdit:function(){var e=this.el.parentNode.querySelectorAll(".ccf-editing");i.each(e,function(e){e.className=e.className.replace(/ccf-editing/i,"")}),this.el.className=this.el.className.replace(/ccf-editing/i,"")+" ccf-editing",wp.ccf.dispatcher.trigger("openEditField",this.model)},render:function(e){this.el.innerHTML=this.template({label:l.allLabels[this.model.get("type")]}),this.el.setAttribute("data-field-type",this.model.get("type"));var t=RegExp(" "+this.model.get("type"),"i");this.el.className=this.el.className.replace(t,"")+" "+this.model.get("type"),e&&(this.el.className=this.el.className.replace(/ instantiated/i,"")+" instantiated");var s=document.getElementById("ccf-"+this.model.get("type")+"-preview-template");if(s){var c=this.el.querySelectorAll(".preview")[0];c.style.display="block",c.innerHTML=i.template(s.innerHTML)({field:this.model.toJSON()})}return this}}),wp.ccf.views.FormSettings=wp.ccf.views.FormSettings||t.View.extend({template:i.template(document.getElementById("ccf-form-settings-template").innerHTML),events:{"blur input":"save","change select":"save","change select.form-completion-action-type":"toggleCompletionFields","change select.form-send-email-notifications":"toggleNotificationFields"},initialize:function(e){this.model=e.form},destroy:function(){wp.ccf.dispatcher.off("saveFormSettings",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save)},toggleCompletionFields:function(){var e=this.el.querySelectorAll(".form-completion-action-type")[0].value,t=this.el.querySelectorAll(".completion-message")[0],i=this.el.querySelectorAll(".completion-redirect-url")[0];"text"===e?(t.style.display="block",i.style.display="none"):(t.style.display="none",i.style.display="block")},save:function(e){if(""!==this.el.innerHTML){var t=this.el.querySelectorAll(".form-title")[0].value;this.model.set("title",t);var i=this.el.querySelectorAll(".form-description")[0].value;this.model.set("description",i);var l=this.el.querySelectorAll(".form-button-text")[0].value;this.model.set("buttonText",l);var s=this.el.querySelectorAll(".form-completion-message")[0].value;this.model.set("completionMessage",s);var c=this.el.querySelectorAll(".form-completion-redirect-url")[0].value;this.model.set("completionRedirectUrl",c);var n=this.el.querySelectorAll(".form-completion-action-type")[0].value;this.model.set("completionActionType",n),e!==void 0&&e.promise!==void 0&&e.resolve()}},render:function(){var e={form:this.model.toJSON()};return this.el.innerHTML=this.template(e),this.toggleCompletionFields(),wp.ccf.dispatcher.on("saveFormSettings",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this}}),wp.ccf.views.FormNotifications=wp.ccf.views.FormNotifications||t.View.extend({template:i.template(document.getElementById("ccf-form-notifications-template").innerHTML),events:{"blur input":"save","change select":"save","change select.form-send-email-notifications":"toggleNotificationFields","change select.form-email-notification-from-type":"toggleNotificationFields"},initialize:function(e){this.model=e.form},destroy:function(){wp.ccf.dispatcher.off("saveFormSettings",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save)},toggleNotificationFields:function(){var e,t=this.el.querySelectorAll(".form-send-email-notifications")[0].value,i=this.el.querySelectorAll(".email-notification-setting"),l=this.el.querySelectorAll(".email-notification-from-address")[0],s=this.el.querySelectorAll(".email-notification-from-field")[0],c=this.el.querySelectorAll(".form-email-notification-from-type")[0];if(parseInt(t)){for(e=0;i>e;e++)emailNotificationAddresses.style.display="block";l.style.display="none",s.style.display="none","custom"===c.value?l.style.display="block":"field"===c.value&&(s.style.display="block")}else{for(e=0;i>e;e++)emailNotificationAddresses.style.display="none";l.style.display="none",s.style.display="none"}},save:function(e){if(""!==this.el.innerHTML){var t=this.el.querySelectorAll(".form-send-email-notifications")[0].value;this.model.set("sendEmailNotifications",parseInt(t)?!0:!1);var i=this.el.querySelectorAll(".form-email-notification-addresses")[0].value;this.model.set("emailNotificationAddresses",i);var l=this.el.querySelectorAll(".form-email-notification-from-type")[0].value;this.model.set("emailNotificationFromType",l);var s=this.el.querySelectorAll(".form-email-notification-from-address")[0].value;this.model.set("emailNotificationFromAddress",s);var c=this.el.querySelectorAll(".form-email-notification-from-field")[0].value;this.model.set("emailNotificationFromField",c),e!==void 0&&e.promise!==void 0&&e.resolve()}},render:function(){var e=[],t=this.model.get("fields");t.each(function(t){"email"===t.get("type")&&e.push(t)});var i={form:this.model.toJSON(),emailFields:e};return this.el.innerHTML=this.template(i),this.toggleNotificationFields(),wp.ccf.dispatcher.on("saveFormNotifications",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this.listenTo(t,"add",this.render,this),this.listenTo(t,"remove",this.render,this),this}}),wp.ccf.views.FormPane=wp.ccf.views.FormPane||t.View.extend(i.defaults({template:i.template(document.getElementById("ccf-form-pane-template").innerHTML),subViews:{"field-sidebar":wp.ccf.views.FieldSidebar,"form-settings":wp.ccf.views.FormSettings,"form-notifications":wp.ccf.views.FormNotifications},events:{"click .save-button":"sync","click h2":"accordionClick","click .insert-form-button":"insertForm"},initialize:function(){wp.ccf.dispatcher.on("openEditField",this.openEditField,this)
|
2 |
-
},insertForm:function(){wp.ccf.utils.insertFormShortcode(this.model),wp.ccf.toggle()},accordionClick:function(t){var l=e(t.currentTarget).parents(".accordion-container")[0],s=l.querySelectorAll(".accordion-section");t.currentTarget.parentNode.className.match(/expanded/i)?t.currentTarget.parentNode.className=t.currentTarget.parentNode.className.replace(/expanded/i,""):t.currentTarget.parentNode.className+=" expanded",i.each(s,function(e){e!=t.currentTarget.parentNode&&e.className.match(/expanded/i)&&(e.className=e.className.replace(/expanded/i,""))})},openEditField:function(e){this.renderedSubViews["field-sidebar"].render(e).el.style.display="block"},disable:function(){this.el.querySelectorAll(".save-button")[0].setAttribute("disabled","disabled"),this.el.querySelectorAll(".disabled-overlay")[0].style.display="block"},enable:function(){this.el.querySelectorAll(".save-button")[0].removeAttribute("disabled"),this.el.querySelectorAll(".disabled-overlay")[0].style.display="none"},sync:function(){var t=this,i=e(this.el.querySelectorAll(".spinner")[0]);i.fadeIn(),t.disable();var s=e.Deferred(),c=e.Deferred(),n=e.Deferred();wp.ccf.dispatcher.trigger("saveFormSettings",s),wp.ccf.dispatcher.trigger("saveFormNotifications",n),wp.ccf.dispatcher.trigger("saveField",c),e.when(s,c,n).then(function(){var e=t.model.get("fields"),s=!0,c={};e.each(function(e){var t=e.get("slug");e.hasRequiredAttributes()?t&&!t.match(/^[a-zA-Z0-9\-_]+$/)?(s=!1,e.trigger("requirementsNotMet")):c[e.get("slug")]!==void 0?(s=!1,e.trigger("duplicateSlug"),c[e.get("slug")].trigger("duplicateSlug")):e.trigger("requirementsMet"):(s=!1,e.trigger("requirementsNotMet")),e.get("slug")&&(c[e.get("slug")]=e)}),s?t.model.save({},{context:"edit"}).done(function(){l.single&&!l.postId&&(window.location=l.adminUrl+"post.php?post="+t.model.get("ID")+"&action=edit#ccf-form/"+t.model.get("ID"))}).complete(function(){i.fadeOut(),t.enable(),wp.ccf.dispatcher.trigger("saveFormComplete",t.model)}):(t.enable(),i.fadeOut())})},enableDisableInsert:function(){var e=this.el.querySelectorAll(".insert-form-button")[0];this.model.get("ID")?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled")},getNextFieldOrd:function(){var e=this.model.get("fields"),t=e.length+1;return e.each(function(e){var i=e.get("slug"),l=/\-([0-9]+)$/g,s=l.exec(i);if(s&&s[1]){var c=parseInt(s[1]);c>=t&&(t=c+1)}}),t},render:function(t){var s=this;s.model=t?t:new wp.ccf.models.Form,this.listenTo(s.model,"change",this.enableDisableInsert,this);var c={labels:l.fieldLabels,form:s.model.toJSON()};window.form=s.model,s.el.innerHTML=this.template(c);var n=s.el.querySelectorAll(".fields")[0];i.each(l.fieldLabels,function(e,t){n.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)});var r=s.el.querySelectorAll(".structure-fields")[0];i.each(l.structureFieldLabels,function(e,t){r.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)});var o=s.el.querySelectorAll(".special-fields")[0];i.each(l.specialFieldLabels,function(e,t){o.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)}),e(s.el.querySelectorAll(".left-sidebar")[0].querySelectorAll(".field")).draggable({cursor:"move",zIndex:160001,scroll:!1,containment:".ccf-form-pane",appendTo:".ccf-main-modal",snap:!0,connectToSortable:".form-content",helper:function(t){var i=e(t.currentTarget),l=e('<div class="field" data-field-type="'+i.attr("data-field-type")+'"><h4>'+i.find(".label").html()+"</h4></div>");return l.css({width:i.width(),height:i.height()})}});var a=s.model.get("fields"),d=s.el.querySelectorAll(".form-content")[0];return a.length>=1&&(d.innerHTML="",a.each(function(e){var t=new wp.ccf.views.FieldRow({model:e,form:s.model}).render(!0).el;d.appendChild(t)})),e(d).sortable({axis:"y",handle:"h4",stop:function(e,t){if(!t.item.hasClass("instantiated")){var i=t.item.attr("data-field-type"),l={};wp.ccf.models.Fields[i].prototype.defaults().slug!==void 0&&(l.slug=i+"-"+s.getNextFieldOrd());var c=new wp.ccf.models.Fields[i](l),n=s.model.get("fields");n.add(c),new wp.ccf.views.FieldRow({model:c,el:t.item,form:s.model}).render(!0),t.item.attr("style","")}t.item.trigger("sorted",t.item.index())}}),s.initRenderSubViews(!0,!0,{form:s.model}),s.enableDisableInsert(),s}},wp.ccf.mixins.subViewable)),wp.ccf.views.ExistingFormTableRow=wp.ccf.views.ExistingFormTableRow||t.View.extend({tagName:"tr",template:i.template(document.getElementById("ccf-existing-form-table-row-template").innerHTML),events:{"click .edit":"triggerMainViewChange","click .delete":"triggerDelete","click .insert-form-button":"insertForm"},initialize:function(e){this.parent=e.parent},insertForm:function(){wp.ccf.utils.insertFormShortcode(this.model),wp.ccf.toggle()},triggerMainViewChange:function(){wp.ccf.switchToForm(this.model)},triggerDelete:function(){var e,t=this,i=t.parent.collection.state.currentPage;t.model.destroy().done(function(){e=i,e===t.parent.collection.state.totalPages&&e-1===(t.parent.collection.state.totalObjects-1)/l.postsPerPage&&e--,t.parent.showPage(e).done(function(){t.parent.renderPagination()})})},render:function(){return this.$el.html(this.template({form:this.model.toJSON(),utils:{getPrettyPostDate:wp.ccf.utils.getPrettyPostDate}})),this}}),wp.ccf.views.EmptyFormTableRow=wp.ccf.views.EmptyFormTableRow||t.View.extend({tagName:"tr",template:i.template(document.getElementById("ccf-empty-form-table-row-template").innerHTML),render:function(){return this.$el.html(this.template()),this}}),wp.ccf.views.ExistingFormTable=wp.ccf.views.ExistingFormTable||t.View.extend({template:i.template(document.getElementById("ccf-existing-form-table-template").innerHTML),initialize:function(){this.parent=arguments.parent,this.collection=new wp.ccf.collections.Forms,wp.ccf.dispatcher.on("changeFormTablePage",this.showPage,this),wp.ccf.dispatcher.on("saveFormComplete",this.render,this)},showPage:function(e){var t=this,i=this.collection.fetch({data:{page:e}});return i.done(function(){var e=t.el.querySelectorAll(".rows")[0],i=document.createElement("tbody");i.className="rows",t.collection.length>=1?t.collection.each(function(e){var l=new wp.ccf.views.ExistingFormTableRow({model:e,parent:t}).render();i.appendChild(l.el)},t):i.appendChild((new wp.ccf.views.EmptyFormTableRow).render().el),e.parentNode.replaceChild(i,e)}),i},renderPagination:function(){var e=this.el.querySelectorAll(".ccf-pagination")[0];e.innerHTML="",this.collection.state.totalPages>1&&e.appendChild(new wp.ccf.views.Pagination({parent:this}).render(this.collection.state.totalPages,this.collection.state.currentPage).el)},render:function(){var e=this;return this.el.innerHTML=this.template(),this.el.querySelectorAll(".ccf-pagination")[0],this.showPage(1).done(function(){e.renderPagination()}),this}}),wp.ccf.views.ExistingFormPane=wp.ccf.views.ExistingFormPane||t.View.extend(i.defaults({template:i.template(document.getElementById("ccf-existing-form-pane-template").innerHTML),subViews:{"existing-form-table":wp.ccf.views.ExistingFormTable},render:function(){return this.rendered?this:(this.rendered=!0,this.el.innerHTML=this.template(),this.initRenderSubViews(!0),this)}},wp.ccf.mixins.subViewable)),wp.ccf.views.MainModal=wp.ccf.views.MainModal||t.View.extend(i.defaults({tagName:"div",className:"ccf-main-modal",template:i.template(document.getElementById("ccf-main-modal-template").innerHTML),events:{"click .close-icon":"hide","click .main-menu a":"menuClick"},subViews:{"form-pane":wp.ccf.views.FormPane},initialize:function(){l.single||(this.subViews["existing-form-pane"]=wp.ccf.views.ExistingFormPane),wp.ccf.dispatcher.on("mainViewChange",this.toggleView,this)},toggleView:function(e){this.showView(e,wp.ccf.currentForm);var t=e;"form-pane"===e&&wp.ccf.currentForm&&(t="existing-form-pane");var l=this.el.querySelectorAll(".menu-item");i.each(l,function(e){var i=e.getAttribute("data-view");e.className=i===t?e.className.replace("selected","")+" selected":e.className.replace("selected","")})},menuClick:function(e){var t=e.target.getAttribute("data-view");"form-pane"===t&&(wp.ccf.currentForm=null),wp.ccf.dispatcher.trigger("mainViewChange",t),e.preventDefault()},render:function(e){return e=e||!1,this.overlay(),this.el.innerHTML=this.template({single:e}),this.initRenderSubViews(),this.showView("form-pane",wp.ccf.currentForm,!0),this},overlay:function(){return this.overlayEl===void 0&&(this.overlayEl=document.createElement("div"),this.overlayEl.className="ccf-main-modal-overlay",document.body.appendChild(this.overlayEl)),this.overlayEl},remove:function(){return document.body.removeChild(this.overlay()),this},show:function(){e(this.overlay()).show(),this.$el.show()},hide:function(){e(this.overlay()).hide(),this.$el.hide()}},wp.ccf.mixins.subViewable)),wp.ccf.views.SubmissionRow=wp.ccf.views.SubmissionRow||t.View.extend({tagName:"tr",template:i.template(document.getElementById("ccf-submission-row-template").innerHTML),events:{"click .view":"view","click .delete":"delete"},initialize:function(e){this.parent=e.parent},"delete":function(){var e,t=this,i=t.parent.collection.state.currentPage;t.model.destroy().done(function(){e=i,e===t.parent.collection.state.totalPages&&e-1===(t.parent.collection.state.totalObjects-1)/l.postsPerPage&&e--,t.parent.showPage(e).done(function(){t.parent.renderPagination()})})},view:function(e){var t=e.currentTarget.getAttribute("data-submission-id"),i=e.currentTarget.getAttribute("data-submission-date");tb_show(l.thickboxTitle+" - "+wp.ccf.utils.getPrettyPostDate(i),"#TB_inline?height=500&width=700&inlineId=ccf-submission-content-"+parseInt(t),null)},render:function(){return this.$el.html(this.template({submission:this.model.toJSON(),currentColumns:this.parent.columns,columns:wp.ccf.currentForm.getFieldSlugs(!0),utils:{getPrettyPostDate:wp.ccf.utils.getPrettyPostDate,wordChop:wp.ccf.utils.wordChop,isFieldDate:wp.ccf.utils.isFieldDate,isFieldName:wp.ccf.utils.isFieldName,isFieldAddress:wp.ccf.utils.isFieldAddress,getPrettyFieldDate:wp.ccf.utils.getPrettyFieldDate,getPrettyFieldAddress:wp.ccf.utils.getPrettyFieldAddress,getPrettyFieldName:wp.ccf.utils.getPrettyFieldName}})),this}}),wp.ccf.views.SubmissionsTable=wp.ccf.views.SubmissionsTable||t.View.extend({template:i.template(document.getElementById("ccf-submission-table-template").innerHTML),events:{"click .prev:not(.disabled)":"previousPage","click .next:not(.disabled)":"nextPage","click .first:not(.disabled)":"firstPage","click .last:not(.disabled)":"lastPage"},initialize:function(){this.collection=new wp.ccf.collections.Submissions({},{formId:l.postId}),wp.ccf.dispatcher.on("submissionTableRebuild",this.render,this)},showPage:function(e){var t=this,i=this.collection.fetch({data:{page:e}});return i.done(function(){var e=t.el.querySelectorAll(".submission-rows")[0],i=document.createElement("tbody");i.className="submission-rows",t.collection.length>=1?t.collection.each(function(e){var l=new wp.ccf.views.SubmissionRow({model:e,parent:t}).render();i.appendChild(l.el)},t):i.appendChild(new wp.ccf.views.EmptySubmissionTableRow({parent:t}).render(wp.ccf.currentForm.getFieldSlugs(!0).concat("date")).el),e.parentNode.replaceChild(i,e)}),i},renderPagination:function(){var e=this.el.querySelectorAll(".ccf-pagination")[0];e.innerHTML="",this.collection.state.totalPages>1&&e.appendChild(new wp.ccf.views.Pagination({parent:this}).render(this.collection.state.totalPages,this.collection.state.currentPage).el)},render:function(e){var t=this;return t.columns=e?e:wp.ccf.currentForm.getFieldSlugs(!0).slice(0,4).concat("date"),1>t.columns.length?t.el.innerHTML="":(t.el.innerHTML=t.template({columns:t.columns}),t.el.querySelectorAll(".ccf-pagination")[0],t.showPage(1).done(function(){t.renderPagination()})),t}}),wp.ccf.views.Pagination=wp.ccf.views.Pagination||t.View.extend({template:i.template(document.getElementById("ccf-pagination-template").innerHTML),events:{"click .prev:not(.disabled)":"previousPage","click .next:not(.disabled)":"nextPage","click .first:not(.disabled)":"firstPage","click .last:not(.disabled)":"lastPage"},initialize:function(e){this.parent=e.parent},previousPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.currentPage-1).done(function(){e.render()})},nextPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.currentPage+1).done(function(){e.render()})},firstPage:function(){var e=this;e.parent.showPage(1).done(function(){e.render()})},lastPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.totalPages).done(function(){e.render()})},render:function(){return this.el.innerHTML=this.template({totalPages:this.parent.collection.state.totalPages,currentPage:this.parent.collection.state.currentPage,totalObjects:this.parent.collection.state.totalObjects}),this}}),wp.ccf.views.EmptySubmissionTableRow=wp.ccf.views.EmptySubmissionTableRow||t.View.extend({tagName:"tr",template:i.template(document.getElementById("ccf-no-submissions-row-template").innerHTML),initialize:function(e){this.parent=e.parent},render:function(){return this.el.innerHTML=this.template({columns:this.parent.columns}),this}}),wp.ccf.views.SubmissionColumnController=wp.ccf.views.SubmissionColumnController||t.View.extend({template:i.template(document.getElementById("ccf-submissions-controller-template").innerHTML),events:{"click input[type=checkbox]":"triggerTableRebuild"},render:function(){this.el.innerHTML=this.template({columns:wp.ccf.currentForm.getFieldSlugs(!0).concat("date")})},triggerTableRebuild:function(){var e=[],t=document.querySelectorAll(".submission-column-checkbox");if(t.length>=1)for(var i=0;t.length>i;i++)t[i].checked&&e.push(t[i].value);wp.ccf.dispatcher.trigger("submissionTableRebuild",e)}})}(jQuery,Backbone,_,ccfSettings),function(e,t){"use strict";wp.ccf.router=wp.ccf.router||t.Router.extend({routes:{"ccf-form":"open","ccf-form/:formId":"open"},open:function(e){wp.ccf.show(e)}})}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l){"use strict";wp.ccf=i.defaults(wp.ccf,{forms:new wp.ccf.collections.Forms,currentForm:null,_currentFormDeferred:null,dispatcher:{},show:function(e){return this.switchToForm(e),this.instance.show(),this.instance},switchToForm:function(e){var t=this;if(+e===parseInt(e)){var i=parseInt(e);if(e=t.forms.findWhere({ID:parseInt(i)}),!e){var l;return t.forms.formsFetching[i]!==void 0?(l=t.forms.formsFetching[i],e=null):(e=new wp.ccf.models.Form({ID:i}),l=e.fetch(),t.forms.formsFetching[i]=l),l.done(function(){e?(delete t.forms.formsFetching[i],t.forms.add(e)):e=t.forms.findWhere({ID:i}),t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane")}),l}t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane")}else t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane");return!0},hide:function(){return this.instance.hide(),this.instance},toggle:function(e){return this.switchToForm(e),this.instance.$el.is(":visible")?this.instance.hide():this.instance.show(),this.instance},createSubmissionsTable:function(e){var t=document.querySelectorAll(".ccf-submission-column-controller"),i=new wp.ccf.views.SubmissionsTable({el:e});i.render(),t&&new wp.ccf.views.SubmissionColumnController({el:t}).render()},_setupMainModal:function(e){return this.instance=(new wp.ccf.views.MainModal).render(e),document.getElementsByTagName("body")[0].appendChild(this.instance.el),t.history.start(),this.instance},createManager:function(){var s=this;i.extend(this.dispatcher,t.Events),new wp.ccf.router;var c=!1,n=document.querySelectorAll(".ccf-open-form-manager")[0];if(l.single)if(c=!0,l.postId){var r=parseInt(l.postId);if(s.forms.formsFetching[r]===void 0){var o=new wp.ccf.models.Form({ID:r}),a=o.fetch();s.forms.formsFetching[r]=a,s._currentFormDeferred=a,a.done(function(){delete s.forms.formsFetching[r],s.forms.add(o),s.currentForm=o})}else s._currentFormDeferred=s.forms.formsFetching[r],s._currentFormDeferred.done(function(){s.currentForm=s.forms.findWhere({ID:r})});e.when(s._currentFormDeferred).then(function(){s._setupMainModal(!0),n.style.display="inline-block";var e=document.getElementById("ccf-submissions");if(e){var t=e.querySelectorAll(".inside")[0],i=document.createElement("div");i.className="ccf-submission-settings",i.setAttribute("data-icon","");var l=document.getElementById("show-settings-link");i.onclick=function(){l.click()},e.insertBefore(i,e.firstChild.nextSibling.nextSibling),wp.ccf.createSubmissionsTable(t)}})}else s._setupMainModal(!0),n.style.display="inline-block";else s._setupMainModal();var d=function(e){e=e||window.event;var t=e.currentTarget?e.currentTarget:e.srcElement,i=t.getAttribute("data-form-id");wp.ccf.toggle(i)};n.addEventListener?n.addEventListener("click",d,!1):n.attachEvent("onclick",d)}}),wp.ccf.createManager()}(jQuery,Backbone,_,ccfSettings);
|
1 |
+
(function(e,t,i,l){"use strict";window.wp=window.wp||{},wp.ccf=wp.ccf||{},wp.ccf.utils=wp.ccf.utils||{},wp.ccf.utils.cleanDateFields=function(e){delete e.date,delete e.date_gmt,delete e.modified,delete e.modified_gmt,delete e.date_tz,delete e.modified_tz},wp.ccf.utils.template=function(e){var t={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g};return i.template(e,null,t)},wp.ccf.utils.insertFormShortcode=function(e){var t=wp.ccf.forms.findWhere({ID:e.get("ID")});t||wp.ccf.forms.add(e);var i=tinymce.get(wpActiveEditor),l='[ccf_form id="'+e.get("ID")+'"]';i&&!i.isHidden()?tinymce.activeEditor.execCommand("mceInsertContent",!1,l):document.getElementById(wpActiveEditor).value+=l},wp.ccf.utils.getPrettyPostDate=function(e){return e=moment(e),e.format("h:mm a M/D/YYYY")},wp.ccf.utils.wordChop=function(e,t){var i=e.substr(0,t);return i.substr(0,Math.min(i.length,i.lastIndexOf(" "))),i.length<e.length&&(i+="..."),i},wp.ccf.utils.isFieldDate=function(e){return e.date!==void 0||e.hour!==void 0&&e.minute!==void 0&&e["am-pm"]!==void 0?!0:!1},wp.ccf.utils.isFieldName=function(e){return e.name!==void 0||e.last!==void 0?!0:!1},wp.ccf.utils.isFieldAddress=function(e){return e.street!==void 0&&e.city!==void 0&&e.zipcode!==void 0&&e.line_two!==void 0?!0:!1},wp.ccf.utils.getPrettyFieldDate=function(e){var t="",i="";if(e.hour&&e.minute&&e["am-pm"]&&(t+=e.hour+":"+e.minute+" "+e["am-pm"]),e.date&&(t+=" "+e.date),!t)return"-";var s=moment(t);return s.isValid()?(e.hour&&e.minute&&e["am-pm"]&&(i+=s.format("h:mm a")),e.date&&(i&&(i+=" "),i+=s.format("M/D/YYYY")),i):l.invalidDate},wp.ccf.utils.getPrettyFieldName=function(e){var t=e.first;return t.length>0&&(t+=" "),e.last&&(t+=e.last),t||(t="-"),t},wp.ccf.utils.getPrettyFieldAddress=function(e){if(!e.street||!e.city)return"-";var t=e.street;return e.line_two&&(t+=" "+e.line_two),t+=", "+e.city,e.state&&(t+=", "+e.state),e.zipcode&&(t+=" "+e.zipcode),e.country&&(t+=" "+e.country),t}})(jQuery,Backbone,_,ccfSettings),function(e,t,i){"use strict";wp.ccf.mixins=wp.ccf.mixins||{},wp.ccf.mixins.subViewable=wp.ccf.mixins.subViewable||{subViews:{},initRenderSubViews:function(e,t,l){this.renderedSubViews||(this.renderedSubViews={});for(var s in this.subViews){var c={el:this.$el.find(".ccf-"+s),parent:this};l&&i.extend(c,l),this.renderedSubViews[s]&&this.renderedSubViews[s].destroy&&this.renderedSubViews[s].destroy(),(t||!this.renderedSubViews[s])&&(this.renderedSubViews[s]=new this.subViews[s](c)),this.renderedSubViews[s].render(),e&&(this.renderedSubViews[s].el.style.display="block")}return this},showView:function(e,t,i){if(this.renderedSubViews!==void 0&&this.renderedSubViews[e]!==void 0){var l=this.renderedSubViews[e];i||l.render(t),l.el.style.display="block",this.currentView=e;for(var s in this.subViews)s!==e&&(this.renderedSubViews[s].el.style.display="none")}}}}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l,s){"use strict";wp.ccf.models=wp.ccf.models||{},wp.ccf.models.Fields=wp.ccf.models.Fields||{};var c=function(e,i,l){return"object"!=typeof i&&""===i&&(i=""),t.Model.prototype.set.call(this,e,i,l)},n=function(e){for(var t in this.attributes)if(-1===e.indexOf(t)){var i=this.get(t);"string"==typeof i&&""!==i&&(i=(i+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/“/g,"”").replace(/”/g,"”").replace(/‘/g,"‘").replace(/'/g,"'"),this.set(t,i))}return this};wp.ccf.models.FieldChoice=wp.ccf.models.FieldChoice||t.Model.extend({defaults:{label:"",value:"",selected:!1},decode:function(){return n.call(this,[])},set:c}),wp.ccf.models.Form=wp.ccf.models.Form||wp.api.models.Post.extend({urlRoot:s.root+"/ccf/forms",set:c,initialize:function(){this.on("sync",this.decode,this)},defaults:function(){var e={fields:new wp.ccf.collections.Fields,type:"ccf_form",status:"publish",description:"",buttonText:"Submit Form",completionActionType:"text",completionRedirectUrl:"",completionMessage:"",sendEmailNotifications:!1,emailNotificationAddresses:l.adminEmail,emailNotificationFromType:"default",emailNotificationFromAddress:"",emailNotificationFromField:""};return e=i.defaults(e,this.constructor.__super__.defaults),wp.ccf.utils.cleanDateFields(e),e},decode:function(){var e=i.keys(wp.api.models.Post.prototype.defaults);return e=i.without(e,"title"),n.call(this,e)},getFieldSlugs:function(e){var t=wp.ccf.currentForm.get("fields"),i=[];return t.each(function(t){e&&t.isImmutable||i.push(t.get("slug"))}),i},parse:function(e){var t=this;if(e.fields){var l=t.get("fields");if(l&&l.length>0){for(var s=0;e.fields.length>s;s++){var c=e.fields[s],n=l.findWhere({slug:c.slug});if(n){if(c.choices!==void 0){var r=t.get("choices");if(r&&r.length>0)for(var o=0;c.choices>o;o++){var a=r.at(o);a.set(c.choices[o]),a.decode()}delete e.fields[s].choices}n.set(c),n.decode()}}delete e.fields}else{var d=[];i.each(e.fields,function(e){var t=new wp.ccf.models.Fields[e.type](e);t.decode(),d.push(t)}),e.fields=new wp.ccf.collections.Fields(d,{formId:e.ID})}}return this.constructor.__super__.parse.call(this,e)},toJSON:function(){var e=this.constructor.__super__.toJSON.call(this);return e.fields&&(e.fields=e.fields.toJSON()),e.author&&(e.author=e.author.toJSON()),e}}),wp.ccf.models.Submission=wp.api.models.Submission||wp.api.models.Post.extend({idAttribute:"ID",defaults:{ID:null,data:{}}}),wp.ccf.models.Field=wp.api.models.Field||wp.api.models.Post.extend({idAttribute:"ID",defaults:{ID:null},set:c,required:function(){return["slug"]},decode:function(){return n.call(this,i.keys(wp.api.models.Post.prototype.defaults))},hasRequiredAttributes:function(){var e=this,t=!0;return i.each(this.required(),function(i){(e.get(i)===void 0||""===e.get(i))&&(t=!1)}),t}}),wp.ccf.models.StandardField=wp.ccf.models.StandardField||wp.ccf.models.Field.extend({idAttribute:"ID",defaults:function(){var e={label:"Field Label",value:"",placeholder:"",slug:"",type:"",required:!1,className:""};return i.defaults(e,this.constructor.__super__.defaults)}}),wp.ccf.models.Fields["single-line-text"]=wp.ccf.models.Fields["single-line-text"]||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"single-line-text"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields["paragraph-text"]=wp.ccf.models.Fields["paragraph-text"]||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"paragraph-text"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.hidden=wp.ccf.models.Fields.hidden||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"hidden"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.email=wp.ccf.models.Fields.email||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"email",emailConfirmation:!1};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.website=wp.ccf.models.Fields.website||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"website"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.phone=wp.ccf.models.Fields.phone||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"phone",phoneFormat:"us"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.date=wp.ccf.models.Fields.date||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"date",showDate:!0,showTime:!0};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.name=wp.ccf.models.Fields.name||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"name"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.recaptcha=wp.ccf.models.Fields.recaptcha||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"recaptcha",siteKey:"",secretKey:""};return i.defaults(e,this.constructor.__super__.defaults())},required:function(){return["siteKey","secretKey"]},isImmutable:!0}),wp.ccf.models.Fields.address=wp.ccf.models.Fields.address||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"address",addressType:"us"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields["section-header"]=wp.ccf.models.Fields["section-header"]||wp.ccf.models.Field.extend({defaults:function(){var e={type:"section-header",slug:"",heading:"",subheading:"",className:""};return i.defaults(e,this.constructor.__super__.defaults)},required:function(){return[]},isImmutable:!0}),wp.ccf.models.Fields.html=wp.ccf.models.Fields.html||wp.ccf.models.Field.extend({defaults:function(){var e={type:"html",slug:"",html:"",className:""};return i.defaults(e,this.constructor.__super__.defaults)},required:function(){return[]},isImmutable:!0}),wp.ccf.models.ChoiceableField=wp.ccf.models.ChoiceableField||wp.ccf.models.StandardField.extend({defaults:function(){var e={choices:new wp.ccf.collections.FieldChoices};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(e){if("object"==typeof e&&e.choices){var t=[];i.each(e.choices,function(e){var i=new wp.ccf.models.FieldChoice(e);i.decode(),t.push(i)}),this.set("choices",new wp.ccf.collections.FieldChoices(t))}}}),wp.ccf.models.Fields.radio=wp.ccf.models.Fields.radio||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"radio"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}}),wp.ccf.models.Fields.checkboxes=wp.ccf.models.Fields.checkboxes||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"checkboxes"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}}),wp.ccf.models.Fields.dropdown=wp.ccf.models.Fields.dropdown||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"dropdown"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}})}(jQuery,Backbone,_,ccfSettings,WP_API_Settings),function(e,t,i){"use strict";wp.ccf.collections=wp.ccf.collections||{},wp.ccf.collections.Forms=wp.ccf.collections.Forms||wp.api.collections.Posts.extend({model:wp.ccf.models.Form,url:WP_API_Settings.root+"/ccf/forms",formsFetching:{},initialize:function(){this.constructor.__super__.initialize(),this.formsFetching={}},remove:function(e,t){t=t||{};var l=this.constructor.__super__.remove.call(this,e,t);return t.destroy&&(e instanceof Array?i.each(e,function(e){e.destroy()}):e.destroy()),l}}),wp.ccf.collections.Fields=wp.ccf.collections.Fields||wp.api.collections.Posts.extend({model:wp.ccf.models.Field,url:function(){return WP_API_Settings.root+"/ccf/forms/"+this.formId+"/fields"},initialize:function(e,t){t&&t.formId&&(this.formId=t.formId)}}),wp.ccf.collections.Submissions=wp.ccf.collections.Submissions||wp.api.collections.Posts.extend({model:wp.ccf.models.Submission,url:function(){return WP_API_Settings.root+"/ccf/forms/"+this.formId+"/submissions"},initialize:function(e,t){this.constructor.__super__.initialize.apply(this,arguments),t&&t.formId&&(this.formId=t.formId)}}),wp.ccf.collections.FieldChoices=wp.ccf.collections.FieldChoices||t.Collection.extend({model:wp.ccf.models.FieldChoice})}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l){"use strict";wp.ccf.views=wp.ccf.views||{},wp.ccf.views.Fields=wp.ccf.views.Fields||{},wp.ccf.views.FieldChoice=t.View.extend({template:wp.ccf.utils.template(document.getElementById("ccf-field-choice-template").innerHTML),className:"choice",events:{"click .add":"triggerAdd","click .delete":"triggerDelete","blur input":"saveChoice",saveChoice:"saveChoice",sorted:"triggerUpdateSort"},initialize:function(e){this.field=e.field},destroy:function(){wp.ccf.dispatcher.off("mainViewChange",this.saveChoice),this.unbind()},triggerUpdateSort:function(e,t){this.field.get("choices").remove(this.model,{silent:!0}),this.field.get("choices").add(this.model,{at:t,silent:!0})},saveChoice:function(){if(""!==this.el.innerHTML){var e=this.el.querySelectorAll(".choice-label")[0].value,t=this.el.querySelectorAll(".choice-value")[0].value;this.model.set("label",e),this.model.set("value",t);var i=this.el.querySelectorAll(".choice-selected")[0],l=i.checked?!0:!1;return this.model.set("selected",l),this}},render:function(){var e={};return this.model&&(e.choice=this.model.toJSON()),this.el.innerHTML=this.template(e),wp.ccf.dispatcher.on("mainViewChange",this.saveChoice,this),this},triggerAdd:function(){this.field.get("choices").add(new wp.ccf.models.FieldChoice)},triggerDelete:function(){var e=this.field.get("choices");if(e.length>1)e.remove(this.model),this.destroy(),this.remove();else{for(var t=this.el.querySelectorAll(".choice-label, .choice-value"),i=this.el.querySelectorAll(".choice-selected"),l=0;t.length>l;l++)t[l].value="";i[0].checked=!1}}}),wp.ccf.views.FieldBase=wp.ccf.views.FieldBase||t.View.extend({events:{"blur input":"saveField","blur input.field-slug":"checkSlug","blur textarea":"saveField","change select":"saveField",'change input[type="checkbox"]':"saveField"},checkSlug:function(){var e=this.el.querySelectorAll(".field-slug");if(e.length>0){var t=e[0],i=!1;t.parentNode.className=t.value&&!t.value.match(/^[a-zA-Z0-9\-_]+$/)?t.parentNode.className.replace(/ field-error/i,"")+" field-error":t.parentNode.className.replace(/ field-error/i,""),this.collection.length>0&&""!==t.value?(this.collection.each(function(e){e!==this.model&&t.value===e.get("slug")&&(i=!0)},this),t.parentNode.className=i?t.parentNode.className.replace(/ field-duplicate-slug/i,"")+" field-duplicate-slug":t.parentNode.className.replace(/ field-duplicate-slug/i,"")):t.parentNode.className=t.parentNode.className.replace(/ field-duplicate-slug/i,"")}},destroy:function(){this.unbind()},render:function(){return this.el.innerHTML=this.template({field:this.model.toJSON()}),this.checkSlug(),this}}),wp.ccf.views.Fields["single-line-text"]=wp.ccf.views.Fields["single-line-text"]||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-single-line-text-template").innerHTML),initialize:function(){},saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.recaptcha=wp.ccf.views.Fields.recaptcha||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-recaptcha-template").innerHTML),initialize:function(){},saveField:function(){return this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("siteKey",this.el.querySelectorAll(".field-site-key")[0].value),this.model.set("secretKey",this.el.querySelectorAll(".field-secret-key")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this}}),wp.ccf.views.Fields["section-header"]=wp.ccf.views.Fields["section-header"]||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-section-header-template").innerHTML),initialize:function(){},saveField:function(){return this.model.set("heading",this.el.querySelectorAll(".field-heading")[0].value),this.model.set("subheading",this.el.querySelectorAll(".field-subheading")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this}}),wp.ccf.views.Fields.html=wp.ccf.views.Fields.html||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-html-template").innerHTML),initialize:function(){},saveField:function(){return this.model.set("html",this.el.querySelectorAll(".field-html")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this}}),wp.ccf.views.Fields["paragraph-text"]=wp.ccf.views.Fields["paragraph-text"]||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-paragraph-text-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.hidden=wp.ccf.views.Fields.hidden||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-hidden-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this}}),wp.ccf.views.Fields.date=wp.ccf.views.Fields.date||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-date-template").innerHTML),saveField:function(){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value);var e=this.el.querySelectorAll(".field-value");e.length>0&&this.model.set("value",e[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("showDate",this.el.querySelectorAll(".field-show-date")[0].checked?!0:!1);var t=this.model.get("showTime"),i=this.el.querySelectorAll(".field-show-time")[0].checked?!0:!1;return this.model.set("showTime",i),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),i!=t&&this.render(),this}}),wp.ccf.views.Fields.name=wp.ccf.views.Fields.name||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-name-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.website=wp.ccf.views.Fields.website||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-website-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.phone=wp.ccf.views.Fields.phone||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-phone-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("phoneFormat",this.el.querySelectorAll(".field-phone-format")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.address=wp.ccf.views.Fields.address||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-address-template").innerHTML),saveField:function(){return this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("addressType",this.el.querySelectorAll(".field-address-type")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this}}),wp.ccf.views.Fields.email=wp.ccf.views.Fields.email||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-email-template").innerHTML),saveField:function(){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value);var e=this.el.querySelectorAll(".field-value");e.length&&this.model.set("value",e[0].value);var t=this.el.querySelectorAll(".field-placeholder");t.length&&this.model.set("placeholder",t[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1);var i=1==this.el.querySelectorAll(".field-email-confirmation")[0].value?!0:!1,l=this.model.get("emailConfirmation");return this.model.set("emailConfirmation",i),l!=i&&this.render(),this}}),wp.ccf.views.ChoiceableField=wp.ccf.views.ChoiceableField||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template(document.getElementById("ccf-dropdown-template").innerHTML),initialize:function(){var e=this.model.get("choices");this.listenTo(e,"add",this.addChoice)},addChoice:function(e){var t=new wp.ccf.views.FieldChoice({model:e,field:this.model}).render(),i=this.el.querySelectorAll(".repeatable-choices")[0];i.appendChild(t.el)},saveField:function(){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1);var t=this.el.querySelectorAll(".repeatable-choices")[0].querySelectorAll(".choice");return i.each(t,function(t){e(t).trigger("saveChoice")}),this},render:function(){var t=this;t.el.innerHTML=t.template({field:t.model.toJSON()}),t.checkSlug();var i=t.model.get("choices"),l=this.el.querySelectorAll(".repeatable-choices")[0];if(i.length>=1)i.each(function(e){var i=new wp.ccf.views.FieldChoice({model:e,field:t.model}).render();l.appendChild(i.el)});else{var s=new wp.ccf.models.FieldChoice;i.add(s)}return l=this.el.querySelectorAll(".repeatable-choices")[0],e(l).sortable({handle:".move",axis:"y",stop:function(e,t){t.item.trigger("sorted",t.item.index())}}),t}}),wp.ccf.views.Fields.dropdown=wp.ccf.views.Fields.dropdown||wp.ccf.views.ChoiceableField.extend({template:wp.ccf.utils.template(document.getElementById("ccf-dropdown-template").innerHTML),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.Fields.radio=wp.ccf.views.Fields.radio||wp.ccf.views.ChoiceableField.extend({template:wp.ccf.utils.template(document.getElementById("ccf-radio-template").innerHTML),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.Fields.checkboxes=wp.ccf.views.Fields.checkboxes||wp.ccf.views.ChoiceableField.extend({template:wp.ccf.utils.template(document.getElementById("ccf-checkboxes-template").innerHTML),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.FieldSidebar=wp.ccf.views.FieldSidebar||t.View.extend({initialize:function(e){this.currentFieldView=null,this.form=e.form},save:function(e){this.currentFieldView&&""!==this.currentFieldView.el.innerHTML&&this.currentFieldView.saveField(),e&&e instanceof Object&&e.resolve()},fieldRemoved:function(){this.currentFieldView&&(this.form.get("fields").get(this.currentFieldView.model)||this.render())},destroy:function(){wp.ccf.dispatcher.off("saveField",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save),this.unbind()},render:function(e){var t={};if(e){var i=e.get("type");this.currentFieldView&&(this.currentFieldView.saveField(),this.currentFieldView.destroy&&this.currentFieldView.destroy()),this.currentFieldView=new wp.ccf.views.Fields[i]({model:e,collection:this.form.get("fields")}),this.currentFieldView.render(),this.el.innerHTML="",this.el.appendChild(this.currentFieldView.el);var l=this.form.get("fields");this.listenTo(l,"remove",this.fieldRemoved)}else{var s=wp.ccf.utils.template(document.getElementById("ccf-empty-field-template").innerHTML);this.el.innerHTML=s(t)}return wp.ccf.dispatcher.on("saveField",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this}}),wp.ccf.views.FieldRowPlaceholder=wp.ccf.views.FieldRowPlaceholder||t.View.extend({template:wp.ccf.utils.template(document.getElementById("ccf-field-row-template").innerHTML),tagName:"div",className:"field",initialize:function(e){this.type=e.type},render:function(){return this.el.innerHTML=this.template({label:l.allLabels[this.type]}),this.el.setAttribute("data-field-type",this.type),this.el.className+=" "+this.type,this}}),wp.ccf.views.FieldRow=wp.ccf.views.FieldRow||t.View.extend({template:wp.ccf.utils.template(document.getElementById("ccf-field-row-template").innerHTML),tagName:"div",className:"field",events:{"click .delete":"triggerDelete","click h4":"triggerEdit",sorted:"triggerUpdateSort"},initialize:function(e){i.bindAll(this,"triggerDelete"),this.form=e.form,this.listenTo(this.model,"change",this.handleChange,this),this.listenTo(this.model,"requirementsNotMet",this.requirementsNotMet,this),this.listenTo(this.model,"requirementsMet",this.requirementsMet,this),this.listenTo(this.model,"duplicateSlug",this.duplicateSlug,this),this.model.attributes.choices&&this.listenTo(this.model.attributes.choices,"change",this.handleChange,this)},duplicateSlug:function(){this.requirementsMet(),this.el.className+=" field-duplicate-slug"},requirementsNotMet:function(){this.requirementsMet(),this.el.className+=" field-incomplete"},requirementsMet:function(){this.el.className=this.el.className.replace(/(field-incomplete|field-duplicate-slug)/i,"")},triggerUpdateSort:function(e,t){this.form.get("fields").remove(this.model),this.form.get("fields").add(this.model,{at:t})},handleChange:function(){this.render()},triggerDelete:function(e){e.stopPropagation(),this.form.get("fields").remove(this.model),this.undelegateEvents(),this.remove()},triggerEdit:function(){var e=this.el.parentNode.querySelectorAll(".ccf-editing");i.each(e,function(e){e.className=e.className.replace(/ccf-editing/i,"")}),this.el.className=this.el.className.replace(/ccf-editing/i,"")+" ccf-editing",wp.ccf.dispatcher.trigger("openEditField",this.model)},render:function(e){this.el.innerHTML=this.template({label:l.allLabels[this.model.get("type")]}),this.el.setAttribute("data-field-type",this.model.get("type"));var t=RegExp(" "+this.model.get("type"),"i");this.el.className=this.el.className.replace(t,"")+" "+this.model.get("type"),e&&(this.el.className=this.el.className.replace(/ instantiated/i,"")+" instantiated");var i=document.getElementById("ccf-"+this.model.get("type")+"-preview-template");if(i){var s=this.el.querySelectorAll(".preview")[0];s.style.display="block",s.innerHTML=wp.ccf.utils.template(i.innerHTML)({field:this.model.toJSON()})}return this}}),wp.ccf.views.FormSettings=wp.ccf.views.FormSettings||t.View.extend({template:wp.ccf.utils.template(document.getElementById("ccf-form-settings-template").innerHTML),events:{"blur input":"save","change select":"save","change select.form-completion-action-type":"toggleCompletionFields","change select.form-send-email-notifications":"toggleNotificationFields"},initialize:function(e){this.model=e.form},destroy:function(){wp.ccf.dispatcher.off("saveFormSettings",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save)},toggleCompletionFields:function(){var e=this.el.querySelectorAll(".form-completion-action-type")[0].value,t=this.el.querySelectorAll(".completion-message")[0],i=this.el.querySelectorAll(".completion-redirect-url")[0];"text"===e?(t.style.display="block",i.style.display="none"):(t.style.display="none",i.style.display="block")},save:function(e){if(""!==this.el.innerHTML){var t=this.el.querySelectorAll(".form-title")[0].value;this.model.set("title",t);var i=this.el.querySelectorAll(".form-description")[0].value;this.model.set("description",i);var l=this.el.querySelectorAll(".form-button-text")[0].value;this.model.set("buttonText",l);var s=this.el.querySelectorAll(".form-completion-message")[0].value;this.model.set("completionMessage",s);var c=this.el.querySelectorAll(".form-completion-redirect-url")[0].value;this.model.set("completionRedirectUrl",c);var n=this.el.querySelectorAll(".form-completion-action-type")[0].value;this.model.set("completionActionType",n),e!==void 0&&e.promise!==void 0&&e.resolve()}},render:function(){var e={form:this.model.toJSON()};return this.el.innerHTML=this.template(e),this.toggleCompletionFields(),wp.ccf.dispatcher.on("saveFormSettings",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this}}),wp.ccf.views.FormNotifications=wp.ccf.views.FormNotifications||t.View.extend({template:wp.ccf.utils.template(document.getElementById("ccf-form-notifications-template").innerHTML),events:{"blur input":"save","change select":"save","change select.form-send-email-notifications":"toggleNotificationFields","change select.form-email-notification-from-type":"toggleNotificationFields"},initialize:function(e){this.model=e.form},destroy:function(){wp.ccf.dispatcher.off("saveFormSettings",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save)},toggleNotificationFields:function(){var e,t=this.el.querySelectorAll(".form-send-email-notifications")[0].value,i=this.el.querySelectorAll(".email-notification-setting"),l=this.el.querySelectorAll(".email-notification-from-address")[0],s=this.el.querySelectorAll(".email-notification-from-field")[0],c=this.el.querySelectorAll(".form-email-notification-from-type")[0];if(parseInt(t)){for(e=0;i>e;e++)emailNotificationAddresses.style.display="block";l.style.display="none",s.style.display="none","custom"===c.value?l.style.display="block":"field"===c.value&&(s.style.display="block")}else{for(e=0;i>e;e++)emailNotificationAddresses.style.display="none";l.style.display="none",s.style.display="none"}},save:function(e){if(""!==this.el.innerHTML){var t=this.el.querySelectorAll(".form-send-email-notifications")[0].value;this.model.set("sendEmailNotifications",parseInt(t)?!0:!1);var i=this.el.querySelectorAll(".form-email-notification-addresses")[0].value;this.model.set("emailNotificationAddresses",i);var l=this.el.querySelectorAll(".form-email-notification-from-type")[0].value;this.model.set("emailNotificationFromType",l);var s=this.el.querySelectorAll(".form-email-notification-from-address")[0].value;this.model.set("emailNotificationFromAddress",s);var c=this.el.querySelectorAll(".form-email-notification-from-field")[0].value;this.model.set("emailNotificationFromField",c),e!==void 0&&e.promise!==void 0&&e.resolve()}},render:function(){var e=[],t=this.model.get("fields");t.each(function(t){"email"===t.get("type")&&e.push(t)});var i={form:this.model.toJSON(),emailFields:e};return this.el.innerHTML=this.template(i),this.toggleNotificationFields(),wp.ccf.dispatcher.on("saveFormNotifications",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this.listenTo(t,"add",this.render,this),this.listenTo(t,"remove",this.render,this),this}}),wp.ccf.views.FormPane=wp.ccf.views.FormPane||t.View.extend(i.defaults({template:wp.ccf.utils.template(document.getElementById("ccf-form-pane-template").innerHTML),subViews:{"field-sidebar":wp.ccf.views.FieldSidebar,"form-settings":wp.ccf.views.FormSettings,"form-notifications":wp.ccf.views.FormNotifications},events:{"click .save-button":"sync","click h2":"accordionClick","click .insert-form-button":"insertForm"},initialize:function(){wp.ccf.dispatcher.on("openEditField",this.openEditField,this)
|
2 |
+
},insertForm:function(){wp.ccf.utils.insertFormShortcode(this.model),wp.ccf.toggle()},accordionClick:function(t){var l=e(t.currentTarget).parents(".accordion-container")[0],s=l.querySelectorAll(".accordion-section");t.currentTarget.parentNode.className.match(/expanded/i)?t.currentTarget.parentNode.className=t.currentTarget.parentNode.className.replace(/expanded/i,""):t.currentTarget.parentNode.className+=" expanded",i.each(s,function(e){e!=t.currentTarget.parentNode&&e.className.match(/expanded/i)&&(e.className=e.className.replace(/expanded/i,""))})},openEditField:function(e){this.renderedSubViews["field-sidebar"].render(e).el.style.display="block"},disable:function(){this.el.querySelectorAll(".save-button")[0].setAttribute("disabled","disabled"),this.el.querySelectorAll(".disabled-overlay")[0].style.display="block"},enable:function(){this.el.querySelectorAll(".save-button")[0].removeAttribute("disabled"),this.el.querySelectorAll(".disabled-overlay")[0].style.display="none"},sync:function(){var t=this,i=e(this.el.querySelectorAll(".spinner")[0]);i.fadeIn(),t.disable();var s=e.Deferred(),c=e.Deferred(),n=e.Deferred();wp.ccf.dispatcher.trigger("saveFormSettings",s),wp.ccf.dispatcher.trigger("saveFormNotifications",n),wp.ccf.dispatcher.trigger("saveField",c),e.when(s,c,n).then(function(){var e=t.model.get("fields"),s=!0,c={};e.each(function(e){var t=e.get("slug");e.hasRequiredAttributes()?t&&!t.match(/^[a-zA-Z0-9\-_]+$/)?(s=!1,e.trigger("requirementsNotMet")):c[e.get("slug")]!==void 0?(s=!1,e.trigger("duplicateSlug"),c[e.get("slug")].trigger("duplicateSlug")):e.trigger("requirementsMet"):(s=!1,e.trigger("requirementsNotMet")),e.get("slug")&&(c[e.get("slug")]=e)}),s?t.model.save({},{context:"edit"}).done(function(){l.single&&!l.postId&&(window.location=l.adminUrl+"post.php?post="+t.model.get("ID")+"&action=edit#ccf-form/"+t.model.get("ID"))}).complete(function(){i.fadeOut(),t.enable(),wp.ccf.dispatcher.trigger("saveFormComplete",t.model)}):(t.enable(),i.fadeOut())})},enableDisableInsert:function(){var e=this.el.querySelectorAll(".insert-form-button")[0];this.model.get("ID")?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled")},getNextFieldOrd:function(){var e=this.model.get("fields"),t=e.length+1;return e.each(function(e){var i=e.get("slug"),l=/\-([0-9]+)$/g,s=l.exec(i);if(s&&s[1]){var c=parseInt(s[1]);c>=t&&(t=c+1)}}),t},render:function(t){var s=this;s.model=t?t:new wp.ccf.models.Form,this.listenTo(s.model,"change",this.enableDisableInsert,this);var c={labels:l.fieldLabels,form:s.model.toJSON()};window.form=s.model,s.el.innerHTML=this.template(c);var n=s.el.querySelectorAll(".fields")[0];i.each(l.fieldLabels,function(e,t){n.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)});var r=s.el.querySelectorAll(".structure-fields")[0];i.each(l.structureFieldLabels,function(e,t){r.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)});var o=s.el.querySelectorAll(".special-fields")[0];i.each(l.specialFieldLabels,function(e,t){o.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)}),e(s.el.querySelectorAll(".left-sidebar")[0].querySelectorAll(".field")).draggable({cursor:"move",zIndex:160001,scroll:!1,containment:".ccf-form-pane",appendTo:".ccf-main-modal",snap:!0,connectToSortable:".form-content",helper:function(t){var i=e(t.currentTarget),l=e('<div class="field" data-field-type="'+i.attr("data-field-type")+'"><h4>'+i.find(".label").html()+"</h4></div>");return l.css({width:i.width(),height:i.height()})}});var a=s.model.get("fields"),d=s.el.querySelectorAll(".form-content")[0];return a.length>=1&&(d.innerHTML="",a.each(function(e){var t=new wp.ccf.views.FieldRow({model:e,form:s.model}).render(!0).el;d.appendChild(t)})),e(d).sortable({axis:"y",handle:"h4",stop:function(e,t){if(!t.item.hasClass("instantiated")){var i=t.item.attr("data-field-type"),l={};wp.ccf.models.Fields[i].prototype.defaults().slug!==void 0&&(l.slug=i+"-"+s.getNextFieldOrd());var c=new wp.ccf.models.Fields[i](l),n=s.model.get("fields");n.add(c),new wp.ccf.views.FieldRow({model:c,el:t.item,form:s.model}).render(!0),t.item.attr("style","")}t.item.trigger("sorted",t.item.index())}}),s.initRenderSubViews(!0,!0,{form:s.model}),s.enableDisableInsert(),s}},wp.ccf.mixins.subViewable)),wp.ccf.views.ExistingFormTableRow=wp.ccf.views.ExistingFormTableRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template(document.getElementById("ccf-existing-form-table-row-template").innerHTML),events:{"click .edit":"triggerMainViewChange","click .delete":"triggerDelete","click .insert-form-button":"insertForm"},initialize:function(e){this.parent=e.parent},insertForm:function(){wp.ccf.utils.insertFormShortcode(this.model),wp.ccf.toggle()},triggerMainViewChange:function(){wp.ccf.switchToForm(this.model)},triggerDelete:function(){var e,t=this,i=t.parent.collection.state.currentPage;t.model.destroy().done(function(){e=i,e===t.parent.collection.state.totalPages&&e-1===(t.parent.collection.state.totalObjects-1)/l.postsPerPage&&e--,t.parent.showPage(e).done(function(){t.parent.renderPagination()})})},render:function(){return this.$el.html(this.template({form:this.model.toJSON(),utils:{getPrettyPostDate:wp.ccf.utils.getPrettyPostDate}})),this}}),wp.ccf.views.EmptyFormTableRow=wp.ccf.views.EmptyFormTableRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template(document.getElementById("ccf-empty-form-table-row-template").innerHTML),render:function(){return this.$el.html(this.template()),this}}),wp.ccf.views.ExistingFormTable=wp.ccf.views.ExistingFormTable||t.View.extend({template:wp.ccf.utils.template(document.getElementById("ccf-existing-form-table-template").innerHTML),initialize:function(){this.parent=arguments.parent,this.collection=new wp.ccf.collections.Forms,wp.ccf.dispatcher.on("changeFormTablePage",this.showPage,this),wp.ccf.dispatcher.on("saveFormComplete",this.render,this)},showPage:function(e){var t=this,i=this.collection.fetch({data:{page:e}});return i.done(function(){var e=t.el.querySelectorAll(".rows")[0],i=document.createElement("tbody");i.className="rows",t.collection.length>=1?t.collection.each(function(e){var l=new wp.ccf.views.ExistingFormTableRow({model:e,parent:t}).render();i.appendChild(l.el)},t):i.appendChild((new wp.ccf.views.EmptyFormTableRow).render().el),e.parentNode.replaceChild(i,e)}),i},renderPagination:function(){var e=this.el.querySelectorAll(".ccf-pagination")[0];e.innerHTML="",this.collection.state.totalPages>1&&e.appendChild(new wp.ccf.views.Pagination({parent:this}).render(this.collection.state.totalPages,this.collection.state.currentPage).el)},render:function(){var e=this;return this.el.innerHTML=this.template(),this.el.querySelectorAll(".ccf-pagination")[0],this.showPage(1).done(function(){e.renderPagination()}),this}}),wp.ccf.views.ExistingFormPane=wp.ccf.views.ExistingFormPane||t.View.extend(i.defaults({template:wp.ccf.utils.template(document.getElementById("ccf-existing-form-pane-template").innerHTML),subViews:{"existing-form-table":wp.ccf.views.ExistingFormTable},render:function(){return this.rendered?this:(this.rendered=!0,this.el.innerHTML=this.template(),this.initRenderSubViews(!0),this)}},wp.ccf.mixins.subViewable)),wp.ccf.views.MainModal=wp.ccf.views.MainModal||t.View.extend(i.defaults({tagName:"div",className:"ccf-main-modal",template:wp.ccf.utils.template(document.getElementById("ccf-main-modal-template").innerHTML),events:{"click .close-icon":"hide","click .main-menu a":"menuClick"},subViews:{"form-pane":wp.ccf.views.FormPane},initialize:function(){l.single||(this.subViews["existing-form-pane"]=wp.ccf.views.ExistingFormPane),wp.ccf.dispatcher.on("mainViewChange",this.toggleView,this)},toggleView:function(e){this.showView(e,wp.ccf.currentForm);var t=e;"form-pane"===e&&wp.ccf.currentForm&&(t="existing-form-pane");var l=this.el.querySelectorAll(".menu-item");i.each(l,function(e){var i=e.getAttribute("data-view");e.className=i===t?e.className.replace("selected","")+" selected":e.className.replace("selected","")})},menuClick:function(e){var t=e.target.getAttribute("data-view");"form-pane"===t&&(wp.ccf.currentForm=null),wp.ccf.dispatcher.trigger("mainViewChange",t),e.preventDefault()},render:function(e){return e=e||!1,this.overlay(),this.el.innerHTML=this.template({single:e}),this.initRenderSubViews(),this.showView("form-pane",wp.ccf.currentForm,!0),this},overlay:function(){return this.overlayEl===void 0&&(this.overlayEl=document.createElement("div"),this.overlayEl.className="ccf-main-modal-overlay",document.body.appendChild(this.overlayEl)),this.overlayEl},remove:function(){return document.body.removeChild(this.overlay()),this},show:function(){e(this.overlay()).show(),this.$el.show()},hide:function(){e(this.overlay()).hide(),this.$el.hide()}},wp.ccf.mixins.subViewable)),wp.ccf.views.SubmissionRow=wp.ccf.views.SubmissionRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template(document.getElementById("ccf-submission-row-template").innerHTML),events:{"click .view":"view","click .delete":"delete"},initialize:function(e){this.parent=e.parent},"delete":function(){var e,t=this,i=t.parent.collection.state.currentPage;t.model.destroy().done(function(){e=i,e===t.parent.collection.state.totalPages&&e-1===(t.parent.collection.state.totalObjects-1)/l.postsPerPage&&e--,t.parent.showPage(e).done(function(){t.parent.renderPagination()})})},view:function(e){var t=e.currentTarget.getAttribute("data-submission-id"),i=e.currentTarget.getAttribute("data-submission-date");tb_show(l.thickboxTitle+" - "+wp.ccf.utils.getPrettyPostDate(i),"#TB_inline?height=500&width=700&inlineId=ccf-submission-content-"+parseInt(t),null)},render:function(){return this.$el.html(this.template({submission:this.model.toJSON(),currentColumns:this.parent.columns,columns:wp.ccf.currentForm.getFieldSlugs(!0),utils:{getPrettyPostDate:wp.ccf.utils.getPrettyPostDate,wordChop:wp.ccf.utils.wordChop,isFieldDate:wp.ccf.utils.isFieldDate,isFieldName:wp.ccf.utils.isFieldName,isFieldAddress:wp.ccf.utils.isFieldAddress,getPrettyFieldDate:wp.ccf.utils.getPrettyFieldDate,getPrettyFieldAddress:wp.ccf.utils.getPrettyFieldAddress,getPrettyFieldName:wp.ccf.utils.getPrettyFieldName}})),this}}),wp.ccf.views.SubmissionsTable=wp.ccf.views.SubmissionsTable||t.View.extend({template:wp.ccf.utils.template(document.getElementById("ccf-submission-table-template").innerHTML),events:{"click .prev:not(.disabled)":"previousPage","click .next:not(.disabled)":"nextPage","click .first:not(.disabled)":"firstPage","click .last:not(.disabled)":"lastPage"},initialize:function(){this.collection=new wp.ccf.collections.Submissions({},{formId:l.postId}),wp.ccf.dispatcher.on("submissionTableRebuild",this.render,this)},showPage:function(e){var t=this,i=this.collection.fetch({data:{page:e}});return i.done(function(){var e=t.el.querySelectorAll(".submission-rows")[0],i=document.createElement("tbody");i.className="submission-rows",t.collection.length>=1?t.collection.each(function(e){var l=new wp.ccf.views.SubmissionRow({model:e,parent:t}).render();i.appendChild(l.el)},t):i.appendChild(new wp.ccf.views.EmptySubmissionTableRow({parent:t}).render(wp.ccf.currentForm.getFieldSlugs(!0).concat("date")).el),e.parentNode.replaceChild(i,e)}),i},renderPagination:function(){var e=this.el.querySelectorAll(".ccf-pagination")[0];e.innerHTML="",this.collection.state.totalPages>1&&e.appendChild(new wp.ccf.views.Pagination({parent:this}).render(this.collection.state.totalPages,this.collection.state.currentPage).el)},render:function(e){var t=this;return t.columns=e?e:wp.ccf.currentForm.getFieldSlugs(!0).slice(0,4).concat("date"),1>t.columns.length?t.el.innerHTML="":(t.el.innerHTML=t.template({columns:t.columns}),t.el.querySelectorAll(".ccf-pagination")[0],t.showPage(1).done(function(){t.renderPagination()})),t}}),wp.ccf.views.Pagination=wp.ccf.views.Pagination||t.View.extend({template:wp.ccf.utils.template(document.getElementById("ccf-pagination-template").innerHTML),events:{"click .prev:not(.disabled)":"previousPage","click .next:not(.disabled)":"nextPage","click .first:not(.disabled)":"firstPage","click .last:not(.disabled)":"lastPage"},initialize:function(e){this.parent=e.parent},previousPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.currentPage-1).done(function(){e.render()})},nextPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.currentPage+1).done(function(){e.render()})},firstPage:function(){var e=this;e.parent.showPage(1).done(function(){e.render()})},lastPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.totalPages).done(function(){e.render()})},render:function(){return this.el.innerHTML=this.template({totalPages:this.parent.collection.state.totalPages,currentPage:this.parent.collection.state.currentPage,totalObjects:this.parent.collection.state.totalObjects}),this}}),wp.ccf.views.EmptySubmissionTableRow=wp.ccf.views.EmptySubmissionTableRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template(document.getElementById("ccf-no-submissions-row-template").innerHTML),initialize:function(e){this.parent=e.parent},render:function(){return this.el.innerHTML=this.template({columns:this.parent.columns}),this}}),wp.ccf.views.SubmissionColumnController=wp.ccf.views.SubmissionColumnController||t.View.extend({template:wp.ccf.utils.template(document.getElementById("ccf-submissions-controller-template").innerHTML),events:{"click input[type=checkbox]":"triggerTableRebuild"},render:function(){this.el.innerHTML=this.template({columns:wp.ccf.currentForm.getFieldSlugs(!0).concat("date")})},triggerTableRebuild:function(){var e=[],t=document.querySelectorAll(".submission-column-checkbox");if(t.length>=1)for(var i=0;t.length>i;i++)t[i].checked&&e.push(t[i].value);wp.ccf.dispatcher.trigger("submissionTableRebuild",e)}})}(jQuery,Backbone,_,ccfSettings),function(e,t){"use strict";wp.ccf.router=wp.ccf.router||t.Router.extend({routes:{"ccf-form":"open","ccf-form/:formId":"open"},open:function(e){wp.ccf.show(e)}})}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l){"use strict";wp.ccf=i.defaults(wp.ccf,{forms:new wp.ccf.collections.Forms,currentForm:null,_currentFormDeferred:null,dispatcher:{},show:function(e){return this.switchToForm(e),this.instance.show(),this.instance},switchToForm:function(e){var t=this;if(+e===parseInt(e)){var i=parseInt(e);if(e=t.forms.findWhere({ID:parseInt(i)}),!e){var l;return t.forms.formsFetching[i]!==void 0?(l=t.forms.formsFetching[i],e=null):(e=new wp.ccf.models.Form({ID:i}),l=e.fetch(),t.forms.formsFetching[i]=l),l.done(function(){e?(delete t.forms.formsFetching[i],t.forms.add(e)):e=t.forms.findWhere({ID:i}),t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane")}),l}t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane")}else t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane");return!0},hide:function(){return this.instance.hide(),this.instance},toggle:function(e){return this.switchToForm(e),this.instance.$el.is(":visible")?this.instance.hide():this.instance.show(),this.instance},createSubmissionsTable:function(e){var t=document.querySelectorAll(".ccf-submission-column-controller"),i=new wp.ccf.views.SubmissionsTable({el:e});i.render(),t&&new wp.ccf.views.SubmissionColumnController({el:t}).render()},_setupMainModal:function(e){return this.instance=(new wp.ccf.views.MainModal).render(e),document.getElementsByTagName("body")[0].appendChild(this.instance.el),t.history.start(),this.instance},createManager:function(){var s=this;i.extend(this.dispatcher,t.Events),new wp.ccf.router;var c=!1,n=document.querySelectorAll(".ccf-open-form-manager")[0];if(l.single)if(c=!0,l.postId){var r=parseInt(l.postId);if(s.forms.formsFetching[r]===void 0){var o=new wp.ccf.models.Form({ID:r}),a=o.fetch();s.forms.formsFetching[r]=a,s._currentFormDeferred=a,a.done(function(){delete s.forms.formsFetching[r],s.forms.add(o),s.currentForm=o})}else s._currentFormDeferred=s.forms.formsFetching[r],s._currentFormDeferred.done(function(){s.currentForm=s.forms.findWhere({ID:r})});e.when(s._currentFormDeferred).then(function(){s._setupMainModal(!0),n.style.display="inline-block";var e=document.getElementById("ccf-submissions");if(e){var t=e.querySelectorAll(".inside")[0],i=document.createElement("div");i.className="ccf-submission-settings",i.setAttribute("data-icon","");var l=document.getElementById("show-settings-link");i.onclick=function(){l.click()},e.insertBefore(i,e.firstChild.nextSibling.nextSibling),wp.ccf.createSubmissionsTable(t)}})}else s._setupMainModal(!0),n.style.display="inline-block";else s._setupMainModal();var d=function(e){e=e||window.event;var t=e.currentTarget?e.currentTarget:e.srcElement,i=t.getAttribute("data-form-id");wp.ccf.toggle(i)};n.addEventListener?n.addEventListener("click",d,!1):n.attachEvent("onclick",d)}}),wp.ccf.createManager()}(jQuery,Backbone,_,ccfSettings);
|
build/js/form-mce.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(e){wp.mce.ccfForm={shortcode_data:{},forms:{},View:{template:
|
1 |
+
(function(e){wp.mce.ccfForm={shortcode_data:{},forms:{},View:{template:wp.ccf.utils.template(document.getElementById("ccf-form-mce-preview").innerHTML),type:"video",postID:document.getElementById("post_ID").value,initialize:function(e){this.shortcode=e.shortcode,wp.ccf.dispatcher.on("saveFormComplete",this.triggerRefresh,this),this.fetch()},triggerRefresh:function(e){e===wp.ccf.forms.findWhere({ID:parseInt(this.shortcode.attrs.named.id)})&&(this.renderPreviews(),this.render(!0))},fetch:function(){var e=this,t=parseInt(e.shortcode.attrs.named.id),i=wp.ccf.forms.findWhere({ID:t});i?(e.renderPreviews(),e.render(!0)):(wp.ccf.forms.formsFetching[t]!==void 0?e.formFetch=wp.ccf.forms.formsFetching[t]:(i=new wp.ccf.models.Form({ID:t}),e.formFetch=i.fetch(),wp.ccf.forms.formsFetching[t]=e.formFetch),e.formFetch.complete(function(){"resolved"===e.formFetch.state()&&i!==void 0&&(wp.ccf.forms.add(i),delete wp.ccf.forms.formsFetching[t]),e.renderPreviews(),e.render(!0)}))},renderPreviews:function(){var e=parseInt(this.shortcode.attrs.named.id),t=wp.ccf.forms.findWhere({ID:e});if(t){var i=t.get("fields");i.each(function(e){var t=document.getElementById("ccf-"+e.get("type")+"-preview-template");if(t){var i=wp.ccf.utils.template(t.innerHTML)({field:e.toJSON(),mce:!0});e.set("preview",i)}})}},getHtml:function(){var e=parseInt(this.shortcode.attrs.named.id);if(this.formFetch===void 0||"resolved"===this.formFetch.state()||"rejected"===this.formFetch.state()){var t=wp.ccf.forms.findWhere({ID:e});return this.formFetch===void 0?this.template({form:t.toJSON()}):"resolved"===this.formFetch.state()?this.template({form:t.toJSON()}):wp.ccf.utils.template(document.getElementById("ccf-form-mce-error-preview").innerHTML)()}return!1}},edit:function(t){var i=window.decodeURIComponent(e(t).attr("data-wpview-text")),l=i.replace(/^.*id=('|")([0-9]+)('|").*$/i,"$2"),s=wp.ccf.forms.findWhere({ID:parseInt(l)});return s?(wp.ccf.show(s),void 0):!1}},wp.mce.views.register("ccf_form",wp.mce.ccfForm)})(jQuery);
|
build/js/form.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(e,t){"use strict";window.wp=window.wp||{},wp.ccf=wp.ccf||{},wp.ccf.validators=wp.ccf.validators||{};var i={};window.ccfRecaptchaOnload=function(){for(var e=document.querySelectorAll(".ccf-recaptcha-wrapper"),l=function(l){grecaptcha.render(e[s],{sitekey:e[s].getAttribute("data-sitekey"),theme:t.recaptcha_theme,callback:function(){i[l]=!0}})},s=0;e.length>s;s++){var r=e[s].getAttribute("data-form-id");l(r)}};var l=function(e){if(this.wrapper=e,this.errors={},e.className.match(" field-required")){this.inputs=this.wrapper.querySelectorAll(".field-input");var i=this.wrapper.querySelectorAll(".error");i.length&&i[0].parentNode.removeChild(i[0]);var l=!1;if(_.each(this.inputs,function(e){(e.checked||e.selected)&&(l=!0)}),!l){this.errors.required=!0;var s=document.createElement("div");s.className="error required-error",s.innerHTML=t.required,e.appendChild(s)}}},s=function(e,i){return function(l){this.wrapper=l,this.inputs=this.wrapper.querySelectorAll(".field-input"),this.errors={};for(var s=this.wrapper.querySelectorAll(".error"),r=s.length-1;r>=0;r--)s[r].parentNode.removeChild(s[r]);_.each(this.inputs,function(t){var i=t.getAttribute("name");this.errors[i]={},t.getAttribute("aria-required")&&""===t.value&&(this.errors[i].required=t),e&&e.call(this,t)},this),i&&i.call(this);var c;for(var n in this.errors)if(this.errors.hasOwnProperty(n))for(var o in this.errors[n])c=document.createElement("div"),c.className="error "+o+"-error",c.setAttribute("data-field-name",n),c.innerHTML=t[o],this.errors[n][o].parentNode.insertBefore(c,this.errors[n][o].nextSibling)}};wp.ccf.validators["single-line-text"]=wp.ccf.validators["single-line-text"]||s(),wp.ccf.validators["paragraph-text"]=wp.ccf.validators["paragraph-text"]||s(),wp.ccf.validators.name=wp.ccf.validators.name||s(),wp.ccf.validators.email=wp.ccf.validators.email||s(!1,function(){var e=this.inputs[0].value;if(e){2===this.inputs.length&&e!==this.inputs[1].value&&(this.errors[this.inputs[0].getAttribute("name")].match=this.wrapper.lastChild);var t=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;t.test(e)||(this.errors[this.inputs[0].getAttribute("name")].email=this.wrapper.lastChild)}}),wp.ccf.validators.recaptcha=wp.ccf.validators.recaptcha||function(e,l){this.wrapper=e,this.inputs=this.wrapper.querySelectorAll(".g-recaptcha-response"),this.errors={};for(var s=this.wrapper.querySelectorAll(".error"),r=s.length-1;r>=0;r--)s[r].parentNode.removeChild(s[r]);i[l]||(this.errors["g-recaptcha-response"]={},this.errors["g-recaptcha-response"].recaptcha=this.wrapper.lastChild);var c;for(var n in this.errors)if(this.errors.hasOwnProperty(n))for(var o in this.errors[n])c=document.createElement("div"),c.className="error "+o+"-error",c.setAttribute("data-field-name",n),c.innerHTML=t[o],this.errors[n][o].parentNode.insertBefore(c,this.errors[n][o].nextSibling)},wp.ccf.validators.phone=wp.ccf.validators.phone||s(!1,function(){var e=this.inputs[0].value;if(e){var t=/^[0-9+.)(\-]+$/;if(t.test(e)){if("us"===this.wrapper.getAttribute("data-phone-format")){var i=e.replace(/[^0-9]/,"");10!==i.length&&(this.errors[this.inputs[0].getAttribute("name")].digits=this.wrapper.lastChild)}}else this.errors[this.inputs[0].getAttribute("name")].phone=this.wrapper.lastChild}}),wp.ccf.validators.date=wp.ccf.validators.date||function(e){this.wrapper=e,this.errors={},this.inputs=this.wrapper.querySelectorAll(".field-input");for(var i=this.wrapper.querySelectorAll(".error"),l=i.length-1;l>=0;l--)i[l].parentNode.removeChild(i[l]);var s;_.each(this.inputs,function(i){var l=i.getAttribute("name");if(this.errors[l]={},i.getAttribute("aria-required")&&""===i.value&&(this.errors[l].required=!0,s=document.createElement("div"),s.className="error required-error",1===this.inputs.length?(s.innerHTML=t.required,s.className+=" right-error",i.parentNode.insertBefore(s,i.nextSibling)):(s.innerHTML=t[l.replace(/.*\[(.*?)\]/i,"$1")+"_required"],e.appendChild(s))),""!==i.value){var r=l.replace(/^.*\[(.*?)\]$/,"$1");"date"===r?i.value.match(/^([0-9]|\/)+$/)||(s=document.createElement("div"),s.className="error date-error",s.innerHTML=t.date,e.appendChild(s)):"hour"===r?i.value.match(/^[0-9]+$/)||(s=document.createElement("div"),s.className="error hour-error",s.innerHTML=t.hour,e.appendChild(s)):"minute"===r&&(i.value.match(/^[0-9]+$/)||(s=document.createElement("div"),s.className="error minute-error",s.innerHTML=t.minute,e.appendChild(s)))}},this)},wp.ccf.validators.address=wp.ccf.validators.address||s(),wp.ccf.validators.website=wp.ccf.validators.website||s(function(e){if(e.value){var t=/^http(s?)\:\/\/(([a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+)+)|localhost)(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?([\d\w\.\/\%\+\-\=\&\?\:\\\"\'\,\|\~\;]*)$/;t.test(e.value)||(this.errors[e.getAttribute("name")].website=e)}}),wp.ccf.validators.checkboxes=wp.ccf.validators.checkboxes||l,wp.ccf.validators.dropdown=wp.ccf.validators.dropdown||s(),wp.ccf.validators.radio=wp.ccf.validators.radio||l,e(document).ready(function(){for(var l=document.querySelectorAll(".ccf-datepicker"),s=0;l.length>s;s++)e(l[s]).datepicker();var r=document.querySelectorAll(".ccf-form-wrapper");r.length>=1&&_.each(r,function(l){var s=parseInt(l.getAttribute("data-form-id")),r=function(r){r.returnFalse=!1,r.preventDefault&&r.preventDefault();var c=l.querySelectorAll(".field"),n=[];if(_.each(c,function(e){if(!e.className.match(/ skip-field/i)){var t=e.getAttribute("data-field-type"),i=new wp.ccf.validators[t](e,s);if(_.size(i.errors)){var l=0;for(var r in i.errors)i.errors.hasOwnProperty(r)&&_.size(i.errors[r])&&l++;l>0&&n.push(i)}}}),n.length){var o=e(window).scrollTop(),a=o+e(window).height(),d=e(n[0].wrapper),u=d.offset(),f=u.top,m=f+d.height();f>=o&&a>=m||e("html, body").animate({scrollTop:d.offset().top},500)}else{var
|
1 |
+
(function(e,t){"use strict";window.wp=window.wp||{},wp.ccf=wp.ccf||{},wp.ccf.validators=wp.ccf.validators||{};var i={};window.ccfRecaptchaOnload=function(){for(var e=document.querySelectorAll(".ccf-recaptcha-wrapper"),l=function(l){grecaptcha.render(e[s],{sitekey:e[s].getAttribute("data-sitekey"),theme:t.recaptcha_theme,callback:function(){i[l]=!0}})},s=0;e.length>s;s++){var r=e[s].getAttribute("data-form-id");l(r)}};var l=function(e){if(this.wrapper=e,this.errors={},e.className.match(" field-required")){this.inputs=this.wrapper.querySelectorAll(".field-input");var i=this.wrapper.querySelectorAll(".error");i.length&&i[0].parentNode.removeChild(i[0]);var l=!1;if(_.each(this.inputs,function(e){(e.checked||e.selected)&&(l=!0)}),!l){this.errors.required=!0;var s=document.createElement("div");s.className="error required-error",s.innerHTML=t.required,e.appendChild(s)}}},s=function(e,i){return function(l){this.wrapper=l,this.inputs=this.wrapper.querySelectorAll(".field-input"),this.errors={};for(var s=this.wrapper.querySelectorAll(".error"),r=s.length-1;r>=0;r--)s[r].parentNode.removeChild(s[r]);_.each(this.inputs,function(t){var i=t.getAttribute("name");this.errors[i]={},t.getAttribute("aria-required")&&""===t.value&&(this.errors[i].required=t),e&&e.call(this,t)},this),i&&i.call(this);var c;for(var n in this.errors)if(this.errors.hasOwnProperty(n))for(var o in this.errors[n])c=document.createElement("div"),c.className="error "+o+"-error",c.setAttribute("data-field-name",n),c.innerHTML=t[o],this.errors[n][o].parentNode.insertBefore(c,this.errors[n][o].nextSibling)}};wp.ccf.validators["single-line-text"]=wp.ccf.validators["single-line-text"]||s(),wp.ccf.validators["paragraph-text"]=wp.ccf.validators["paragraph-text"]||s(),wp.ccf.validators.name=wp.ccf.validators.name||s(),wp.ccf.validators.email=wp.ccf.validators.email||s(!1,function(){var e=this.inputs[0].value;if(e){2===this.inputs.length&&e!==this.inputs[1].value&&(this.errors[this.inputs[0].getAttribute("name")].match=this.wrapper.lastChild);var t=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;t.test(e)||(this.errors[this.inputs[0].getAttribute("name")].email=this.wrapper.lastChild)}}),wp.ccf.validators.recaptcha=wp.ccf.validators.recaptcha||function(e,l){this.wrapper=e,this.inputs=this.wrapper.querySelectorAll(".g-recaptcha-response"),this.errors={};for(var s=this.wrapper.querySelectorAll(".error"),r=s.length-1;r>=0;r--)s[r].parentNode.removeChild(s[r]);i[l]||(this.errors["g-recaptcha-response"]={},this.errors["g-recaptcha-response"].recaptcha=this.wrapper.lastChild);var c;for(var n in this.errors)if(this.errors.hasOwnProperty(n))for(var o in this.errors[n])c=document.createElement("div"),c.className="error "+o+"-error",c.setAttribute("data-field-name",n),c.innerHTML=t[o],this.errors[n][o].parentNode.insertBefore(c,this.errors[n][o].nextSibling)},wp.ccf.validators.phone=wp.ccf.validators.phone||s(!1,function(){var e=this.inputs[0].value;if(e){var t=/^[0-9+.)(\-]+$/;if(t.test(e)){if("us"===this.wrapper.getAttribute("data-phone-format")){var i=e.replace(/[^0-9]/,"");10!==i.length&&(this.errors[this.inputs[0].getAttribute("name")].digits=this.wrapper.lastChild)}}else this.errors[this.inputs[0].getAttribute("name")].phone=this.wrapper.lastChild}}),wp.ccf.validators.date=wp.ccf.validators.date||function(e){this.wrapper=e,this.errors={},this.inputs=this.wrapper.querySelectorAll(".field-input");for(var i=this.wrapper.querySelectorAll(".error"),l=i.length-1;l>=0;l--)i[l].parentNode.removeChild(i[l]);var s;_.each(this.inputs,function(i){var l=i.getAttribute("name");if(this.errors[l]={},i.getAttribute("aria-required")&&""===i.value&&(this.errors[l].required=!0,s=document.createElement("div"),s.className="error required-error",1===this.inputs.length?(s.innerHTML=t.required,s.className+=" right-error",i.parentNode.insertBefore(s,i.nextSibling)):(s.innerHTML=t[l.replace(/.*\[(.*?)\]/i,"$1")+"_required"],e.appendChild(s))),""!==i.value){var r=l.replace(/^.*\[(.*?)\]$/,"$1");"date"===r?i.value.match(/^([0-9]|\/)+$/)||(s=document.createElement("div"),s.className="error date-error",s.innerHTML=t.date,e.appendChild(s)):"hour"===r?i.value.match(/^[0-9]+$/)||(s=document.createElement("div"),s.className="error hour-error",s.innerHTML=t.hour,e.appendChild(s)):"minute"===r&&(i.value.match(/^[0-9]+$/)||(s=document.createElement("div"),s.className="error minute-error",s.innerHTML=t.minute,e.appendChild(s)))}},this)},wp.ccf.validators.address=wp.ccf.validators.address||s(),wp.ccf.validators.website=wp.ccf.validators.website||s(function(e){if(e.value){var t=/^http(s?)\:\/\/(([a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+)+)|localhost)(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?([\d\w\.\/\%\+\-\=\&\?\:\\\"\'\,\|\~\;]*)$/;t.test(e.value)||(this.errors[e.getAttribute("name")].website=e)}}),wp.ccf.validators.checkboxes=wp.ccf.validators.checkboxes||l,wp.ccf.validators.dropdown=wp.ccf.validators.dropdown||s(),wp.ccf.validators.radio=wp.ccf.validators.radio||l,e(document).ready(function(){for(var l=document.querySelectorAll(".ccf-datepicker"),s=0;l.length>s;s++)e(l[s]).datepicker();var r=document.querySelectorAll(".ccf-form-wrapper");r.length>=1&&_.each(r,function(l){var s=parseInt(l.getAttribute("data-form-id")),r=function(r){r.returnFalse=!1,r.preventDefault&&r.preventDefault();var c=l.querySelectorAll(".field"),n=[];if(_.each(c,function(e){if(!e.className.match(/ skip-field/i)){var t=e.getAttribute("data-field-type"),i=new wp.ccf.validators[t](e,s);if(_.size(i.errors)){var l=0;for(var r in i.errors)i.errors.hasOwnProperty(r)&&_.size(i.errors[r])&&l++;l>0&&n.push(i)}}}),n.length){var o=e(window).scrollTop(),a=o+e(window).height(),d=e(n[0].wrapper),u=d.offset(),f=u.top,m=f+d.height();f>=o&&a>=m||e("html, body").animate({scrollTop:d.offset().top},500)}else{var p=e(this.querySelectorAll(".ccf-form")[0]);l.className=l.className.replace(/ loading/i,"")+" loading";var h=e(l.querySelectorAll(".loading-img")[0]);h.animate({opacity:100}),e.ajax({url:t.ajaxurl,type:"post",data:p.serialize()}).done(function(t){t.success&&("text"===t.action_type&&t.completion_message?(l.innerHTML=t.completion_message,e("html, body").animate({scrollTop:e(l).offset().top},500)):"redirect"===t.action_type&&t.completion_redirect_url&&(document.location=t.completion_redirect_url))}).complete(function(){l.className=l.className.replace(/ loading/i,""),h.animate({opacity:0}),i[s]=!1})}return!1};e(l).on("submit",r)})})})(jQuery,ccfSettings);
|
classes/class-ccf-form-manager.php
CHANGED
@@ -55,14 +55,14 @@ class CCF_Form_Manager {
|
|
55 |
<a class="close-icon">×</a>
|
56 |
<div class="main-menu">
|
57 |
<h1><?php esc_html_e( 'Manage Forms', 'custom-contact-forms' ); ?></h1>
|
58 |
-
|
59 |
<ul>
|
60 |
<li><a class="selected menu-item" data-view="form-pane" href="#form-pane"><?php esc_html_e( 'New Form', 'custom-contact-forms' ); ?></a></li>
|
61 |
<li><a class="menu-item" data-view="existing-form-pane" href="#existing-form-pane"><?php esc_html_e( 'Existing Forms', 'custom-contact-forms' ); ?></a></li>
|
62 |
</ul>
|
63 |
-
|
64 |
</div>
|
65 |
-
<div class="ccf-form-pane
|
66 |
<div class="ccf-existing-form-pane"></div>
|
67 |
</div>
|
68 |
</script>
|
@@ -72,7 +72,7 @@ class CCF_Form_Manager {
|
|
72 |
<div class="right">
|
73 |
<a aria-hidden="true" data-icon="" class="delete"></a>
|
74 |
</div>
|
75 |
-
<span class="label"
|
76 |
</h4>
|
77 |
|
78 |
<div class="preview"></div>
|
@@ -123,17 +123,17 @@ class CCF_Form_Manager {
|
|
123 |
<div class="section-content">
|
124 |
<p>
|
125 |
<label for="ccf_form_title"><?php esc_html_e( 'Form Title:', 'custom-contact-forms' ); ?></label>
|
126 |
-
<input class="widefat form-title" id="ccf_form_title" name="title" type="text" value="
|
127 |
</p>
|
128 |
|
129 |
<p>
|
130 |
<label for="ccf_form_description"><?php esc_html_e( 'Form Description:', 'custom-contact-forms' ); ?></label>
|
131 |
-
<textarea class="widefat form-description" id="ccf_form_description" name="description"
|
132 |
</p>
|
133 |
|
134 |
<p>
|
135 |
<label for="ccf_form_button_text"><?php esc_html_e( 'Button Text:', 'custom-contact-forms' ); ?></label>
|
136 |
-
<input class="widefat form-button-text" id="ccf_form_button_text" name="text" type="text" value="
|
137 |
</p>
|
138 |
|
139 |
<p>
|
@@ -141,16 +141,16 @@ class CCF_Form_Manager {
|
|
141 |
|
142 |
<select name="completion_action_type" class="form-completion-action-type" id="ccf_form_completion_action_type">
|
143 |
<option value="text"><?php esc_html_e( 'Show text', 'custom-contact-forms' ); ?></option>
|
144 |
-
<option value="redirect"
|
145 |
</select>
|
146 |
</p>
|
147 |
<p class="completion-redirect-url">
|
148 |
<label for="ccf_form_completion_redirect_url"><?php esc_html_e( 'Redirect URL:', 'custom-contact-forms' ); ?></label>
|
149 |
-
<input class="widefat form-completion-redirect-url" id="ccf_form_completion_redirect_url" name="text" type="text" value="
|
150 |
</p>
|
151 |
<p class="completion-message">
|
152 |
<label for="ccf_form_completion_message"><?php esc_html_e( 'Completion Message:', 'custom-contact-forms' ); ?></label>
|
153 |
-
<textarea class="widefat form-completion-message" id="ccf_form_completion_message" name="completion-message"
|
154 |
</p>
|
155 |
</div>
|
156 |
</script>
|
@@ -163,21 +163,21 @@ class CCF_Form_Manager {
|
|
163 |
|
164 |
<select name="send_email_notifications" class="form-send-email-notifications" id="ccf_form_send_email_notifications">
|
165 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
166 |
-
<option value="0"
|
167 |
</select>
|
168 |
</p>
|
169 |
|
170 |
<p class="email-notification-setting">
|
171 |
<label for="ccf_form_email_notification_addresses"><?php esc_html_e( '"To" Email Addresses (comma separated):', 'custom-contact-forms' ); ?></label>
|
172 |
-
<input class="widefat form-email-notification-addresses" id="ccf_form_email_notification_addresses" name="email-notification-addresses" value="
|
173 |
</p>
|
174 |
|
175 |
<p class="email-notification-setting">
|
176 |
<label for="ccf_form_email_notification_from_type"><?php esc_html_e( '"From" Email Address Type:', 'custom-contact-forms' ); ?></label>
|
177 |
<select name="email_notification_from_type" class="form-email-notification-from-type" id="ccf_form_email_notification_from_type">
|
178 |
<option value="default"><?php esc_html_e( 'WordPress Default', 'custom-contact-forms' ); ?></option>
|
179 |
-
<option value="custom"
|
180 |
-
<option value="field"
|
181 |
</select>
|
182 |
|
183 |
<div class="explain"><?php esc_html_e( 'You can set the notification emails from address to be the WP default, a custom email address, or pull the address from a field in the form.', 'custom-contact-forms' ); ?></div>
|
@@ -185,21 +185,21 @@ class CCF_Form_Manager {
|
|
185 |
|
186 |
<p class="email-notification-from-address">
|
187 |
<label for="ccf_form_email_notification_from_address"><?php esc_html_e( 'Custom "From" Email Address:', 'custom-contact-forms' ); ?></label>
|
188 |
-
<input class="widefat form-email-notification-from-address" id="ccf_form_email_notification_from_address" name="email-notification-from-address" value="
|
189 |
</p>
|
190 |
|
191 |
<p class="email-notification-from-field">
|
192 |
<label for="ccf_form_email_notification_from_field"><?php esc_html_e( 'Pull "From" Email Dynamically from Field:', 'custom-contact-forms' ); ?></label>
|
193 |
-
|
194 |
<strong><?php esc_html_e( 'There are no email fields in your form.', 'custom-contact-forms' ); ?></strong>
|
195 |
<input type="hidden" name="email_notification_from_field" value="" class="form-email-notification-from-field">
|
196 |
-
|
197 |
<select name="email_notification_from_field" class="form-email-notification-from-field" id="ccf_form_email_notification_from_field">
|
198 |
-
|
199 |
-
<option
|
200 |
-
|
201 |
</select>
|
202 |
-
|
203 |
</p>
|
204 |
</div>
|
205 |
</script>
|
@@ -211,15 +211,15 @@ class CCF_Form_Manager {
|
|
211 |
</script>
|
212 |
|
213 |
<script type="text/html" id="ccf-pagination-template">
|
214 |
-
<span class="num-items"
|
215 |
|
216 |
-
<a class="first
|
217 |
-
<a class="prev
|
218 |
|
219 |
-
<span class="pages"
|
220 |
|
221 |
-
<a class="next
|
222 |
-
<a class="last
|
223 |
</script>
|
224 |
|
225 |
<script type="text/html" id="ccf-existing-form-table-template">
|
@@ -264,21 +264,21 @@ class CCF_Form_Manager {
|
|
264 |
<div class="section-content">
|
265 |
<div>
|
266 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug', 'custom-contact-forms' ); ?> (a-z, 0-9, -, _):</label>
|
267 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
268 |
</div>
|
269 |
<div>
|
270 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
271 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
272 |
</div>
|
273 |
<div>
|
274 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
275 |
-
<input id="ccf-field-value" class="field-value" type="text" value="
|
276 |
</div>
|
277 |
<div>
|
278 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
279 |
<select id="ccf-field-required" class="field-required">
|
280 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
281 |
-
<option value="0"
|
282 |
</select>
|
283 |
</div>
|
284 |
</div>
|
@@ -288,11 +288,11 @@ class CCF_Form_Manager {
|
|
288 |
<div class="section-content">
|
289 |
<div>
|
290 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
291 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
292 |
</div>
|
293 |
<div>
|
294 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
295 |
-
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="
|
296 |
</div>
|
297 |
</div>
|
298 |
</div>
|
@@ -305,16 +305,16 @@ class CCF_Form_Manager {
|
|
305 |
<p><?php _e( 'reCAPTCHA is a simple captcha service provided by Google. <a target="_blank" href="https://www.google.com/recaptcha/intro/index.html">Learn more</a>', 'custom-contact-forms' ); ?></p>
|
306 |
<div>
|
307 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
308 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
309 |
</div>
|
310 |
<div>
|
311 |
<label for="ccf-field-site-key"><span class="required">*</span> <?php esc_html_e( 'Site Key:', 'custom-contact-forms' ); ?></label>
|
312 |
-
<input id="ccf-field-site-key" class="field-site-key" type="text" value="
|
313 |
<a href="http://google.com/recaptcha/" target="_blank"><?php _e( "Don't have one?", 'custom-contact-forms' ); ?></a>
|
314 |
</div>
|
315 |
<div>
|
316 |
<label for="ccf-field-secret-key"><span class="required">*</span> <?php esc_html_e( 'Secret Key:', 'custom-contact-forms' ); ?></label>
|
317 |
-
<input id="ccf-field-secret-key" class="field-secret-key" type="text" value="
|
318 |
<a href="http://google.com/recaptcha/" target="_blank"><?php _e( "Don't have one?", 'custom-contact-forms' ); ?></a>
|
319 |
</div>
|
320 |
</div>
|
@@ -324,7 +324,7 @@ class CCF_Form_Manager {
|
|
324 |
<div class="section-content">
|
325 |
<div>
|
326 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
327 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
328 |
</div>
|
329 |
</div>
|
330 |
</div>
|
@@ -336,21 +336,21 @@ class CCF_Form_Manager {
|
|
336 |
<div class="section-content">
|
337 |
<div>
|
338 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug', 'custom-contact-forms' ); ?> (a-z, 0-9, -, _):</label>
|
339 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
340 |
</div>
|
341 |
<div>
|
342 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
343 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
344 |
</div>
|
345 |
<div>
|
346 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
347 |
-
<input id="ccf-field-value" class="field-value" type="text" value="
|
348 |
</div>
|
349 |
<div>
|
350 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
351 |
<select id="ccf-field-required" class="field-required">
|
352 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
353 |
-
<option value="0"
|
354 |
</select>
|
355 |
</div>
|
356 |
</div>
|
@@ -360,11 +360,11 @@ class CCF_Form_Manager {
|
|
360 |
<div class="section-content">
|
361 |
<div>
|
362 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
363 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
364 |
</div>
|
365 |
<div>
|
366 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
367 |
-
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="
|
368 |
</div>
|
369 |
</div>
|
370 |
</div>
|
@@ -376,7 +376,7 @@ class CCF_Form_Manager {
|
|
376 |
<div class="section-content">
|
377 |
<div>
|
378 |
<label for="ccf-field-html"><?php esc_html_e( 'HTML Content:', 'custom-contact-forms' ); ?></label>
|
379 |
-
<textarea id="ccf-field-html" class="field-html"
|
380 |
</div>
|
381 |
</div>
|
382 |
</div>
|
@@ -385,7 +385,7 @@ class CCF_Form_Manager {
|
|
385 |
<div class="section-content">
|
386 |
<div>
|
387 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
388 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
389 |
</div>
|
390 |
</div>
|
391 |
</div>
|
@@ -397,11 +397,11 @@ class CCF_Form_Manager {
|
|
397 |
<div class="section-content">
|
398 |
<div>
|
399 |
<label for="ccf-field-heading"><?php esc_html_e( 'Heading:', 'custom-contact-forms' ); ?></label>
|
400 |
-
<input id="ccf-field-heading" class="field-heading" type="text" value="
|
401 |
</div>
|
402 |
<div>
|
403 |
<label for="ccf-field-subheading"><?php esc_html_e( 'Sub Heading:', 'custom-contact-forms' ); ?></label>
|
404 |
-
<textarea id="ccf-field-subheading" class="field-subheading" type="text"
|
405 |
</div>
|
406 |
</div>
|
407 |
</div>
|
@@ -410,7 +410,7 @@ class CCF_Form_Manager {
|
|
410 |
<div class="section-content">
|
411 |
<div>
|
412 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
413 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
414 |
</div>
|
415 |
</div>
|
416 |
</div>
|
@@ -422,21 +422,21 @@ class CCF_Form_Manager {
|
|
422 |
<div class="section-content">
|
423 |
<div>
|
424 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug', 'custom-contact-forms' ); ?> (a-z, 0-9, -, _):</label>
|
425 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
426 |
</div>
|
427 |
<div>
|
428 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
429 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
430 |
</div>
|
431 |
<div>
|
432 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
433 |
-
<input id="ccf-field-value" class="field-value" type="text" value="
|
434 |
</div>
|
435 |
<div>
|
436 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
437 |
<select id="ccf-field-required" class="field-required">
|
438 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
439 |
-
<option value="0"
|
440 |
</select>
|
441 |
</div>
|
442 |
</div>
|
@@ -446,11 +446,11 @@ class CCF_Form_Manager {
|
|
446 |
<div class="section-content">
|
447 |
<div>
|
448 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
449 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
450 |
</div>
|
451 |
<div>
|
452 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
453 |
-
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="
|
454 |
</div>
|
455 |
</div>
|
456 |
</div>
|
@@ -462,11 +462,11 @@ class CCF_Form_Manager {
|
|
462 |
<div class="section-content">
|
463 |
<div>
|
464 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
465 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
466 |
</div>
|
467 |
<div>
|
468 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
469 |
-
<input id="ccf-field-value" class="field-value" type="text" value="
|
470 |
</div>
|
471 |
</div>
|
472 |
</div>
|
@@ -475,7 +475,7 @@ class CCF_Form_Manager {
|
|
475 |
<div class="section-content">
|
476 |
<div>
|
477 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
478 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
479 |
</div>
|
480 |
</div>
|
481 |
</div>
|
@@ -487,17 +487,17 @@ class CCF_Form_Manager {
|
|
487 |
<div class="section-content">
|
488 |
<div>
|
489 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
490 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
491 |
</div>
|
492 |
<div>
|
493 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
494 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
495 |
</div>
|
496 |
<div>
|
497 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
498 |
<select id="ccf-field-required" class="field-required">
|
499 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
500 |
-
<option value="0"
|
501 |
</select>
|
502 |
</div>
|
503 |
</div>
|
@@ -507,7 +507,7 @@ class CCF_Form_Manager {
|
|
507 |
<div class="section-content">
|
508 |
<div>
|
509 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
510 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
511 |
</div>
|
512 |
</div>
|
513 |
</div>
|
@@ -519,31 +519,31 @@ class CCF_Form_Manager {
|
|
519 |
<div class="section-content">
|
520 |
<div>
|
521 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
522 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
523 |
</div>
|
524 |
<div>
|
525 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
526 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
527 |
</div>
|
528 |
-
|
529 |
<div>
|
530 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
531 |
-
<input id="ccf-field-value" class="field-value" type="text" value="
|
532 |
</div>
|
533 |
-
|
534 |
<div>
|
535 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
536 |
<select id="ccf-field-required" class="field-required">
|
537 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
538 |
-
<option value="0"
|
539 |
</select>
|
540 |
</div>
|
541 |
<div>
|
542 |
-
<input type="checkbox"
|
543 |
<label for="ccf-show-date"><?php esc_html_e( 'Enable Date Select', 'custom-contact-forms' ); ?></label>
|
544 |
</div>
|
545 |
<div>
|
546 |
-
<input type="checkbox"
|
547 |
<label for="ccf-show-time"><?php esc_html_e( 'Enable Time Select', 'custom-contact-forms' ); ?></label>
|
548 |
</div>
|
549 |
</div>
|
@@ -553,14 +553,14 @@ class CCF_Form_Manager {
|
|
553 |
<div class="section-content">
|
554 |
<div>
|
555 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
556 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
557 |
</div>
|
558 |
-
|
559 |
<div>
|
560 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
561 |
-
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="
|
562 |
</div>
|
563 |
-
|
564 |
</div>
|
565 |
</div>
|
566 |
</script>
|
@@ -571,28 +571,28 @@ class CCF_Form_Manager {
|
|
571 |
<div class="section-content">
|
572 |
<div>
|
573 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
574 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
575 |
</div>
|
576 |
<div>
|
577 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
578 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
579 |
</div>
|
580 |
<div>
|
581 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
582 |
-
<input id="ccf-field-value" class="field-value" type="text" value="
|
583 |
</div>
|
584 |
<div>
|
585 |
<label for="ccf-field-phone-format"><?php esc_html_e( 'Format:', 'custom-contact-forms' ); ?></label>
|
586 |
<select id="ccf-field-phone-format" class="field-phone-format">
|
587 |
<option value="us">(xxx) xxx-xxxx</option>
|
588 |
-
<option value="international"
|
589 |
</select>
|
590 |
</div>
|
591 |
<div>
|
592 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
593 |
<select id="ccf-field-required" class="field-required">
|
594 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
595 |
-
<option value="0"
|
596 |
</select>
|
597 |
</div>
|
598 |
</div>
|
@@ -602,11 +602,11 @@ class CCF_Form_Manager {
|
|
602 |
<div class="section-content">
|
603 |
<div>
|
604 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
605 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
606 |
</div>
|
607 |
<div>
|
608 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
609 |
-
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="
|
610 |
</div>
|
611 |
</div>
|
612 |
</div>
|
@@ -618,24 +618,24 @@ class CCF_Form_Manager {
|
|
618 |
<div class="section-content">
|
619 |
<div>
|
620 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
621 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
622 |
</div>
|
623 |
<div>
|
624 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
625 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
626 |
</div>
|
627 |
<div>
|
628 |
<label for="ccf-field-address-type"><?php esc_html_e( 'Type:', 'custom-contact-forms' ); ?></label>
|
629 |
<select id="ccf-field-address-type" class="field-address-type">
|
630 |
<option value="us"><?php esc_html_e( 'United States', 'custom-contact-forms' ); ?></option>
|
631 |
-
<option value="international"
|
632 |
</select>
|
633 |
</div>
|
634 |
<div>
|
635 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
636 |
<select id="ccf-field-required" class="field-required">
|
637 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
638 |
-
<option value="0"
|
639 |
</select>
|
640 |
</div>
|
641 |
</div>
|
@@ -645,7 +645,7 @@ class CCF_Form_Manager {
|
|
645 |
<div class="section-content">
|
646 |
<div>
|
647 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
648 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
649 |
</div>
|
650 |
</div>
|
651 |
</div>
|
@@ -657,30 +657,30 @@ class CCF_Form_Manager {
|
|
657 |
<div class="section-content">
|
658 |
<div>
|
659 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
660 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
661 |
</div>
|
662 |
<div>
|
663 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
664 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
665 |
</div>
|
666 |
-
|
667 |
<div>
|
668 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
669 |
-
<input id="ccf-field-value" class="field-value" type="text" value="
|
670 |
</div>
|
671 |
-
|
672 |
<div>
|
673 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
674 |
<select id="ccf-field-required" class="field-required">
|
675 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
676 |
-
<option value="0"
|
677 |
</select>
|
678 |
</div>
|
679 |
<div>
|
680 |
<label for="ccf-field-email-confirmation"><?php esc_html_e( 'Require Confirmation:', 'custom-contact-forms' ); ?></label>
|
681 |
<select id="ccf-field-email-confirmation" class="field-email-confirmation">
|
682 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
683 |
-
<option value="0"
|
684 |
</select>
|
685 |
</div>
|
686 |
</div>
|
@@ -690,23 +690,23 @@ class CCF_Form_Manager {
|
|
690 |
<div class="section-content">
|
691 |
<div>
|
692 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
693 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
694 |
</div>
|
695 |
-
|
696 |
<div>
|
697 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
698 |
-
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="
|
699 |
</div>
|
700 |
-
|
701 |
</div>
|
702 |
</div>
|
703 |
</script>
|
704 |
|
705 |
<script type="text/html" id="ccf-field-choice-template">
|
706 |
<a aria-hidden="true" data-icon="" class="move"></a>
|
707 |
-
<input class="choice-selected"
|
708 |
-
<input class="choice-label" type="text" placeholder="<?php esc_html_e( 'Label', 'custom-contact-forms' ); ?>" value="
|
709 |
-
<input class="choice-value" type="text" placeholder="<?php esc_html_e( 'Value', 'custom-contact-forms' ); ?>" value="
|
710 |
<a aria-hidden="true" data-icon="" class="add"></a>
|
711 |
<a aria-hidden="true" data-icon="" class="delete"></a>
|
712 |
</script>
|
@@ -717,17 +717,17 @@ class CCF_Form_Manager {
|
|
717 |
<div class="section-content">
|
718 |
<div>
|
719 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
720 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
721 |
</div>
|
722 |
<div>
|
723 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
724 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
725 |
</div>
|
726 |
<div>
|
727 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
728 |
<select id="ccf-field-required" class="field-required">
|
729 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
730 |
-
<option value="0"
|
731 |
</select>
|
732 |
</div>
|
733 |
<div>
|
@@ -742,7 +742,7 @@ class CCF_Form_Manager {
|
|
742 |
<div class="section-content">
|
743 |
<div>
|
744 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
745 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
746 |
</div>
|
747 |
</div>
|
748 |
</div>
|
@@ -754,17 +754,17 @@ class CCF_Form_Manager {
|
|
754 |
<div class="section-content">
|
755 |
<div>
|
756 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
757 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
758 |
</div>
|
759 |
<div>
|
760 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
761 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
762 |
</div>
|
763 |
<div>
|
764 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
765 |
<select id="ccf-field-required" class="field-required">
|
766 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
767 |
-
<option value="0"
|
768 |
</select>
|
769 |
</div>
|
770 |
<div>
|
@@ -779,7 +779,7 @@ class CCF_Form_Manager {
|
|
779 |
<div class="section-content">
|
780 |
<div>
|
781 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
782 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
783 |
</div>
|
784 |
</div>
|
785 |
</div>
|
@@ -791,17 +791,17 @@ class CCF_Form_Manager {
|
|
791 |
<div class="section-content">
|
792 |
<div>
|
793 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
794 |
-
<input id="ccf-field-slug" class="field-slug" type="text" value="
|
795 |
</div>
|
796 |
<div>
|
797 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
798 |
-
<input id="ccf-field-label" class="field-label" type="text" value="
|
799 |
</div>
|
800 |
<div>
|
801 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
802 |
<select id="ccf-field-required" class="field-required">
|
803 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
804 |
-
<option value="0"
|
805 |
</select>
|
806 |
</div>
|
807 |
<div>
|
@@ -816,7 +816,7 @@ class CCF_Form_Manager {
|
|
816 |
<div class="section-content">
|
817 |
<div>
|
818 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
819 |
-
<input id="ccf-field-class-name" class="field-class-name" type="text" value="
|
820 |
</div>
|
821 |
</div>
|
822 |
</div>
|
@@ -829,80 +829,80 @@ class CCF_Form_Manager {
|
|
829 |
</script>
|
830 |
|
831 |
<script type="text/html" id="ccf-single-line-text-preview-template">
|
832 |
-
<label
|
833 |
-
<input disabled type="text" placeholder="
|
834 |
</script>
|
835 |
|
836 |
<script type="text/html" id="ccf-recaptcha-preview-template">
|
837 |
-
<label
|
838 |
<img class="recaptcha-preview-img" src="<?php echo plugins_url( 'img/recaptcha.png', dirname( __FILE__ )); ?>">
|
839 |
</script>
|
840 |
|
841 |
<script type="text/html" id="ccf-paragraph-text-preview-template">
|
842 |
-
<label
|
843 |
-
<textarea placeholder="
|
844 |
</script>
|
845 |
|
846 |
<script type="text/html" id="ccf-dropdown-preview-template">
|
847 |
-
<label
|
848 |
<select>
|
849 |
-
|
850 |
<option><?php esc_html_e( 'An example choice', 'custom-contact-forms' ); ?></option>
|
851 |
-
|
852 |
-
|
853 |
-
<option
|
854 |
-
|
855 |
-
|
856 |
</select>
|
857 |
</script>
|
858 |
|
859 |
<script type="text/html" id="ccf-radio-preview-template">
|
860 |
-
<label
|
861 |
-
|
862 |
<div>
|
863 |
<input type="radio" value="1" checked="checked"> <label><?php esc_html_e( 'An example choice', 'custom-contact-forms' ); ?></label>
|
864 |
</div>
|
865 |
-
|
866 |
-
|
867 |
<div class="choice">
|
868 |
-
<input type="radio" value="
|
869 |
</div>
|
870 |
-
|
871 |
-
|
872 |
</script>
|
873 |
|
874 |
<script type="text/html" id="ccf-checkboxes-preview-template">
|
875 |
-
<label
|
876 |
-
|
877 |
<div>
|
878 |
<input type="checkbox" value="1" checked="checked"> <label><?php esc_html_e( 'An example choice', 'custom-contact-forms' ); ?></label>
|
879 |
</div>
|
880 |
-
|
881 |
-
|
882 |
<div class="choice">
|
883 |
-
<input type="checkbox" value="
|
884 |
</div>
|
885 |
-
|
886 |
-
|
887 |
</script>
|
888 |
|
889 |
<script type="text/html" id="ccf-html-preview-template">
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
<pre><pre><?php esc_html_e( 'Arbitrary block of HTML.', 'custom-contact-forms' ); ?></pre></pre>
|
894 |
-
|
895 |
</script>
|
896 |
|
897 |
<script type="text/html" id="ccf-section-header-preview-template">
|
898 |
<div class="heading">
|
899 |
-
|
900 |
</div>
|
901 |
-
<div class="subheading"
|
902 |
</script>
|
903 |
|
904 |
<script type="text/html" id="ccf-name-preview-template">
|
905 |
-
<label
|
906 |
<div class="left">
|
907 |
<input type="text">
|
908 |
<label class="sub-label"><?php esc_html_e( 'First', 'custom-contact-forms' ); ?></label>
|
@@ -914,10 +914,10 @@ class CCF_Form_Manager {
|
|
914 |
</script>
|
915 |
|
916 |
<script type="text/html" id="ccf-date-preview-template">
|
917 |
-
<label
|
918 |
-
|
919 |
-
<input value="
|
920 |
-
|
921 |
<div class="full">
|
922 |
<div class="hour">
|
923 |
<input type="text">
|
@@ -934,7 +934,7 @@ class CCF_Form_Manager {
|
|
934 |
</select>
|
935 |
</div>
|
936 |
</div>
|
937 |
-
|
938 |
<div class="left">
|
939 |
<input class="ccf-datepicker" disabled type="text">
|
940 |
<label class="sub-label"><?php esc_html_e( 'Date', 'custom-contact-forms' ); ?></label>
|
@@ -955,12 +955,12 @@ class CCF_Form_Manager {
|
|
955 |
</select>
|
956 |
</div>
|
957 |
</div>
|
958 |
-
|
959 |
</script>
|
960 |
|
961 |
<script type="text/html" id="ccf-address-preview-template">
|
962 |
-
<label
|
963 |
-
|
964 |
<div class="full">
|
965 |
<input type="text">
|
966 |
<label class="sub-label"><?php esc_html_e( 'Street Address', 'custom-contact-forms' ); ?></label>
|
@@ -985,7 +985,7 @@ class CCF_Form_Manager {
|
|
985 |
<input type="text">
|
986 |
<label class="sub-label"><?php esc_html_e( 'ZIP Code', 'custom-contact-forms' ); ?></label>
|
987 |
</div>
|
988 |
-
|
989 |
<div class="full">
|
990 |
<input type="text">
|
991 |
<label class="sub-label"><?php esc_html_e( 'Street Address', 'custom-contact-forms' ); ?></label>
|
@@ -1014,14 +1014,14 @@ class CCF_Form_Manager {
|
|
1014 |
</select>
|
1015 |
<label class="sub-label"><?php esc_html_e( 'Country', 'custom-contact-forms' ); ?></label>
|
1016 |
</div>
|
1017 |
-
|
1018 |
</script>
|
1019 |
|
1020 |
<script type="text/html" id="ccf-email-preview-template">
|
1021 |
-
<label
|
1022 |
-
|
1023 |
-
<input placeholder="
|
1024 |
-
|
1025 |
<div class="left">
|
1026 |
<input type="text">
|
1027 |
<div class="sub-label"><?php esc_html_e( 'Email', 'custom-contact-forms' ); ?></div>
|
@@ -1030,38 +1030,38 @@ class CCF_Form_Manager {
|
|
1030 |
<input type="text">
|
1031 |
<div class="sub-label"><?php esc_html_e( 'Confirm Email', 'custom-contact-forms' ); ?></div>
|
1032 |
</div>
|
1033 |
-
|
1034 |
</script>
|
1035 |
|
1036 |
<script type="text/html" id="ccf-website-preview-template">
|
1037 |
-
<label
|
1038 |
-
<input placeholder="
|
1039 |
</script>
|
1040 |
|
1041 |
<script type="text/html" id="ccf-phone-preview-template">
|
1042 |
-
<label
|
1043 |
-
<input placeholder="
|
1044 |
</script>
|
1045 |
|
1046 |
<script type="text/html" id="ccf-existing-form-table-row-template">
|
1047 |
|
1048 |
-
<td
|
1049 |
<td>
|
1050 |
-
<a class="edit edit-form title" data-view="form-pane" data-form-id="
|
1051 |
<div class="actions">
|
1052 |
-
<a class="edit edit-form" data-view="form-pane" data-form-id="
|
1053 |
<a class="insert-form-button"><?php esc_html_e( 'Insert into post', 'custom-contact-forms' ); ?></a> |
|
1054 |
<a class="delete"><?php esc_html_e( 'Trash', 'custom-contact-forms' ); ?></a>
|
1055 |
</div>
|
1056 |
</td>
|
1057 |
<td>
|
1058 |
-
|
1059 |
</td>
|
1060 |
<td>
|
1061 |
-
|
1062 |
</td>
|
1063 |
<td>
|
1064 |
-
|
1065 |
</td>
|
1066 |
<td>
|
1067 |
0
|
@@ -1069,25 +1069,25 @@ class CCF_Form_Manager {
|
|
1069 |
</script>
|
1070 |
|
1071 |
<script type="text/html" id="ccf-form-mce-preview">
|
1072 |
-
<div class="ccf-form-preview form-id
|
1073 |
-
|
1074 |
-
<h2
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
<p
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
<div class="field
|
1084 |
-
|
1085 |
</div>
|
1086 |
-
|
1087 |
-
|
1088 |
|
1089 |
<div class="field-submit">
|
1090 |
-
<input type="button" value="
|
1091 |
</div>
|
1092 |
</div>
|
1093 |
</script>
|
@@ -1102,36 +1102,36 @@ class CCF_Form_Manager {
|
|
1102 |
<table class="widefat fixed" cellpadding="0" cellspacing="0">
|
1103 |
<thead>
|
1104 |
<tr>
|
1105 |
-
|
1106 |
-
<th scope="col" class="manage-column column
|
1107 |
-
|
1108 |
<?php esc_html_e( 'Date', 'custom-contact-forms' ); ?>
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
</th>
|
1113 |
-
|
1114 |
<th scope="col" class="manage-column column-actions"></th>
|
1115 |
</tr>
|
1116 |
</thead>
|
1117 |
<tfoot>
|
1118 |
<tr>
|
1119 |
-
|
1120 |
-
<th scope="col" class="manage-column column
|
1121 |
-
|
1122 |
<?php esc_html_e( 'Date', 'custom-contact-forms' ); ?>
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
</th>
|
1127 |
-
|
1128 |
<th scope="col" class="manage-column column-actions"></th>
|
1129 |
</tr>
|
1130 |
</tfoot>
|
1131 |
|
1132 |
<tbody class="submission-rows">
|
1133 |
<tr>
|
1134 |
-
<td colspan="
|
1135 |
<div class="spinner" style="background: url( '<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>' ) no-repeat;"></div>
|
1136 |
</td>
|
1137 |
</tr>
|
@@ -1141,71 +1141,71 @@ class CCF_Form_Manager {
|
|
1141 |
</script>
|
1142 |
|
1143 |
<script type="text/html" id="ccf-submission-row-template">
|
1144 |
-
|
1145 |
-
|
1146 |
-
<td colspan="1"
|
1147 |
-
|
1148 |
<td colspan="1">
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
if ( i > 0 ) {
|
1160 |
output += ', ';
|
1161 |
}
|
1162 |
output += submission.data[column][key];
|
1163 |
|
1164 |
i++;
|
1165 |
-
} }
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
<span><?php esc_html_e( '-', 'custom-contact-forms' ); ?></span>
|
1173 |
-
|
1174 |
</td>
|
1175 |
-
|
1176 |
-
|
1177 |
<td class="actions">
|
1178 |
-
<a href="#TB_inline?height=300&width=400&inlineId=submission-content" data-submission-date="
|
1179 |
<a class="delete" data-icon=""></a>
|
1180 |
|
1181 |
-
<div class="submission-wrapper" id="ccf-submission-content
|
1182 |
<div class="ccf-submission-content">
|
1183 |
-
|
1184 |
<div class="field-slug">
|
1185 |
-
|
1186 |
</div>
|
1187 |
<div class="field-content">
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
<span>-</span>
|
1206 |
-
|
1207 |
</div>
|
1208 |
-
|
1209 |
</div>
|
1210 |
</div>
|
1211 |
</td>
|
@@ -1213,22 +1213,22 @@ class CCF_Form_Manager {
|
|
1213 |
|
1214 |
|
1215 |
<script type="text/html" id="ccf-no-submissions-row-template">
|
1216 |
-
<td colspan="
|
1217 |
</script>
|
1218 |
|
1219 |
<script type="text/html" id="ccf-submissions-controller-template">
|
1220 |
-
|
1221 |
|
1222 |
-
<label for="ccf-column
|
1223 |
-
<input class="submission-column-checkbox" type="checkbox" id="ccf-column
|
1224 |
-
|
1225 |
<?php esc_html_e( 'Date', 'custom-contact-forms' ); ?>
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
</label>
|
1230 |
|
1231 |
-
|
1232 |
</script>
|
1233 |
|
1234 |
<?php
|
55 |
<a class="close-icon">×</a>
|
56 |
<div class="main-menu">
|
57 |
<h1><?php esc_html_e( 'Manage Forms', 'custom-contact-forms' ); ?></h1>
|
58 |
+
<# if ( ! single ) { #>
|
59 |
<ul>
|
60 |
<li><a class="selected menu-item" data-view="form-pane" href="#form-pane"><?php esc_html_e( 'New Form', 'custom-contact-forms' ); ?></a></li>
|
61 |
<li><a class="menu-item" data-view="existing-form-pane" href="#existing-form-pane"><?php esc_html_e( 'Existing Forms', 'custom-contact-forms' ); ?></a></li>
|
62 |
</ul>
|
63 |
+
<# } #>
|
64 |
</div>
|
65 |
+
<div class="ccf-form-pane <# if ( single ) { #>single<# } #>"></div>
|
66 |
<div class="ccf-existing-form-pane"></div>
|
67 |
</div>
|
68 |
</script>
|
72 |
<div class="right">
|
73 |
<a aria-hidden="true" data-icon="" class="delete"></a>
|
74 |
</div>
|
75 |
+
<span class="label">{{ label }}</span>
|
76 |
</h4>
|
77 |
|
78 |
<div class="preview"></div>
|
123 |
<div class="section-content">
|
124 |
<p>
|
125 |
<label for="ccf_form_title"><?php esc_html_e( 'Form Title:', 'custom-contact-forms' ); ?></label>
|
126 |
+
<input class="widefat form-title" id="ccf_form_title" name="title" type="text" value="{{ form.title }}">
|
127 |
</p>
|
128 |
|
129 |
<p>
|
130 |
<label for="ccf_form_description"><?php esc_html_e( 'Form Description:', 'custom-contact-forms' ); ?></label>
|
131 |
+
<textarea class="widefat form-description" id="ccf_form_description" name="description">{{ form.description }}</textarea>
|
132 |
</p>
|
133 |
|
134 |
<p>
|
135 |
<label for="ccf_form_button_text"><?php esc_html_e( 'Button Text:', 'custom-contact-forms' ); ?></label>
|
136 |
+
<input class="widefat form-button-text" id="ccf_form_button_text" name="text" type="text" value="{{ form.buttonText }}">
|
137 |
</p>
|
138 |
|
139 |
<p>
|
141 |
|
142 |
<select name="completion_action_type" class="form-completion-action-type" id="ccf_form_completion_action_type">
|
143 |
<option value="text"><?php esc_html_e( 'Show text', 'custom-contact-forms' ); ?></option>
|
144 |
+
<option value="redirect" <# if ( 'redirect' === form.completionActionType ) { #>selected<# } #>><?php esc_html_e( 'Redirect', 'custom-contact-forms' ); ?></option>
|
145 |
</select>
|
146 |
</p>
|
147 |
<p class="completion-redirect-url">
|
148 |
<label for="ccf_form_completion_redirect_url"><?php esc_html_e( 'Redirect URL:', 'custom-contact-forms' ); ?></label>
|
149 |
+
<input class="widefat form-completion-redirect-url" id="ccf_form_completion_redirect_url" name="text" type="text" value="{{ form.completionRedirectUrl }}">
|
150 |
</p>
|
151 |
<p class="completion-message">
|
152 |
<label for="ccf_form_completion_message"><?php esc_html_e( 'Completion Message:', 'custom-contact-forms' ); ?></label>
|
153 |
+
<textarea class="widefat form-completion-message" id="ccf_form_completion_message" name="completion-message">{{ form.completionMessage }}</textarea>
|
154 |
</p>
|
155 |
</div>
|
156 |
</script>
|
163 |
|
164 |
<select name="send_email_notifications" class="form-send-email-notifications" id="ccf_form_send_email_notifications">
|
165 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
166 |
+
<option value="0" <# if ( ! form.sendEmailNotifications ) { #>selected<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
167 |
</select>
|
168 |
</p>
|
169 |
|
170 |
<p class="email-notification-setting">
|
171 |
<label for="ccf_form_email_notification_addresses"><?php esc_html_e( '"To" Email Addresses (comma separated):', 'custom-contact-forms' ); ?></label>
|
172 |
+
<input class="widefat form-email-notification-addresses" id="ccf_form_email_notification_addresses" name="email-notification-addresses" value="{{ form.emailNotificationAddresses }}">
|
173 |
</p>
|
174 |
|
175 |
<p class="email-notification-setting">
|
176 |
<label for="ccf_form_email_notification_from_type"><?php esc_html_e( '"From" Email Address Type:', 'custom-contact-forms' ); ?></label>
|
177 |
<select name="email_notification_from_type" class="form-email-notification-from-type" id="ccf_form_email_notification_from_type">
|
178 |
<option value="default"><?php esc_html_e( 'WordPress Default', 'custom-contact-forms' ); ?></option>
|
179 |
+
<option value="custom" <# if ( 'custom' === form.emailNotificationFromType ) { #>selected<# } #>><?php esc_html_e( 'Custom Email', 'custom-contact-forms' ); ?></option>
|
180 |
+
<option value="field" <# if ( 'field' === form.emailNotificationFromType ) { #>selected<# } #>><?php esc_html_e( 'Form Field', 'custom-contact-forms' ); ?></option>
|
181 |
</select>
|
182 |
|
183 |
<div class="explain"><?php esc_html_e( 'You can set the notification emails from address to be the WP default, a custom email address, or pull the address from a field in the form.', 'custom-contact-forms' ); ?></div>
|
185 |
|
186 |
<p class="email-notification-from-address">
|
187 |
<label for="ccf_form_email_notification_from_address"><?php esc_html_e( 'Custom "From" Email Address:', 'custom-contact-forms' ); ?></label>
|
188 |
+
<input class="widefat form-email-notification-from-address" id="ccf_form_email_notification_from_address" name="email-notification-from-address" value="{{ form.emailNotificationFromAddress }}">
|
189 |
</p>
|
190 |
|
191 |
<p class="email-notification-from-field">
|
192 |
<label for="ccf_form_email_notification_from_field"><?php esc_html_e( 'Pull "From" Email Dynamically from Field:', 'custom-contact-forms' ); ?></label>
|
193 |
+
<# if ( emailFields.length < 1 ) { #>
|
194 |
<strong><?php esc_html_e( 'There are no email fields in your form.', 'custom-contact-forms' ); ?></strong>
|
195 |
<input type="hidden" name="email_notification_from_field" value="" class="form-email-notification-from-field">
|
196 |
+
<# } else { #>
|
197 |
<select name="email_notification_from_field" class="form-email-notification-from-field" id="ccf_form_email_notification_from_field">
|
198 |
+
<# _.each( emailFields, function( field ) { #>
|
199 |
+
<option <# if ( field.get( 'slug' ) === form.emailNotificationFromField ) { #>selected<# }#>>{{ field.get( 'slug' ) }}</option>
|
200 |
+
<# }); #>
|
201 |
</select>
|
202 |
+
<# } #>
|
203 |
</p>
|
204 |
</div>
|
205 |
</script>
|
211 |
</script>
|
212 |
|
213 |
<script type="text/html" id="ccf-pagination-template">
|
214 |
+
<span class="num-items">{{ totalObjects }} <?php esc_html_e( 'items', 'custom-contact-forms' ); ?></span>
|
215 |
|
216 |
+
<a class="first <# if ( currentPage <= 1 ) { #>disabled<# } #>">«</a>
|
217 |
+
<a class="prev <# if ( currentPage <= 1 ) { #>disabled<# } #>">‹</a>
|
218 |
|
219 |
+
<span class="pages">{{ currentPage }} of {{ totalPages }}</span>
|
220 |
|
221 |
+
<a class="next <# if ( currentPage >= totalPages ) { #>disabled<# } #>">›</a>
|
222 |
+
<a class="last <# if ( currentPage >= totalPages ) { #>disabled<# } #>">»</a>
|
223 |
</script>
|
224 |
|
225 |
<script type="text/html" id="ccf-existing-form-table-template">
|
264 |
<div class="section-content">
|
265 |
<div>
|
266 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug', 'custom-contact-forms' ); ?> (a-z, 0-9, -, _):</label>
|
267 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
268 |
</div>
|
269 |
<div>
|
270 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
271 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
272 |
</div>
|
273 |
<div>
|
274 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
275 |
+
<input id="ccf-field-value" class="field-value" type="text" value="{{ field.value }}">
|
276 |
</div>
|
277 |
<div>
|
278 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
279 |
<select id="ccf-field-required" class="field-required">
|
280 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
281 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
282 |
</select>
|
283 |
</div>
|
284 |
</div>
|
288 |
<div class="section-content">
|
289 |
<div>
|
290 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
291 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
292 |
</div>
|
293 |
<div>
|
294 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
295 |
+
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="{{ field.placeholder }}">
|
296 |
</div>
|
297 |
</div>
|
298 |
</div>
|
305 |
<p><?php _e( 'reCAPTCHA is a simple captcha service provided by Google. <a target="_blank" href="https://www.google.com/recaptcha/intro/index.html">Learn more</a>', 'custom-contact-forms' ); ?></p>
|
306 |
<div>
|
307 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
308 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
309 |
</div>
|
310 |
<div>
|
311 |
<label for="ccf-field-site-key"><span class="required">*</span> <?php esc_html_e( 'Site Key:', 'custom-contact-forms' ); ?></label>
|
312 |
+
<input id="ccf-field-site-key" class="field-site-key" type="text" value="{{ field.siteKey }}">
|
313 |
<a href="http://google.com/recaptcha/" target="_blank"><?php _e( "Don't have one?", 'custom-contact-forms' ); ?></a>
|
314 |
</div>
|
315 |
<div>
|
316 |
<label for="ccf-field-secret-key"><span class="required">*</span> <?php esc_html_e( 'Secret Key:', 'custom-contact-forms' ); ?></label>
|
317 |
+
<input id="ccf-field-secret-key" class="field-secret-key" type="text" value="{{ field.secretKey }}">
|
318 |
<a href="http://google.com/recaptcha/" target="_blank"><?php _e( "Don't have one?", 'custom-contact-forms' ); ?></a>
|
319 |
</div>
|
320 |
</div>
|
324 |
<div class="section-content">
|
325 |
<div>
|
326 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
327 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
328 |
</div>
|
329 |
</div>
|
330 |
</div>
|
336 |
<div class="section-content">
|
337 |
<div>
|
338 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug', 'custom-contact-forms' ); ?> (a-z, 0-9, -, _):</label>
|
339 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
340 |
</div>
|
341 |
<div>
|
342 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
343 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
344 |
</div>
|
345 |
<div>
|
346 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
347 |
+
<input id="ccf-field-value" class="field-value" type="text" value="{{ field.value }}">
|
348 |
</div>
|
349 |
<div>
|
350 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
351 |
<select id="ccf-field-required" class="field-required">
|
352 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
353 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
354 |
</select>
|
355 |
</div>
|
356 |
</div>
|
360 |
<div class="section-content">
|
361 |
<div>
|
362 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
363 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
364 |
</div>
|
365 |
<div>
|
366 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
367 |
+
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="{{ field.placeholder }}">
|
368 |
</div>
|
369 |
</div>
|
370 |
</div>
|
376 |
<div class="section-content">
|
377 |
<div>
|
378 |
<label for="ccf-field-html"><?php esc_html_e( 'HTML Content:', 'custom-contact-forms' ); ?></label>
|
379 |
+
<textarea id="ccf-field-html" class="field-html">{{ field.html }}</textarea>
|
380 |
</div>
|
381 |
</div>
|
382 |
</div>
|
385 |
<div class="section-content">
|
386 |
<div>
|
387 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
388 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
389 |
</div>
|
390 |
</div>
|
391 |
</div>
|
397 |
<div class="section-content">
|
398 |
<div>
|
399 |
<label for="ccf-field-heading"><?php esc_html_e( 'Heading:', 'custom-contact-forms' ); ?></label>
|
400 |
+
<input id="ccf-field-heading" class="field-heading" type="text" value="{{ field.heading }}">
|
401 |
</div>
|
402 |
<div>
|
403 |
<label for="ccf-field-subheading"><?php esc_html_e( 'Sub Heading:', 'custom-contact-forms' ); ?></label>
|
404 |
+
<textarea id="ccf-field-subheading" class="field-subheading" type="text">{{ field.subheading }}</textarea>
|
405 |
</div>
|
406 |
</div>
|
407 |
</div>
|
410 |
<div class="section-content">
|
411 |
<div>
|
412 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
413 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
414 |
</div>
|
415 |
</div>
|
416 |
</div>
|
422 |
<div class="section-content">
|
423 |
<div>
|
424 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug', 'custom-contact-forms' ); ?> (a-z, 0-9, -, _):</label>
|
425 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
426 |
</div>
|
427 |
<div>
|
428 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
429 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
430 |
</div>
|
431 |
<div>
|
432 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
433 |
+
<input id="ccf-field-value" class="field-value" type="text" value="{{ field.value }}">
|
434 |
</div>
|
435 |
<div>
|
436 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
437 |
<select id="ccf-field-required" class="field-required">
|
438 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
439 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
440 |
</select>
|
441 |
</div>
|
442 |
</div>
|
446 |
<div class="section-content">
|
447 |
<div>
|
448 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
449 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
450 |
</div>
|
451 |
<div>
|
452 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
453 |
+
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="{{ field.placeholder }}">
|
454 |
</div>
|
455 |
</div>
|
456 |
</div>
|
462 |
<div class="section-content">
|
463 |
<div>
|
464 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
465 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
466 |
</div>
|
467 |
<div>
|
468 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
469 |
+
<input id="ccf-field-value" class="field-value" type="text" value="{{ field.value }}">
|
470 |
</div>
|
471 |
</div>
|
472 |
</div>
|
475 |
<div class="section-content">
|
476 |
<div>
|
477 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
478 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
479 |
</div>
|
480 |
</div>
|
481 |
</div>
|
487 |
<div class="section-content">
|
488 |
<div>
|
489 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
490 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
491 |
</div>
|
492 |
<div>
|
493 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
494 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
495 |
</div>
|
496 |
<div>
|
497 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
498 |
<select id="ccf-field-required" class="field-required">
|
499 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
500 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
501 |
</select>
|
502 |
</div>
|
503 |
</div>
|
507 |
<div class="section-content">
|
508 |
<div>
|
509 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
510 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
511 |
</div>
|
512 |
</div>
|
513 |
</div>
|
519 |
<div class="section-content">
|
520 |
<div>
|
521 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
522 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
523 |
</div>
|
524 |
<div>
|
525 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
526 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
527 |
</div>
|
528 |
+
<# if ( ! field.showTime ) { #>
|
529 |
<div>
|
530 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
531 |
+
<input id="ccf-field-value" class="field-value" type="text" value="{{ field.value }}">
|
532 |
</div>
|
533 |
+
<# } #>
|
534 |
<div>
|
535 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
536 |
<select id="ccf-field-required" class="field-required">
|
537 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
538 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
539 |
</select>
|
540 |
</div>
|
541 |
<div>
|
542 |
+
<input type="checkbox" <# if ( field.showDate ) { #>checked="checked"<# } #> class="field-show-date" value="1" id="ccf-field-show-date">
|
543 |
<label for="ccf-show-date"><?php esc_html_e( 'Enable Date Select', 'custom-contact-forms' ); ?></label>
|
544 |
</div>
|
545 |
<div>
|
546 |
+
<input type="checkbox" <# if ( field.showTime ) { #>checked="checked"<# } #> class="field-show-time" value="1" id="ccf-field-show-time">
|
547 |
<label for="ccf-show-time"><?php esc_html_e( 'Enable Time Select', 'custom-contact-forms' ); ?></label>
|
548 |
</div>
|
549 |
</div>
|
553 |
<div class="section-content">
|
554 |
<div>
|
555 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
556 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
557 |
</div>
|
558 |
+
<# if ( ! ( field.showTime && field.showDate ) ) { #>
|
559 |
<div>
|
560 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
561 |
+
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="{{ field.placeholder }}">
|
562 |
</div>
|
563 |
+
<# } #>
|
564 |
</div>
|
565 |
</div>
|
566 |
</script>
|
571 |
<div class="section-content">
|
572 |
<div>
|
573 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
574 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
575 |
</div>
|
576 |
<div>
|
577 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
578 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
579 |
</div>
|
580 |
<div>
|
581 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
582 |
+
<input id="ccf-field-value" class="field-value" type="text" value="{{ field.value }}">
|
583 |
</div>
|
584 |
<div>
|
585 |
<label for="ccf-field-phone-format"><?php esc_html_e( 'Format:', 'custom-contact-forms' ); ?></label>
|
586 |
<select id="ccf-field-phone-format" class="field-phone-format">
|
587 |
<option value="us">(xxx) xxx-xxxx</option>
|
588 |
+
<option value="international" <# if ( 'international' === field.format ) { #>selected="selected"<# } #>><?php esc_html_e( 'International', 'custom-contact-forms' ); ?></option>
|
589 |
</select>
|
590 |
</div>
|
591 |
<div>
|
592 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
593 |
<select id="ccf-field-required" class="field-required">
|
594 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
595 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
596 |
</select>
|
597 |
</div>
|
598 |
</div>
|
602 |
<div class="section-content">
|
603 |
<div>
|
604 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
605 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
606 |
</div>
|
607 |
<div>
|
608 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
609 |
+
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="{{ field.placeholder }}">
|
610 |
</div>
|
611 |
</div>
|
612 |
</div>
|
618 |
<div class="section-content">
|
619 |
<div>
|
620 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
621 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
622 |
</div>
|
623 |
<div>
|
624 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
625 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
626 |
</div>
|
627 |
<div>
|
628 |
<label for="ccf-field-address-type"><?php esc_html_e( 'Type:', 'custom-contact-forms' ); ?></label>
|
629 |
<select id="ccf-field-address-type" class="field-address-type">
|
630 |
<option value="us"><?php esc_html_e( 'United States', 'custom-contact-forms' ); ?></option>
|
631 |
+
<option value="international" <# if ( 'international' === field.format ) { #>selected="selected"<# } #>><?php esc_html_e( 'International', 'custom-contact-forms' ); ?></option>
|
632 |
</select>
|
633 |
</div>
|
634 |
<div>
|
635 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
636 |
<select id="ccf-field-required" class="field-required">
|
637 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
638 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
639 |
</select>
|
640 |
</div>
|
641 |
</div>
|
645 |
<div class="section-content">
|
646 |
<div>
|
647 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
648 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
649 |
</div>
|
650 |
</div>
|
651 |
</div>
|
657 |
<div class="section-content">
|
658 |
<div>
|
659 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
660 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
661 |
</div>
|
662 |
<div>
|
663 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
664 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
665 |
</div>
|
666 |
+
<# if ( ! field.emailConfirmation ) { #>
|
667 |
<div>
|
668 |
<label for="ccf-field-value"><?php esc_html_e( 'Initial Value:', 'custom-contact-forms' ); ?></label>
|
669 |
+
<input id="ccf-field-value" class="field-value" type="text" value="{{ field.value }}">
|
670 |
</div>
|
671 |
+
<# } #>
|
672 |
<div>
|
673 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
674 |
<select id="ccf-field-required" class="field-required">
|
675 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
676 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
677 |
</select>
|
678 |
</div>
|
679 |
<div>
|
680 |
<label for="ccf-field-email-confirmation"><?php esc_html_e( 'Require Confirmation:', 'custom-contact-forms' ); ?></label>
|
681 |
<select id="ccf-field-email-confirmation" class="field-email-confirmation">
|
682 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
683 |
+
<option value="0" <# if ( ! field.emailConfirmation ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
684 |
</select>
|
685 |
</div>
|
686 |
</div>
|
690 |
<div class="section-content">
|
691 |
<div>
|
692 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
693 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
694 |
</div>
|
695 |
+
<# if ( ! field.emailConfirmation ) { #>
|
696 |
<div>
|
697 |
<label for="ccf-field-placeholder"><?php esc_html_e( 'Placeholder Text:', 'custom-contact-forms' ); ?></label>
|
698 |
+
<input id="ccf-field-placeholder" class="field-placeholder" type="text" value="{{ field.placeholder }}">
|
699 |
</div>
|
700 |
+
<# } #>
|
701 |
</div>
|
702 |
</div>
|
703 |
</script>
|
704 |
|
705 |
<script type="text/html" id="ccf-field-choice-template">
|
706 |
<a aria-hidden="true" data-icon="" class="move"></a>
|
707 |
+
<input class="choice-selected" <# if ( choice.selected ) { #>checked<# } #> name="selected" type="checkbox" value="1">
|
708 |
+
<input class="choice-label" type="text" placeholder="<?php esc_html_e( 'Label', 'custom-contact-forms' ); ?>" value="{{ choice.label }}">
|
709 |
+
<input class="choice-value" type="text" placeholder="<?php esc_html_e( 'Value', 'custom-contact-forms' ); ?>" value="{{ choice.value }}">
|
710 |
<a aria-hidden="true" data-icon="" class="add"></a>
|
711 |
<a aria-hidden="true" data-icon="" class="delete"></a>
|
712 |
</script>
|
717 |
<div class="section-content">
|
718 |
<div>
|
719 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
720 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
721 |
</div>
|
722 |
<div>
|
723 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
724 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
725 |
</div>
|
726 |
<div>
|
727 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
728 |
<select id="ccf-field-required" class="field-required">
|
729 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
730 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
731 |
</select>
|
732 |
</div>
|
733 |
<div>
|
742 |
<div class="section-content">
|
743 |
<div>
|
744 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
745 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
746 |
</div>
|
747 |
</div>
|
748 |
</div>
|
754 |
<div class="section-content">
|
755 |
<div>
|
756 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
757 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
758 |
</div>
|
759 |
<div>
|
760 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
761 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
762 |
</div>
|
763 |
<div>
|
764 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
765 |
<select id="ccf-field-required" class="field-required">
|
766 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
767 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
768 |
</select>
|
769 |
</div>
|
770 |
<div>
|
779 |
<div class="section-content">
|
780 |
<div>
|
781 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
782 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
783 |
</div>
|
784 |
</div>
|
785 |
</div>
|
791 |
<div class="section-content">
|
792 |
<div>
|
793 |
<label for="ccf-field-slug"><span class="required">*</span> <?php esc_html_e( 'Internal Unique Slug (a-z, 0-9, -, _):', 'custom-contact-forms' ); ?></label>
|
794 |
+
<input id="ccf-field-slug" class="field-slug" type="text" value="{{ field.slug }}">
|
795 |
</div>
|
796 |
<div>
|
797 |
<label for="ccf-field-label"><?php esc_html_e( 'Label:', 'custom-contact-forms' ); ?></label>
|
798 |
+
<input id="ccf-field-label" class="field-label" type="text" value="{{ field.label }}">
|
799 |
</div>
|
800 |
<div>
|
801 |
<label for="ccf-field-required"><?php esc_html_e( 'Required:', 'custom-contact-forms' ); ?></label>
|
802 |
<select id="ccf-field-required" class="field-required">
|
803 |
<option value="1"><?php esc_html_e( 'Yes', 'custom-contact-forms' ); ?></option>
|
804 |
+
<option value="0" <# if ( ! field.required ) { #>selected="selected"<# } #>><?php esc_html_e( 'No', 'custom-contact-forms' ); ?></option>
|
805 |
</select>
|
806 |
</div>
|
807 |
<div>
|
816 |
<div class="section-content">
|
817 |
<div>
|
818 |
<label for="ccf-field-class-name"><?php esc_html_e( 'Class Name:', 'custom-contact-forms' ); ?></label>
|
819 |
+
<input id="ccf-field-class-name" class="field-class-name" type="text" value="{{ field.className }}">
|
820 |
</div>
|
821 |
</div>
|
822 |
</div>
|
829 |
</script>
|
830 |
|
831 |
<script type="text/html" id="ccf-single-line-text-preview-template">
|
832 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
833 |
+
<input disabled type="text" placeholder="{{ field.placeholder }}" value="{{ field.value }}">
|
834 |
</script>
|
835 |
|
836 |
<script type="text/html" id="ccf-recaptcha-preview-template">
|
837 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
838 |
<img class="recaptcha-preview-img" src="<?php echo plugins_url( 'img/recaptcha.png', dirname( __FILE__ )); ?>">
|
839 |
</script>
|
840 |
|
841 |
<script type="text/html" id="ccf-paragraph-text-preview-template">
|
842 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
843 |
+
<textarea placeholder="{{ field.placeholder }}" disabled>{{ field.value }}</textarea>
|
844 |
</script>
|
845 |
|
846 |
<script type="text/html" id="ccf-dropdown-preview-template">
|
847 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
848 |
<select>
|
849 |
+
<# if ( field.choices.length === 0 || ( field.choices.length === 1 && ! field.choices.at( 0 ).get( 'label' ) && ! field.choices.at( 0 ).get( 'value' ) ) ) { #>
|
850 |
<option><?php esc_html_e( 'An example choice', 'custom-contact-forms' ); ?></option>
|
851 |
+
<#} else { #>
|
852 |
+
<# field.choices.each( function( choice ) { #>
|
853 |
+
<option <# if ( choice.get( 'selected' ) ) { #>selected<# } #> value="{{ choice.get( 'value' ) }}">{{ choice.get( 'label' ) }}</option>
|
854 |
+
<# }); #>
|
855 |
+
<# } #>
|
856 |
</select>
|
857 |
</script>
|
858 |
|
859 |
<script type="text/html" id="ccf-radio-preview-template">
|
860 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
861 |
+
<# if ( field.choices.length === 0 || ( field.choices.length === 1 && ! field.choices.at( 0 ).get( 'label' ) && ! field.choices.at( 0 ).get( 'value' ) ) ) { #>
|
862 |
<div>
|
863 |
<input type="radio" value="1" checked="checked"> <label><?php esc_html_e( 'An example choice', 'custom-contact-forms' ); ?></label>
|
864 |
</div>
|
865 |
+
<#} else { #>
|
866 |
+
<# field.choices.each( function( choice ) { #>
|
867 |
<div class="choice">
|
868 |
+
<input type="radio" value="{{ choice.get( 'value' ) }}" <# if ( choice.get( 'selected' ) ) { #>checked="checked"<# } #>> <label>{{ choice.get( 'label' ) }}</label>
|
869 |
</div>
|
870 |
+
<# }); #>
|
871 |
+
<# } #>
|
872 |
</script>
|
873 |
|
874 |
<script type="text/html" id="ccf-checkboxes-preview-template">
|
875 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
876 |
+
<# if ( field.choices.length === 0 || ( field.choices.length === 1 && ! field.choices.at( 0 ).get( 'label' ) && ! field.choices.at( 0 ).get( 'value' ) ) ) { #>
|
877 |
<div>
|
878 |
<input type="checkbox" value="1" checked="checked"> <label><?php esc_html_e( 'An example choice', 'custom-contact-forms' ); ?></label>
|
879 |
</div>
|
880 |
+
<#} else { #>
|
881 |
+
<# field.choices.each( function( choice ) { #>
|
882 |
<div class="choice">
|
883 |
+
<input type="checkbox" value="{{ choice.get( 'value' ) }}" <# if ( choice.get( 'selected' ) ) { #>checked="checked"<# } #>> <label>{{ choice.get( 'label' ) }}</label>
|
884 |
</div>
|
885 |
+
<# }); #>
|
886 |
+
<# } #>
|
887 |
</script>
|
888 |
|
889 |
<script type="text/html" id="ccf-html-preview-template">
|
890 |
+
<# if ( typeof mce !== 'undefined' ) { #>
|
891 |
+
{{{ field.html }}}
|
892 |
+
<# } else { #>
|
893 |
<pre><pre><?php esc_html_e( 'Arbitrary block of HTML.', 'custom-contact-forms' ); ?></pre></pre>
|
894 |
+
<# } #>
|
895 |
</script>
|
896 |
|
897 |
<script type="text/html" id="ccf-section-header-preview-template">
|
898 |
<div class="heading">
|
899 |
+
<# if ( field.heading ) { #>{{ field.heading }}<# } else { #><?php esc_html_e( 'Section Heading', 'custom-contact-forms' ); ?><# } #>
|
900 |
</div>
|
901 |
+
<div class="subheading"><# if ( field.subheading ) { #>{{ field.subheading }}<# } else { #><?php esc_html_e( 'This is the sub-heading text.', 'custom-contact-forms' ); ?><# } #></div>
|
902 |
</script>
|
903 |
|
904 |
<script type="text/html" id="ccf-name-preview-template">
|
905 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
906 |
<div class="left">
|
907 |
<input type="text">
|
908 |
<label class="sub-label"><?php esc_html_e( 'First', 'custom-contact-forms' ); ?></label>
|
914 |
</script>
|
915 |
|
916 |
<script type="text/html" id="ccf-date-preview-template">
|
917 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
918 |
+
<# if ( field.showDate && ! field.showTime ) { #>
|
919 |
+
<input value="{{ field.value }}" class="ccf-datepicker" disabled type="text">
|
920 |
+
<# } else if ( ! field.showDate && field.showTime ) { #>
|
921 |
<div class="full">
|
922 |
<div class="hour">
|
923 |
<input type="text">
|
934 |
</select>
|
935 |
</div>
|
936 |
</div>
|
937 |
+
<# } else { #>
|
938 |
<div class="left">
|
939 |
<input class="ccf-datepicker" disabled type="text">
|
940 |
<label class="sub-label"><?php esc_html_e( 'Date', 'custom-contact-forms' ); ?></label>
|
955 |
</select>
|
956 |
</div>
|
957 |
</div>
|
958 |
+
<# } #>
|
959 |
</script>
|
960 |
|
961 |
<script type="text/html" id="ccf-address-preview-template">
|
962 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
963 |
+
<# if ( field.addressType === 'us' ) { #>
|
964 |
<div class="full">
|
965 |
<input type="text">
|
966 |
<label class="sub-label"><?php esc_html_e( 'Street Address', 'custom-contact-forms' ); ?></label>
|
985 |
<input type="text">
|
986 |
<label class="sub-label"><?php esc_html_e( 'ZIP Code', 'custom-contact-forms' ); ?></label>
|
987 |
</div>
|
988 |
+
<# } else if ( field.addressType === 'international' ) { #>
|
989 |
<div class="full">
|
990 |
<input type="text">
|
991 |
<label class="sub-label"><?php esc_html_e( 'Street Address', 'custom-contact-forms' ); ?></label>
|
1014 |
</select>
|
1015 |
<label class="sub-label"><?php esc_html_e( 'Country', 'custom-contact-forms' ); ?></label>
|
1016 |
</div>
|
1017 |
+
<# } #>
|
1018 |
</script>
|
1019 |
|
1020 |
<script type="text/html" id="ccf-email-preview-template">
|
1021 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
1022 |
+
<# if ( ! field.emailConfirmation ) { #>
|
1023 |
+
<input placeholder="<# if ( field.placeholder ) { #>{{ field.placeholder }}<# } else { #><?php esc_html_e( 'email@example.com', 'custom-contact-forms' ); ?><# } #>" disabled type="text" value="{{ field.value }}">
|
1024 |
+
<# } else { #>
|
1025 |
<div class="left">
|
1026 |
<input type="text">
|
1027 |
<div class="sub-label"><?php esc_html_e( 'Email', 'custom-contact-forms' ); ?></div>
|
1030 |
<input type="text">
|
1031 |
<div class="sub-label"><?php esc_html_e( 'Confirm Email', 'custom-contact-forms' ); ?></div>
|
1032 |
</div>
|
1033 |
+
<# } #>
|
1034 |
</script>
|
1035 |
|
1036 |
<script type="text/html" id="ccf-website-preview-template">
|
1037 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
1038 |
+
<input placeholder="<# if ( field.placeholder ) { #>{{ field.placeholder }}<# } else { #>http://<# } #>" disabled type="text" value="{{ field.value }}">
|
1039 |
</script>
|
1040 |
|
1041 |
<script type="text/html" id="ccf-phone-preview-template">
|
1042 |
+
<label>{{ field.label }} <# if ( field.required ) { #><span>*</span><# } #></label>
|
1043 |
+
<input placeholder="<# if ( field.placeholder ) { #>{{ field.placeholder }}<# } else { #>(301) 101-8976<# } #>" disabled type="text" value="{{ field.value }}">
|
1044 |
</script>
|
1045 |
|
1046 |
<script type="text/html" id="ccf-existing-form-table-row-template">
|
1047 |
|
1048 |
+
<td>{{ form.ID }}</td>
|
1049 |
<td>
|
1050 |
+
<a class="edit edit-form title" data-view="form-pane" data-form-id="{{ form.ID }}" href="#form-pane-{{ form.ID }}"><# if ( form.title ) { #>{{ form.title }}<# } else { #>{{ '<?php esc_html_e( '(No title)', 'custom-contact-forms' ); ?>' }}<# } #></a>
|
1051 |
<div class="actions">
|
1052 |
+
<a class="edit edit-form" data-view="form-pane" data-form-id="{{ form.ID }}" href="#form-pane-{{ form.ID }}"><?php esc_html_e( 'Edit', 'custom-contact-forms' ); ?></a> |
|
1053 |
<a class="insert-form-button"><?php esc_html_e( 'Insert into post', 'custom-contact-forms' ); ?></a> |
|
1054 |
<a class="delete"><?php esc_html_e( 'Trash', 'custom-contact-forms' ); ?></a>
|
1055 |
</div>
|
1056 |
</td>
|
1057 |
<td>
|
1058 |
+
{{ utils.getPrettyPostDate( form.date ) }}
|
1059 |
</td>
|
1060 |
<td>
|
1061 |
+
{{ form.author.username }}
|
1062 |
</td>
|
1063 |
<td>
|
1064 |
+
{{ form.fields.length }}
|
1065 |
</td>
|
1066 |
<td>
|
1067 |
0
|
1069 |
</script>
|
1070 |
|
1071 |
<script type="text/html" id="ccf-form-mce-preview">
|
1072 |
+
<div class="ccf-form-preview form-id-{{ form.ID }}">
|
1073 |
+
<# if ( form.title ) { #>
|
1074 |
+
<h2>{{ form.title }}</h2>
|
1075 |
+
<# } #>
|
1076 |
+
|
1077 |
+
<# if ( form.description && form.description != '' ) { #>
|
1078 |
+
<p>{{ form.description }}</p>
|
1079 |
+
<# } #>
|
1080 |
+
|
1081 |
+
<# if ( form.fields ) { #>
|
1082 |
+
<# _.each( form.fields, function( field ) { #>
|
1083 |
+
<div class="field {{ field.type }} field-{{ field.ID }}">
|
1084 |
+
{{{ field.preview }}}
|
1085 |
</div>
|
1086 |
+
<# } ); #>
|
1087 |
+
<# } #>
|
1088 |
|
1089 |
<div class="field-submit">
|
1090 |
+
<input type="button" value="{{ form.buttonText }}">
|
1091 |
</div>
|
1092 |
</div>
|
1093 |
</script>
|
1102 |
<table class="widefat fixed" cellpadding="0" cellspacing="0">
|
1103 |
<thead>
|
1104 |
<tr>
|
1105 |
+
<# _.each( columns, function( column ) { #>
|
1106 |
+
<th scope="col" class="manage-column column-{{ column }}">
|
1107 |
+
<# if ( 'date' === column ) { #>
|
1108 |
<?php esc_html_e( 'Date', 'custom-contact-forms' ); ?>
|
1109 |
+
<# } else { #>
|
1110 |
+
{{ column }}
|
1111 |
+
<# } #>
|
1112 |
</th>
|
1113 |
+
<# } ); #>
|
1114 |
<th scope="col" class="manage-column column-actions"></th>
|
1115 |
</tr>
|
1116 |
</thead>
|
1117 |
<tfoot>
|
1118 |
<tr>
|
1119 |
+
<# _.each( columns, function( column ) { #>
|
1120 |
+
<th scope="col" class="manage-column column-{{ column }}">
|
1121 |
+
<# if ( 'date' === column ) { #>
|
1122 |
<?php esc_html_e( 'Date', 'custom-contact-forms' ); ?>
|
1123 |
+
<# } else { #>
|
1124 |
+
{{ column }}
|
1125 |
+
<# } #>
|
1126 |
</th>
|
1127 |
+
<# } ); #>
|
1128 |
<th scope="col" class="manage-column column-actions"></th>
|
1129 |
</tr>
|
1130 |
</tfoot>
|
1131 |
|
1132 |
<tbody class="submission-rows">
|
1133 |
<tr>
|
1134 |
+
<td colspan="{{ columns.length + 1 }}">
|
1135 |
<div class="spinner" style="background: url( '<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>' ) no-repeat;"></div>
|
1136 |
</td>
|
1137 |
</tr>
|
1141 |
</script>
|
1142 |
|
1143 |
<script type="text/html" id="ccf-submission-row-template">
|
1144 |
+
<# _.each( currentColumns, function( column ) { #>
|
1145 |
+
<# if ( 'date' === column ) { #>
|
1146 |
+
<td colspan="1">{{ utils.getPrettyPostDate( submission.date ) }}</td>
|
1147 |
+
<# } else { #>
|
1148 |
<td colspan="1">
|
1149 |
+
<# if ( submission.data[column] ) { #>
|
1150 |
+
<# if ( submission.data[column] instanceof Object ) { var output = '', i = 0; #>
|
1151 |
+
<# if ( utils.isFieldDate( submission.data[column] ) ) { #>
|
1152 |
+
{{ utils.getPrettyFieldDate( submission.data[column] ) }}
|
1153 |
+
<# } else if ( utils.isFieldName( submission.data[column] ) ) { #>
|
1154 |
+
{{ utils.getPrettyFieldName( submission.data[column] ) }}
|
1155 |
+
<# } else if ( utils.isFieldAddress( submission.data[column] ) ) { #>
|
1156 |
+
{{ utils.wordChop( utils.getPrettyFieldAddress( submission.data[column] ), 30 ) }}
|
1157 |
+
<# } else { #>
|
1158 |
+
<# for ( var key in submission.data[column] ) { if ( submission.data[column].hasOwnProperty( key ) ) {
|
1159 |
if ( i > 0 ) {
|
1160 |
output += ', ';
|
1161 |
}
|
1162 |
output += submission.data[column][key];
|
1163 |
|
1164 |
i++;
|
1165 |
+
} } #>
|
1166 |
+
{{ utils.wordChop( output, 30 ) }}
|
1167 |
+
<# } #>
|
1168 |
+
<# } else { #>
|
1169 |
+
{{ utils.wordChop( submission.data[column] ) }}
|
1170 |
+
<# } #>
|
1171 |
+
<# } else { #>
|
1172 |
<span><?php esc_html_e( '-', 'custom-contact-forms' ); ?></span>
|
1173 |
+
<# } #>
|
1174 |
</td>
|
1175 |
+
<# } #>
|
1176 |
+
<# } ); #>
|
1177 |
<td class="actions">
|
1178 |
+
<a href="#TB_inline?height=300&width=400&inlineId=submission-content" data-submission-date="{{ submission.date }}" data-submission-id="{{ submission.ID }}" class="view" data-icon=""></a>
|
1179 |
<a class="delete" data-icon=""></a>
|
1180 |
|
1181 |
+
<div class="submission-wrapper" id="ccf-submission-content-{{ submission.ID }}">
|
1182 |
<div class="ccf-submission-content">
|
1183 |
+
<# for ( column in submission.data ) { #>
|
1184 |
<div class="field-slug">
|
1185 |
+
{{ column }}
|
1186 |
</div>
|
1187 |
<div class="field-content">
|
1188 |
+
<# if ( submission.data[column] ) { #>
|
1189 |
+
<# if ( submission.data[column] instanceof Object ) { #>
|
1190 |
+
<# if ( utils.isFieldDate( submission.data[column] ) ) { #>
|
1191 |
+
{{ utils.getPrettyFieldDate( submission.data[column] ) }}
|
1192 |
+
<# } else if ( utils.isFieldName( submission.data[column] ) ) { #>
|
1193 |
+
{{ utils.getPrettyFieldName( submission.data[column] ) }}
|
1194 |
+
<# } else if ( utils.isFieldAddress( submission.data[column] ) ) { #>
|
1195 |
+
{{ utils.getPrettyFieldAddress( submission.data[column] ) }}
|
1196 |
+
<# } else { #>
|
1197 |
+
<# for ( var key in submission.data[column] ) { if ( submission.data[column].hasOwnProperty( key ) ) { #>
|
1198 |
+
<# if ( isNaN( key ) ) { #><strong>{{ key }}:</strong> <# } #>{{ submission.data[column][key] }}<br>
|
1199 |
+
<# } } #>
|
1200 |
+
<# } #>
|
1201 |
+
<# } else { #>
|
1202 |
+
{{ submission.data[column] }}
|
1203 |
+
<# } #>
|
1204 |
+
<# } else { #>
|
1205 |
<span>-</span>
|
1206 |
+
<# } #>
|
1207 |
</div>
|
1208 |
+
<# } #>
|
1209 |
</div>
|
1210 |
</div>
|
1211 |
</td>
|
1213 |
|
1214 |
|
1215 |
<script type="text/html" id="ccf-no-submissions-row-template">
|
1216 |
+
<td colspan="{{ columns.length + 1 }}" class="no-submissions"><?php esc_html_e( 'There are no submissions.', 'custom-contact-forms' ); ?></td>
|
1217 |
</script>
|
1218 |
|
1219 |
<script type="text/html" id="ccf-submissions-controller-template">
|
1220 |
+
<# var i = 0; _.each( columns, function( column ) { #>
|
1221 |
|
1222 |
+
<label for="ccf-column-{{ column }}">
|
1223 |
+
<input class="submission-column-checkbox" type="checkbox" id="ccf-column-{{ column }}" <# if ( i < 4 || 'date' === column ) { #>checked<# } #> value="{{ column }}">
|
1224 |
+
<# if ( 'date' === column ) { #>
|
1225 |
<?php esc_html_e( 'Date', 'custom-contact-forms' ); ?>
|
1226 |
+
<# } else { #>
|
1227 |
+
{{ column }}
|
1228 |
+
<# } #>
|
1229 |
</label>
|
1230 |
|
1231 |
+
<# i++; }); #>
|
1232 |
</script>
|
1233 |
|
1234 |
<?php
|
custom-contact-forms.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: http://www.taylorlovett.com
|
5 |
* Description: Build beautiful custom forms the WordPress way. View live previews of your forms while you build them.
|
6 |
* Author: Taylor Lovett
|
7 |
-
* Version: 6.3.
|
8 |
* Author URI: http://www.taylorlovett.com
|
9 |
*/
|
10 |
|
4 |
* Plugin URI: http://www.taylorlovett.com
|
5 |
* Description: Build beautiful custom forms the WordPress way. View live previews of your forms while you build them.
|
6 |
* Author: Taylor Lovett
|
7 |
+
* Version: 6.3.2
|
8 |
* Author URI: http://www.taylorlovett.com
|
9 |
*/
|
10 |
|
js/form-cpt-preview.js
CHANGED
@@ -31,7 +31,7 @@
|
|
31 |
};
|
32 |
|
33 |
wp.ccf.preview.prototype = {
|
34 |
-
template:
|
35 |
|
36 |
fetch: function() {
|
37 |
var SELF = this;
|
@@ -64,7 +64,7 @@
|
|
64 |
var template = document.getElementById( 'ccf-' + field.get( 'type' ) + '-preview-template' );
|
65 |
|
66 |
if ( template ) {
|
67 |
-
var preview =
|
68 |
field.set( 'preview', preview );
|
69 |
}
|
70 |
});
|
31 |
};
|
32 |
|
33 |
wp.ccf.preview.prototype = {
|
34 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-form-mce-preview').innerHTML ),
|
35 |
|
36 |
fetch: function() {
|
37 |
var SELF = this;
|
64 |
var template = document.getElementById( 'ccf-' + field.get( 'type' ) + '-preview-template' );
|
65 |
|
66 |
if ( template ) {
|
67 |
+
var preview = wp.ccf.utils.template( template.innerHTML )( { field: field.toJSON(), mce: true } );
|
68 |
field.set( 'preview', preview );
|
69 |
}
|
70 |
});
|
js/form-mce.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
forms: {},
|
7 |
|
8 |
View: {
|
9 |
-
template:
|
10 |
|
11 |
type: 'video',
|
12 |
|
@@ -72,7 +72,7 @@
|
|
72 |
var template = document.getElementById( 'ccf-' + field.get( 'type' ) + '-preview-template' );
|
73 |
|
74 |
if ( template ) {
|
75 |
-
var preview =
|
76 |
field.set( 'preview', preview );
|
77 |
}
|
78 |
});
|
@@ -91,7 +91,7 @@
|
|
91 |
if ( this.formFetch.state() === 'resolved' ) {
|
92 |
return this.template( { form: form.toJSON() } );
|
93 |
} else {
|
94 |
-
return
|
95 |
}
|
96 |
}
|
97 |
}
|
6 |
forms: {},
|
7 |
|
8 |
View: {
|
9 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-form-mce-preview').innerHTML ),
|
10 |
|
11 |
type: 'video',
|
12 |
|
72 |
var template = document.getElementById( 'ccf-' + field.get( 'type' ) + '-preview-template' );
|
73 |
|
74 |
if ( template ) {
|
75 |
+
var preview = wp.ccf.utils.template( template.innerHTML )( { field: field.toJSON(), mce: true } );
|
76 |
field.set( 'preview', preview );
|
77 |
}
|
78 |
});
|
91 |
if ( this.formFetch.state() === 'resolved' ) {
|
92 |
return this.template( { form: form.toJSON() } );
|
93 |
} else {
|
94 |
+
return wp.ccf.utils.template( document.getElementById( 'ccf-form-mce-error-preview' ).innerHTML )();
|
95 |
}
|
96 |
}
|
97 |
}
|
js/manager/utils.js
CHANGED
@@ -14,6 +14,17 @@
|
|
14 |
delete object.modified_tz;
|
15 |
};
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
wp.ccf.utils.insertFormShortcode = function( form ) {
|
18 |
var existingForm = wp.ccf.forms.findWhere( { ID: form.get( 'ID' ) } );
|
19 |
if ( ! existingForm ) {
|
14 |
delete object.modified_tz;
|
15 |
};
|
16 |
|
17 |
+
wp.ccf.utils.template = function ( template ) {
|
18 |
+
// Use WordPress style Backbone template syntax
|
19 |
+
var options = {
|
20 |
+
evaluate: /<#([\s\S]+?)#>/g,
|
21 |
+
interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
|
22 |
+
escape: /\{\{([^\}]+?)\}\}(?!\})/g
|
23 |
+
};
|
24 |
+
|
25 |
+
return _.template( template, null, options );
|
26 |
+
};
|
27 |
+
|
28 |
wp.ccf.utils.insertFormShortcode = function( form ) {
|
29 |
var existingForm = wp.ccf.forms.findWhere( { ID: form.get( 'ID' ) } );
|
30 |
if ( ! existingForm ) {
|
js/manager/views.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
|
7 |
wp.ccf.views.FieldChoice = Backbone.View.extend(
|
8 |
{
|
9 |
-
template:
|
10 |
className: 'choice',
|
11 |
|
12 |
events: {
|
@@ -148,7 +148,7 @@
|
|
148 |
|
149 |
wp.ccf.views.Fields['single-line-text'] = wp.ccf.views.Fields['single-line-text'] || wp.ccf.views.FieldBase.extend(
|
150 |
{
|
151 |
-
template:
|
152 |
|
153 |
initialize: function() {
|
154 |
|
@@ -170,7 +170,7 @@
|
|
170 |
|
171 |
wp.ccf.views.Fields.recaptcha = wp.ccf.views.Fields.recaptcha || wp.ccf.views.FieldBase.extend(
|
172 |
{
|
173 |
-
template:
|
174 |
|
175 |
initialize: function() {
|
176 |
|
@@ -189,7 +189,7 @@
|
|
189 |
|
190 |
wp.ccf.views.Fields['section-header'] = wp.ccf.views.Fields['section-header'] || wp.ccf.views.FieldBase.extend(
|
191 |
{
|
192 |
-
template:
|
193 |
|
194 |
initialize: function() {
|
195 |
|
@@ -207,7 +207,7 @@
|
|
207 |
|
208 |
wp.ccf.views.Fields.html = wp.ccf.views.Fields.html || wp.ccf.views.FieldBase.extend(
|
209 |
{
|
210 |
-
template:
|
211 |
|
212 |
initialize: function() {
|
213 |
|
@@ -224,7 +224,7 @@
|
|
224 |
|
225 |
wp.ccf.views.Fields['paragraph-text'] = wp.ccf.views.Fields['paragraph-text'] || wp.ccf.views.FieldBase.extend(
|
226 |
{
|
227 |
-
template:
|
228 |
|
229 |
saveField: function() {
|
230 |
|
@@ -242,7 +242,7 @@
|
|
242 |
|
243 |
wp.ccf.views.Fields.hidden = wp.ccf.views.Fields.hidden || wp.ccf.views.FieldBase.extend(
|
244 |
{
|
245 |
-
template:
|
246 |
|
247 |
saveField: function() {
|
248 |
|
@@ -257,7 +257,7 @@
|
|
257 |
|
258 |
wp.ccf.views.Fields.date = wp.ccf.views.Fields.date || wp.ccf.views.FieldBase.extend(
|
259 |
{
|
260 |
-
template:
|
261 |
|
262 |
saveField: function() {
|
263 |
|
@@ -289,7 +289,7 @@
|
|
289 |
|
290 |
wp.ccf.views.Fields.name = wp.ccf.views.Fields.name || wp.ccf.views.FieldBase.extend(
|
291 |
{
|
292 |
-
template:
|
293 |
|
294 |
saveField: function() {
|
295 |
|
@@ -305,7 +305,7 @@
|
|
305 |
|
306 |
wp.ccf.views.Fields.website = wp.ccf.views.Fields.website || wp.ccf.views.FieldBase.extend(
|
307 |
{
|
308 |
-
template:
|
309 |
|
310 |
saveField: function() {
|
311 |
|
@@ -323,7 +323,7 @@
|
|
323 |
|
324 |
wp.ccf.views.Fields.phone = wp.ccf.views.Fields.phone || wp.ccf.views.FieldBase.extend(
|
325 |
{
|
326 |
-
template:
|
327 |
|
328 |
saveField: function() {
|
329 |
|
@@ -342,7 +342,7 @@
|
|
342 |
|
343 |
wp.ccf.views.Fields.address = wp.ccf.views.Fields.address || wp.ccf.views.FieldBase.extend(
|
344 |
{
|
345 |
-
template:
|
346 |
|
347 |
saveField: function() {
|
348 |
|
@@ -359,7 +359,7 @@
|
|
359 |
|
360 |
wp.ccf.views.Fields.email = wp.ccf.views.Fields.email || wp.ccf.views.FieldBase.extend(
|
361 |
{
|
362 |
-
template:
|
363 |
|
364 |
saveField: function() {
|
365 |
|
@@ -395,7 +395,7 @@
|
|
395 |
|
396 |
wp.ccf.views.ChoiceableField = wp.ccf.views.ChoiceableField || wp.ccf.views.FieldBase.extend(
|
397 |
{
|
398 |
-
template:
|
399 |
|
400 |
initialize: function() {
|
401 |
var choices = this.model.get( 'choices' );
|
@@ -466,7 +466,7 @@
|
|
466 |
|
467 |
wp.ccf.views.Fields.dropdown = wp.ccf.views.Fields.dropdown || wp.ccf.views.ChoiceableField.extend(
|
468 |
{
|
469 |
-
template:
|
470 |
events: function() {
|
471 |
return this.constructor.__super__.events;
|
472 |
}
|
@@ -475,7 +475,7 @@
|
|
475 |
|
476 |
wp.ccf.views.Fields.radio = wp.ccf.views.Fields.radio || wp.ccf.views.ChoiceableField.extend(
|
477 |
{
|
478 |
-
template:
|
479 |
events: function() {
|
480 |
return this.constructor.__super__.events;
|
481 |
}
|
@@ -484,7 +484,7 @@
|
|
484 |
|
485 |
wp.ccf.views.Fields.checkboxes = wp.ccf.views.Fields.checkboxes || wp.ccf.views.ChoiceableField.extend(
|
486 |
{
|
487 |
-
template:
|
488 |
events: function() {
|
489 |
return this.constructor.__super__.events;
|
490 |
}
|
@@ -530,7 +530,7 @@
|
|
530 |
var context = {};
|
531 |
|
532 |
if ( ! field ) {
|
533 |
-
var template =
|
534 |
this.el.innerHTML = template( context );
|
535 |
} else {
|
536 |
var type = field.get( 'type' );
|
@@ -565,7 +565,7 @@
|
|
565 |
|
566 |
wp.ccf.views.FieldRowPlaceholder = wp.ccf.views.FieldRowPlaceholder || Backbone.View.extend(
|
567 |
{
|
568 |
-
template:
|
569 |
tagName: 'div',
|
570 |
className: 'field',
|
571 |
|
@@ -586,7 +586,7 @@
|
|
586 |
|
587 |
wp.ccf.views.FieldRow = wp.ccf.views.FieldRow || Backbone.View.extend(
|
588 |
{
|
589 |
-
template:
|
590 |
tagName: 'div',
|
591 |
className: 'field',
|
592 |
|
@@ -670,7 +670,7 @@
|
|
670 |
if ( previewTemplate ) {
|
671 |
var preview = this.el.querySelectorAll( '.preview' )[0];
|
672 |
preview.style.display = 'block';
|
673 |
-
preview.innerHTML =
|
674 |
}
|
675 |
|
676 |
return this;
|
@@ -680,7 +680,7 @@
|
|
680 |
|
681 |
wp.ccf.views.FormSettings = wp.ccf.views.FormSettings || Backbone.View.extend(
|
682 |
{
|
683 |
-
template:
|
684 |
|
685 |
events: {
|
686 |
'blur input': 'save',
|
@@ -763,7 +763,7 @@
|
|
763 |
|
764 |
wp.ccf.views.FormNotifications = wp.ccf.views.FormNotifications || Backbone.View.extend(
|
765 |
{
|
766 |
-
template:
|
767 |
|
768 |
events: {
|
769 |
'blur input': 'save',
|
@@ -876,7 +876,7 @@
|
|
876 |
|
877 |
wp.ccf.views.FormPane = wp.ccf.views.FormPane || Backbone.View.extend( _.defaults(
|
878 |
{
|
879 |
-
template:
|
880 |
subViews: {
|
881 |
'field-sidebar': wp.ccf.views.FieldSidebar,
|
882 |
'form-settings': wp.ccf.views.FormSettings,
|
@@ -1130,7 +1130,7 @@
|
|
1130 |
wp.ccf.views.ExistingFormTableRow = wp.ccf.views.ExistingFormTableRow || Backbone.View.extend(
|
1131 |
{
|
1132 |
tagName: 'tr',
|
1133 |
-
template:
|
1134 |
events: {
|
1135 |
'click .edit': 'triggerMainViewChange',
|
1136 |
'click .delete': 'triggerDelete',
|
@@ -1179,7 +1179,7 @@
|
|
1179 |
wp.ccf.views.EmptyFormTableRow = wp.ccf.views.EmptyFormTableRow || Backbone.View.extend(
|
1180 |
{
|
1181 |
tagName: 'tr',
|
1182 |
-
template:
|
1183 |
|
1184 |
render: function() {
|
1185 |
this.$el.html( this.template() );
|
@@ -1190,7 +1190,7 @@
|
|
1190 |
|
1191 |
wp.ccf.views.ExistingFormTable = wp.ccf.views.ExistingFormTable || Backbone.View.extend(
|
1192 |
{
|
1193 |
-
template:
|
1194 |
|
1195 |
initialize: function() {
|
1196 |
this.parent = arguments.parent;
|
@@ -1255,7 +1255,7 @@
|
|
1255 |
|
1256 |
wp.ccf.views.ExistingFormPane = wp.ccf.views.ExistingFormPane || Backbone.View.extend( _.defaults(
|
1257 |
{
|
1258 |
-
template:
|
1259 |
subViews: {
|
1260 |
'existing-form-table': wp.ccf.views.ExistingFormTable
|
1261 |
},
|
@@ -1280,7 +1280,7 @@
|
|
1280 |
{
|
1281 |
tagName: 'div',
|
1282 |
className: 'ccf-main-modal',
|
1283 |
-
template:
|
1284 |
events: {
|
1285 |
'click .close-icon': 'hide',
|
1286 |
'click .main-menu a': 'menuClick'
|
@@ -1376,7 +1376,7 @@
|
|
1376 |
wp.ccf.views.SubmissionRow = wp.ccf.views.SubmissionRow || Backbone.View.extend(
|
1377 |
{
|
1378 |
tagName: 'tr',
|
1379 |
-
template:
|
1380 |
events: {
|
1381 |
'click .view': 'view',
|
1382 |
'click .delete': 'delete'
|
@@ -1436,7 +1436,7 @@
|
|
1436 |
|
1437 |
wp.ccf.views.SubmissionsTable = wp.ccf.views.SubmissionsTable || Backbone.View.extend(
|
1438 |
{
|
1439 |
-
template:
|
1440 |
events: {
|
1441 |
'click .prev:not(.disabled)': 'previousPage',
|
1442 |
'click .next:not(.disabled)': 'nextPage',
|
@@ -1512,7 +1512,7 @@
|
|
1512 |
|
1513 |
wp.ccf.views.Pagination = wp.ccf.views.Pagination || Backbone.View.extend(
|
1514 |
{
|
1515 |
-
template:
|
1516 |
|
1517 |
events: {
|
1518 |
'click .prev:not(.disabled)': 'previousPage',
|
@@ -1568,7 +1568,7 @@
|
|
1568 |
wp.ccf.views.EmptySubmissionTableRow = wp.ccf.views.EmptySubmissionTableRow || Backbone.View.extend(
|
1569 |
{
|
1570 |
tagName: 'tr',
|
1571 |
-
template:
|
1572 |
|
1573 |
initialize: function( options ) {
|
1574 |
this.parent = options.parent;
|
@@ -1583,7 +1583,7 @@
|
|
1583 |
|
1584 |
wp.ccf.views.SubmissionColumnController = wp.ccf.views.SubmissionColumnController || Backbone.View.extend(
|
1585 |
{
|
1586 |
-
template:
|
1587 |
|
1588 |
events: {
|
1589 |
'click input[type=checkbox]': 'triggerTableRebuild'
|
6 |
|
7 |
wp.ccf.views.FieldChoice = Backbone.View.extend(
|
8 |
{
|
9 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-field-choice-template' ).innerHTML ),
|
10 |
className: 'choice',
|
11 |
|
12 |
events: {
|
148 |
|
149 |
wp.ccf.views.Fields['single-line-text'] = wp.ccf.views.Fields['single-line-text'] || wp.ccf.views.FieldBase.extend(
|
150 |
{
|
151 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-single-line-text-template' ).innerHTML ),
|
152 |
|
153 |
initialize: function() {
|
154 |
|
170 |
|
171 |
wp.ccf.views.Fields.recaptcha = wp.ccf.views.Fields.recaptcha || wp.ccf.views.FieldBase.extend(
|
172 |
{
|
173 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-recaptcha-template' ).innerHTML ),
|
174 |
|
175 |
initialize: function() {
|
176 |
|
189 |
|
190 |
wp.ccf.views.Fields['section-header'] = wp.ccf.views.Fields['section-header'] || wp.ccf.views.FieldBase.extend(
|
191 |
{
|
192 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-section-header-template' ).innerHTML ),
|
193 |
|
194 |
initialize: function() {
|
195 |
|
207 |
|
208 |
wp.ccf.views.Fields.html = wp.ccf.views.Fields.html || wp.ccf.views.FieldBase.extend(
|
209 |
{
|
210 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-html-template' ).innerHTML ),
|
211 |
|
212 |
initialize: function() {
|
213 |
|
224 |
|
225 |
wp.ccf.views.Fields['paragraph-text'] = wp.ccf.views.Fields['paragraph-text'] || wp.ccf.views.FieldBase.extend(
|
226 |
{
|
227 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-paragraph-text-template' ).innerHTML ),
|
228 |
|
229 |
saveField: function() {
|
230 |
|
242 |
|
243 |
wp.ccf.views.Fields.hidden = wp.ccf.views.Fields.hidden || wp.ccf.views.FieldBase.extend(
|
244 |
{
|
245 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-hidden-template' ).innerHTML ),
|
246 |
|
247 |
saveField: function() {
|
248 |
|
257 |
|
258 |
wp.ccf.views.Fields.date = wp.ccf.views.Fields.date || wp.ccf.views.FieldBase.extend(
|
259 |
{
|
260 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-date-template' ).innerHTML ),
|
261 |
|
262 |
saveField: function() {
|
263 |
|
289 |
|
290 |
wp.ccf.views.Fields.name = wp.ccf.views.Fields.name || wp.ccf.views.FieldBase.extend(
|
291 |
{
|
292 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-name-template' ).innerHTML ),
|
293 |
|
294 |
saveField: function() {
|
295 |
|
305 |
|
306 |
wp.ccf.views.Fields.website = wp.ccf.views.Fields.website || wp.ccf.views.FieldBase.extend(
|
307 |
{
|
308 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-website-template' ).innerHTML ),
|
309 |
|
310 |
saveField: function() {
|
311 |
|
323 |
|
324 |
wp.ccf.views.Fields.phone = wp.ccf.views.Fields.phone || wp.ccf.views.FieldBase.extend(
|
325 |
{
|
326 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-phone-template' ).innerHTML ),
|
327 |
|
328 |
saveField: function() {
|
329 |
|
342 |
|
343 |
wp.ccf.views.Fields.address = wp.ccf.views.Fields.address || wp.ccf.views.FieldBase.extend(
|
344 |
{
|
345 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-address-template' ).innerHTML ),
|
346 |
|
347 |
saveField: function() {
|
348 |
|
359 |
|
360 |
wp.ccf.views.Fields.email = wp.ccf.views.Fields.email || wp.ccf.views.FieldBase.extend(
|
361 |
{
|
362 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-email-template' ).innerHTML ),
|
363 |
|
364 |
saveField: function() {
|
365 |
|
395 |
|
396 |
wp.ccf.views.ChoiceableField = wp.ccf.views.ChoiceableField || wp.ccf.views.FieldBase.extend(
|
397 |
{
|
398 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-dropdown-template' ).innerHTML ),
|
399 |
|
400 |
initialize: function() {
|
401 |
var choices = this.model.get( 'choices' );
|
466 |
|
467 |
wp.ccf.views.Fields.dropdown = wp.ccf.views.Fields.dropdown || wp.ccf.views.ChoiceableField.extend(
|
468 |
{
|
469 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-dropdown-template' ).innerHTML ),
|
470 |
events: function() {
|
471 |
return this.constructor.__super__.events;
|
472 |
}
|
475 |
|
476 |
wp.ccf.views.Fields.radio = wp.ccf.views.Fields.radio || wp.ccf.views.ChoiceableField.extend(
|
477 |
{
|
478 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-radio-template' ).innerHTML ),
|
479 |
events: function() {
|
480 |
return this.constructor.__super__.events;
|
481 |
}
|
484 |
|
485 |
wp.ccf.views.Fields.checkboxes = wp.ccf.views.Fields.checkboxes || wp.ccf.views.ChoiceableField.extend(
|
486 |
{
|
487 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-checkboxes-template' ).innerHTML ),
|
488 |
events: function() {
|
489 |
return this.constructor.__super__.events;
|
490 |
}
|
530 |
var context = {};
|
531 |
|
532 |
if ( ! field ) {
|
533 |
+
var template = wp.ccf.utils.template( document.getElementById( 'ccf-empty-field-template' ).innerHTML );
|
534 |
this.el.innerHTML = template( context );
|
535 |
} else {
|
536 |
var type = field.get( 'type' );
|
565 |
|
566 |
wp.ccf.views.FieldRowPlaceholder = wp.ccf.views.FieldRowPlaceholder || Backbone.View.extend(
|
567 |
{
|
568 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-field-row-template').innerHTML ),
|
569 |
tagName: 'div',
|
570 |
className: 'field',
|
571 |
|
586 |
|
587 |
wp.ccf.views.FieldRow = wp.ccf.views.FieldRow || Backbone.View.extend(
|
588 |
{
|
589 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-field-row-template').innerHTML ),
|
590 |
tagName: 'div',
|
591 |
className: 'field',
|
592 |
|
670 |
if ( previewTemplate ) {
|
671 |
var preview = this.el.querySelectorAll( '.preview' )[0];
|
672 |
preview.style.display = 'block';
|
673 |
+
preview.innerHTML = wp.ccf.utils.template( previewTemplate.innerHTML )( { field: this.model.toJSON() } );
|
674 |
}
|
675 |
|
676 |
return this;
|
680 |
|
681 |
wp.ccf.views.FormSettings = wp.ccf.views.FormSettings || Backbone.View.extend(
|
682 |
{
|
683 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-form-settings-template' ).innerHTML ),
|
684 |
|
685 |
events: {
|
686 |
'blur input': 'save',
|
763 |
|
764 |
wp.ccf.views.FormNotifications = wp.ccf.views.FormNotifications || Backbone.View.extend(
|
765 |
{
|
766 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-form-notifications-template' ).innerHTML ),
|
767 |
|
768 |
events: {
|
769 |
'blur input': 'save',
|
876 |
|
877 |
wp.ccf.views.FormPane = wp.ccf.views.FormPane || Backbone.View.extend( _.defaults(
|
878 |
{
|
879 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-form-pane-template' ).innerHTML ),
|
880 |
subViews: {
|
881 |
'field-sidebar': wp.ccf.views.FieldSidebar,
|
882 |
'form-settings': wp.ccf.views.FormSettings,
|
1130 |
wp.ccf.views.ExistingFormTableRow = wp.ccf.views.ExistingFormTableRow || Backbone.View.extend(
|
1131 |
{
|
1132 |
tagName: 'tr',
|
1133 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-existing-form-table-row-template').innerHTML ),
|
1134 |
events: {
|
1135 |
'click .edit': 'triggerMainViewChange',
|
1136 |
'click .delete': 'triggerDelete',
|
1179 |
wp.ccf.views.EmptyFormTableRow = wp.ccf.views.EmptyFormTableRow || Backbone.View.extend(
|
1180 |
{
|
1181 |
tagName: 'tr',
|
1182 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-empty-form-table-row-template').innerHTML ),
|
1183 |
|
1184 |
render: function() {
|
1185 |
this.$el.html( this.template() );
|
1190 |
|
1191 |
wp.ccf.views.ExistingFormTable = wp.ccf.views.ExistingFormTable || Backbone.View.extend(
|
1192 |
{
|
1193 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-existing-form-table-template').innerHTML ),
|
1194 |
|
1195 |
initialize: function() {
|
1196 |
this.parent = arguments.parent;
|
1255 |
|
1256 |
wp.ccf.views.ExistingFormPane = wp.ccf.views.ExistingFormPane || Backbone.View.extend( _.defaults(
|
1257 |
{
|
1258 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-existing-form-pane-template' ).innerHTML ),
|
1259 |
subViews: {
|
1260 |
'existing-form-table': wp.ccf.views.ExistingFormTable
|
1261 |
},
|
1280 |
{
|
1281 |
tagName: 'div',
|
1282 |
className: 'ccf-main-modal',
|
1283 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-main-modal-template' ).innerHTML ),
|
1284 |
events: {
|
1285 |
'click .close-icon': 'hide',
|
1286 |
'click .main-menu a': 'menuClick'
|
1376 |
wp.ccf.views.SubmissionRow = wp.ccf.views.SubmissionRow || Backbone.View.extend(
|
1377 |
{
|
1378 |
tagName: 'tr',
|
1379 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-submission-row-template' ).innerHTML ),
|
1380 |
events: {
|
1381 |
'click .view': 'view',
|
1382 |
'click .delete': 'delete'
|
1436 |
|
1437 |
wp.ccf.views.SubmissionsTable = wp.ccf.views.SubmissionsTable || Backbone.View.extend(
|
1438 |
{
|
1439 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-submission-table-template' ).innerHTML ),
|
1440 |
events: {
|
1441 |
'click .prev:not(.disabled)': 'previousPage',
|
1442 |
'click .next:not(.disabled)': 'nextPage',
|
1512 |
|
1513 |
wp.ccf.views.Pagination = wp.ccf.views.Pagination || Backbone.View.extend(
|
1514 |
{
|
1515 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-pagination-template' ).innerHTML ),
|
1516 |
|
1517 |
events: {
|
1518 |
'click .prev:not(.disabled)': 'previousPage',
|
1568 |
wp.ccf.views.EmptySubmissionTableRow = wp.ccf.views.EmptySubmissionTableRow || Backbone.View.extend(
|
1569 |
{
|
1570 |
tagName: 'tr',
|
1571 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-no-submissions-row-template').innerHTML ),
|
1572 |
|
1573 |
initialize: function( options ) {
|
1574 |
this.parent = options.parent;
|
1583 |
|
1584 |
wp.ccf.views.SubmissionColumnController = wp.ccf.views.SubmissionColumnController || Backbone.View.extend(
|
1585 |
{
|
1586 |
+
template: wp.ccf.utils.template( document.getElementById( 'ccf-submissions-controller-template').innerHTML ),
|
1587 |
|
1588 |
events: {
|
1589 |
'click input[type=checkbox]': 'triggerTableRebuild'
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers, forms
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 6.3.
|
8 |
|
9 |
Build beautiful custom forms the WordPress way. View live previews of your forms while you build them.
|
10 |
|
@@ -31,7 +31,10 @@ Please refer to [Github](http://github.com/tlovett1/custom-contact-forms) for de
|
|
31 |
|
32 |
For questions, feature requests, and support concerning the Custom Contact Forms plugin, please refer to [Github](http://github.com/tlovett1/custom-contact-forms).
|
33 |
|
34 |
-
|
|
|
|
|
|
|
35 |
|
36 |
= 6.3.1 =
|
37 |
* Fix email confirm in from email submission sending
|
4 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers, forms
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 6.3.2
|
8 |
|
9 |
Build beautiful custom forms the WordPress way. View live previews of your forms while you build them.
|
10 |
|
31 |
|
32 |
For questions, feature requests, and support concerning the Custom Contact Forms plugin, please refer to [Github](http://github.com/tlovett1/custom-contact-forms).
|
33 |
|
34 |
+
== Changelog ==
|
35 |
+
|
36 |
+
= 6.3.2 =
|
37 |
+
* Change underscores style templating to account for when ASP tags are turned on.
|
38 |
|
39 |
= 6.3.1 =
|
40 |
* Fix email confirm in from email submission sending
|