apostrophe-forms
Advanced tools
Comparing version 0.5.13 to 0.5.14
{ | ||
"name": "apostrophe-forms", | ||
"version": "0.5.13", | ||
"version": "0.5.14", | ||
"description": "Allow your users to build forms on the fly on their Apostrophe sites", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,2 +7,3 @@ apos.widgetPlayers.forms = function($el) { | ||
// Before we setup our submit event, let's get sections working. | ||
if ($form.find('[data-forms-section-break]').length > 0){ | ||
@@ -12,5 +13,6 @@ initSections($form); | ||
//Handle the form submission event. | ||
$form.on('submit', function(e) { | ||
e.preventDefault(); | ||
console.log("I will try to submit..."); | ||
var action = $form.attr('action'); | ||
@@ -31,3 +33,3 @@ var result = {}; | ||
} | ||
console.log($el, data); | ||
$el.html(data.replacement); | ||
@@ -68,3 +70,2 @@ return; | ||
apos.on('sanitizeForm', function($form, result, errors) { | ||
console.log($form); | ||
$form.find('[data-forms-checkboxes]').each(function() { | ||
@@ -95,7 +96,7 @@ var $field = $(this); | ||
apos.on('sanitizeForm', function($form, result, errors) { | ||
// apos.on('sanitizeForm', function($form, result, errors) { | ||
// | ||
// }); | ||
}); | ||
apos.on('previewTabReady', function(self) { | ||
@@ -163,5 +164,11 @@ //instantiate selectize for dropdowns | ||
}); | ||
return callback(); | ||
return buildPager($sections, callback); | ||
}; | ||
function buildPager($sections, callback){ | ||
var $pager = $form.find('[data-forms-pager]'); | ||
$pager.text('1 of ' + $sections.length); | ||
return callback(); | ||
} | ||
//function to init and handle next/prev events. | ||
@@ -199,6 +206,12 @@ function addSectionListeners($sections){ | ||
$sections.eq(index).toggleClass('active', true); | ||
setPager(index); | ||
}); | ||
} | ||
function setPager(index){ | ||
var $pager = $form.find('[data-forms-pager]'); | ||
$pager.text(index + 1 +' of ' + $sections.length); | ||
} | ||
}; | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
63267
1010