diff --git a/README.md b/README.md index 4063a6f..6acd228 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The best forms just got better! Ideal Forms 3 is smaller, faster, and more exten - Custom checkboxes, radios and file inputs - Custom seamless jQuery UI datepicker - Support for third party extensions -- Localization (todo) +- Localization ### Major changes since version 2 @@ -33,7 +33,7 @@ Ideal Forms 3 is **not** compatible with version 2. You can still find Ideal For ### TODO -- i18n +- Bring back other languages to Ideal Forms 3 ## Table of Contents @@ -54,6 +54,7 @@ Ideal Forms 3 is **not** compatible with version 2. You can still find Ideal For - [Adaptive](#extension-adaptive) - [Custom Rules](#custom-rules) - [Custom Extensions](#custom-extensions) +- [Localization](#localization) - [Themes](#themes) - [FAQ](#faq) - [Build & Share](#build--share) @@ -84,6 +85,7 @@ $('form').idealforms({ options }); ```javascript defaults = { + i18n: 'en', field: '.field', error: '.error', iconHtml: '', @@ -98,6 +100,10 @@ defaults = { } ``` +### i18n + +Localize Ideal Forms. See [Localization](#localization). + ### field The field container for [custom markup](#custom-markup). @@ -320,7 +326,7 @@ A rule must be in this format `rule:param` where `rule` is the name of the `rule To call a method run `idealforms` on the form and pass the method and arguments: -```javascript +```javascript` $('form').idealforms('method', arg1, arg2, ...); ``` @@ -722,7 +728,7 @@ To add a custom extension provide a `name`, extended `options` and extended `met - **focusFirstInvalid:** Inject code when the first input is focused. - **reset(name):** Reset the form. `name` is an input name, if any. Check the [reset](#idealformsreset-name) method. -It is recommended that you always namespace your extension, by prefixing it with a unique identifier: +It is recommended that you always namespace your extension, by prefixing it with a unique identifier. To allow for Ideal Forms localization, add the `i18n` option and all the strings that may change inside, then build your extension with localization in mind: ```javascript $.idealforms.addExtension({ @@ -730,14 +736,19 @@ $.idealforms.addExtension({ name: 'MY_extensionName', options: { - MY_option: 'default' + MY_extension: { + option: 'default', + i18n: { + initialized: 'Initialized' + } + } }, methods: { // @extend _init: function() { - + console.log(this.opts.i18n.initialized +'!'); }, MY_newMethod: function() { @@ -759,6 +770,50 @@ _init: function() { [![TOC](http://i.imgur.com/RDbarNr.png)](#table-of-contents) +## Localization + +To localize Ideal Forms load the corresponding i18n file from `js/i18n` **after** the plugin and pass the `i18n` option: + +```html + + + + +``` + +Creating your own locale file: + +```javascript +/** + * i18n ES + */ +$.idealforms.i18n.es = { + + customInputs: { + open: 'Abrir' + }, + + steps: { + step: 'Paso' + }, + + errors: { + required: 'Este campo es obligatorio', + digits: 'Debe contener sólo cifras', + name: 'Debe contener al menos 3 caracteres y contener únicamente letras', + ... + } +}; + +``` + +External plugins like the jQuery UI datepicker have to be localized separately in their own way. + ## Themes Ideal Forms 3 themes are built with [Stylus](http://learnboost.github.io/stylus/). To create your own theme to use with the default markup open `styl/vars.stly`, modify what you need and [compile](#build--share). diff --git a/js/extensions/ajax/ajax.ext.js b/js/extensions/ajax/ajax.ext.js index f716dd1..a836dd2 100644 --- a/js/extensions/ajax/ajax.ext.js +++ b/js/extensions/ajax/ajax.ext.js @@ -9,9 +9,7 @@ module.exports = { $.extend($.idealforms, { _requests: {} }); - $.extend($.idealforms.errors, { - ajax: 'Loading...' - }); + $.idealforms.errors.ajax = $.idealforms.errors.ajax || 'Loading...'; $.extend($.idealforms.rules, { diff --git a/js/extensions/custom-inputs/custom-inputs.ext.js b/js/extensions/custom-inputs/custom-inputs.ext.js index 4d67967..b2c0b78 100644 --- a/js/extensions/custom-inputs/custom-inputs.ext.js +++ b/js/extensions/custom-inputs/custom-inputs.ext.js @@ -5,6 +5,14 @@ module.exports = { name: 'customInputs', + options: { + customInputs: { + i18n: { + open: 'Open' + } + } + }, + methods: { // @extend @@ -17,7 +25,7 @@ module.exports = { }, _buildCustomInputs: function() { - this.$form.find(':file').idealfile(); + this.$form.find(':file').idealfile(this.opts.customInputs.i18n); this.$form.find(':checkbox, :radio').idealradiocheck(); } diff --git a/js/extensions/custom-inputs/idealfile.js b/js/extensions/custom-inputs/idealfile.js index 27fd1b0..d96e08a 100644 --- a/js/extensions/custom-inputs/idealfile.js +++ b/js/extensions/custom-inputs/idealfile.js @@ -10,6 +10,10 @@ plugin.name = 'idealfile'; + plugin.defaults = { + open: 'Open' + }; + plugin.methods = { _init: function() { @@ -18,9 +22,9 @@ , $wrap = $('
') , $input = $('') // Button that will be used in non-IE browsers - , $button = $('') + , $button = $('') // Hack for IE - , $label = $(''); + , $label = $(''); if (isIE) $label.add($button).addClass('ie'); diff --git a/js/extensions/steps/steps.ext.js b/js/extensions/steps/steps.ext.js index 8bb7de1..abf98d7 100644 --- a/js/extensions/steps/steps.ext.js +++ b/js/extensions/steps/steps.ext.js @@ -5,19 +5,25 @@ module.exports = { name: 'steps', options: { + steps: { + container: '.idealsteps-container', nav: '.idealsteps-nav', navItems: 'li', buildNavItems: function(i) { - return 'Step '+ (i+1); + return this.opts.steps.i18n.step +' '+ (i+1); }, wrap: '.idealsteps-wrap', step: '.idealsteps-step', activeClass: 'idealsteps-step-active', before: null, after: null, - fadeSpeed: 0 + fadeSpeed: 0, + + i18n: { + step: 'Step' + } } }, diff --git a/js/main.js b/js/main.js index 5cbb31e..d27747d 100644 --- a/js/main.js +++ b/js/main.js @@ -11,6 +11,7 @@ plugin.name = 'idealforms'; plugin.defaults = { + i18n: 'en', field: '.field', error: '.error', iconHtml: '', @@ -39,6 +40,8 @@ }, obj); }, + i18n: {}, + ruleSeparator: ' ', argSeparator: ':', diff --git a/js/out/jquery.idealforms.js b/js/out/jquery.idealforms.js index a281183..4a48129 100644 --- a/js/out/jquery.idealforms.js +++ b/js/out/jquery.idealforms.js @@ -86,9 +86,7 @@ module.exports = { $.extend($.idealforms, { _requests: {} }); - $.extend($.idealforms.errors, { - ajax: 'Loading...' - }); + $.idealforms.errors.ajax = $.idealforms.errors.ajax || 'Loading...'; $.extend($.idealforms.rules, { @@ -145,6 +143,14 @@ module.exports = { name: 'customInputs', + options: { + customInputs: { + i18n: { + open: 'Open' + } + } + }, + methods: { // @extend @@ -157,7 +163,7 @@ module.exports = { }, _buildCustomInputs: function() { - this.$form.find(':file').idealfile(); + this.$form.find(':file').idealfile(this.opts.customInputs.i18n); this.$form.find(':checkbox, :radio').idealradiocheck(); } @@ -177,6 +183,10 @@ module.exports = { plugin.name = 'idealfile'; + plugin.defaults = { + open: 'Open' + }; + plugin.methods = { _init: function() { @@ -185,9 +195,9 @@ module.exports = { , $wrap = $('
') , $input = $('') // Button that will be used in non-IE browsers - , $button = $('') + , $button = $('') // Hack for IE - , $label = $(''); + , $label = $(''); if (isIE) $label.add($button).addClass('ie'); @@ -616,19 +626,25 @@ module.exports = { name: 'steps', options: { + steps: { + container: '.idealsteps-container', nav: '.idealsteps-nav', navItems: 'li', buildNavItems: function(i) { - return 'Step '+ (i+1); + return this.opts.steps.i18n.step +' '+ (i+1); }, wrap: '.idealsteps-wrap', step: '.idealsteps-step', activeClass: 'idealsteps-step-active', before: null, after: null, - fadeSpeed: 0 + fadeSpeed: 0, + + i18n: { + step: 'Step' + } } }, @@ -761,6 +777,7 @@ module.exports = { plugin.name = 'idealforms'; plugin.defaults = { + i18n: 'en', field: '.field', error: '.error', iconHtml: '', @@ -789,6 +806,8 @@ module.exports = { }, obj); }, + i18n: {}, + ruleSeparator: ' ', argSeparator: ':', @@ -951,12 +970,14 @@ module.exports = { var self = this; - this._extend($.idealforms.extensions); - this.$form = $(this.el); this.$fields = $(); this.$inputs = $(); + this._extend($.idealforms.extensions); + + this._i18n(); + this._inject('_init'); this.addRules(this.opts.rules || {}); @@ -971,6 +992,22 @@ module.exports = { if (! this.opts.silentLoad) this.focusFirstInvalid(); }, + _i18n: function() { + + if (this.opts.i18n == 'en') return; + + var lang = $.idealforms.i18n[this.opts.i18n] + , errors = lang.errors + , options = {}; + + delete lang.errors; + + for (var ext in lang) options[ext] = { i18n: lang[ext] }; + + $.extend($.idealforms.errors, errors); + $.extend(true, this.opts, options); + }, + _buildField: function(input) { var self = this @@ -1299,5 +1336,5 @@ module.exports = { }; },{}]},{},[11]) -//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjo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ICAgICAgICAgIGJlZm9yZVNob3c6IGZ1bmN0aW9uKGlucHV0KSB7XG4gICAgICAgICAgICAgICQoaW5wdXQpLmFkZENsYXNzKCdvcGVuJyk7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgb25DaGFuZ2VNb250aFllYXI6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAvLyBIYWNrIHRvIGZpeCBJRTkgbm90IHJlc2l6aW5nXG4gICAgICAgICAgICAgIHZhciAkdGhpcyA9ICQodGhpcylcbiAgICAgICAgICAgICAgICAsIHdpZHRoID0gJHRoaXMub3V0ZXJXaWR0aCgpOyAvLyBjYWNoZSBmaXJzdCFcbiAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAkdGhpcy5kYXRlcGlja2VyKCd3aWRnZXQnKS5jc3MoJ3dpZHRoJywgd2lkdGgpO1xuICAgICAgICAgICAgICB9LCAxKTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBvbkNsb3NlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgJCh0aGlzKS5yZW1vdmVDbGFzcygnb3BlbicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcblxuICAgICAgICAvLyBBZGp1c3Qgd2lkdGhcbiAgICAgICAgJGRhdGVwaWNrZXIub24oJ2ZvY3VzIGtleXVwJywgZnVuY3Rpb24oKSB7XG4gICAgICAgICAgdmFyIHQgPSAkKHRoaXMpLCB3ID0gdC5vdXRlcldpZHRoKCk7XG4gICAgICAgICAgdC5kYXRlcGlja2VyKCd3aWRnZXQnKS5jc3MoJ3dpZHRoJywgdyk7XG4gICAgICAgIH0pO1xuICAgICAgfVxuICAgIH1cblxuICB9XG59O1xuIiwiZnVuY3Rpb24gdGVtcGxhdGUoaHRtbCwgZGF0YSkge1xuXG4gIHZhciBsb29wID0gL1xce0AoW159XSspXFx9KC4rPylcXHtcXC9cXDFcXH0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c3QoZm9ybWF0W2ldKSkgbSA9IGRhdGVbaV07XG4gICAgICAgIGlmICgvZC8udGVzdChmb3JtYXRbaV0pKSBkID0gZGF0ZVtpXTtcbiAgICAgICAgaWYgKC95Ly50ZXN0KGZvcm1hdFtpXSkpIHkgPSBkYXRlW2ldO1xuICAgICAgfVxuXG4gICAgICBpZiAoIW0gfHwgIWQgfHwgIXkpIHJldHVybiBmYWxzZTtcblxuICAgICAgcmV0dXJuIG0gPiAwICYmIG0gPCAxMyAmJlxuICAgICAgICB5ICYmIHkubGVuZ3RoID09IDQgJiZcbiAgICAgICAgZCA+IDAgJiYgZCA8PSAobmV3IERhdGUoeSwgbSwgMCkpLmdldERhdGUoKTtcbiAgICB9XG5cbiAgICByZXR1cm4gaXNEYXRlKHRoZURhdGUsIHRoZUZvcm1hdCk7XG4gIH1cblxufTtcbiJdfQ== ; \ No newline at end of file diff --git a/js/out/jquery.idealforms.min.js b/js/out/jquery.idealforms.min.js index 9df9de0..b8825a9 100644 --- a/js/out/jquery.idealforms.min.js +++ b/js/out/jquery.idealforms.min.js @@ -1,7 +1,7 @@ -!function e(t,i,s){function n(o,r){if(!i[o]){if(!t[o]){var l="function"==typeof require&&require;if(!r&&l)return l(o,!0);if(a)return a(o,!0);throw new Error("Cannot find module '"+o+"'")}var d=i[o]={exports:{}};t[o][0].call(d.exports,function(e){var i=t[o][1][e];return n(i?i:e)},d,d.exports,e,t,i,s)}return i[o].exports}for(var a="function"==typeof require&&require,o=0;o').appendTo("body").css("width").replace("px","")},methods:{_init:function(){function e(){var e=t.$form.outerWidth(),i=t.opts.adaptiveWidth>e;t.$form.toggleClass("adaptive",i),t._hasExtension("steps")&&t.$stepsContainer.toggleClass("adaptive",i),$("#ui-datepicker-div").hide()}var t=this;$(window).resize(e),e(),this.$form.find("select, .datepicker").each(function(){t._getField(this).find(t.opts.error).addClass("hidden")}),$("p.idealforms-field-width").remove()}}}},{}],3:[function(e,t){t.exports={name:"ajax",methods:{_init:function(){$.extend($.idealforms,{_requests:{}}),$.extend($.idealforms.errors,{ajax:"Loading..."}),$.extend($.idealforms.rules,{ajax:function(e){var t=this,i=this._getField(e),s=$(e).data("idealforms-ajax"),n=$.idealforms._getKey("errors."+e.name+".ajaxError",t.opts),a=$.idealforms._requests,o={};return o[e.name]=e.value,i.addClass("ajax"),a[e.name]&&a[e.name].abort(),a[e.name]=$.post(s,o,function(s){s===!0?(i.data("idealforms-valid",!0),t._handleError(e),t._handleStyle(e)):t._handleError(e,n),i.removeClass("ajax")},"json"),!1}})},_validate:function(e,t){"ajax"!=t&&$.idealforms._requests[e.name]&&($.idealforms._requests[e.name].abort(),this._getField(e).removeClass("ajax"))}}}},{}],4:[function(e,t){e("./idealfile"),e("./idealradiocheck"),t.exports={name:"customInputs",methods:{_init:function(){this._buildCustomInputs()},addFields:function(){this._buildCustomInputs()},_buildCustomInputs:function(){this.$form.find(":file").idealfile(),this.$form.find(":checkbox, :radio").idealradiocheck()}}}},{"./idealfile":5,"./idealradiocheck":6}],5:[function(e){!function(t){var i="undefined"!=typeof t("")[0].multiple,s=/msie/i.test(navigator.userAgent),n={};n.name="idealfile",n.methods={_init:function(){var e=t(this.el).addClass("ideal-file"),n=t('
'),a=t(''),o=t(''),r=t('');s&&r.add(o).addClass("ie"),e.css({position:"absolute",left:"-9999px"}),n.append(a,s?r:o).insertAfter(e),e.attr("tabIndex",-1),o.attr("tabIndex",-1),o.click(function(){e.focus().click()}),e.change(function(){var t,s,n=[];if(i){t=e[0].files;for(var o=0,r=t.length;r>o;o++)n.push(t[o].name);s=n.join(", ")}else s=e.val().split("\\").pop();a.val(s).attr("title",s)}),a.on({blur:function(){e.trigger("blur")},keydown:function(i){if(13===i.which)s||e.trigger("click"),t(this).closest("form").one("keydown",function(e){13===e.which&&e.preventDefault()});else{if(8!==i.which&&46!==i.which)return 9===i.which?void 0:!1;s&&e.replaceWith(e=e.clone(!0)),e.val("").trigger("change"),a.val("")}}})}},e("../../plugin")(n)}(jQuery,window,document)},{"../../plugin":12}],6:[function(e){!function(t){var i={};i.name="idealradiocheck",i.methods={_init:function(){var e=t(this.el),i=t("");i.addClass("ideal-"+(e.is(":checkbox")?"check":"radio")),e.is(":checked")&&i.addClass("checked"),i.insertAfter(e),e.parent("label").addClass("ideal-radiocheck-label").attr("onclick",""),e.css({position:"absolute",left:"-9999px"}),e.on({change:function(){var e=t(this);e.is('input[type="radio"]')&&e.parent().siblings("label").find(".ideal-radio").removeClass("checked"),i.toggleClass("checked",e.is(":checked"))},focus:function(){i.addClass("focus")},blur:function(){i.removeClass("focus")},click:function(){t(this).trigger("focus")}})}},e("../../plugin")(i)}(jQuery,window,document)},{"../../plugin":12}],7:[function(e,t){t.exports={name:"datepicker",methods:{_init:function(){this._buildDatepicker()},_buildDatepicker:function(){var e=this.$form.find("input.datepicker");jQuery.ui&&($.datepicker._checkOffset=function(e,t){return t}),jQuery.ui&&e.length&&(e.each(function(){$(this).datepicker({beforeShow:function(e){$(e).addClass("open")},onChangeMonthYear:function(){var e=$(this),t=e.outerWidth();setTimeout(function(){e.datepicker("widget").css("width",t)},1)},onClose:function(){$(this).removeClass("open")}})}),e.on("focus keyup",function(){var e=$(this),t=e.outerWidth();e.datepicker("widget").css("width",t)}))}}}},{}],8:[function(e,t){function i(e,t){var i=/\{@([^}]+)\}(.+?)\{\/\1\}/g,s=/\{#([^}]+)\}/g,n=/\{([^}]+)\}/g;return e.replace(i,function(e,i,n){return $.map(t[i],function(e){return n.replace(s,function(t,i){return e[i]})}).join("")}).replace(n,function(e,i){return t[i]||""})}t.exports={name:"dynamicFields",options:{templates:{base:'
{field}
',text:'',file:'',textarea:'',group:'

{@list} {/list}

',select:' '}},methods:{addFields:function(e){var t=this;$.each(e,function(e,s){var n=s.type.split(":"),a={},o=t.$form.find(t.opts.field).last();s.name=e,s.type=n[0],n[1]&&(s.subtype=n[1]),s.html=i(t.opts.templates.base,{label:s.label,field:i(t.opts.templates[s.type],s)}),t._inject("addFields",s),s.after||s.before?t.$form.find('[name="'+(s.after||s.before)+'"]').first().each(function(){t._getField(this)[s.after?"after":"before"](s.html)}):o.length?o.after(s.html):t.$form.append(s.html),s.rules&&(a[e]=s.rules,t.addRules(a))})},removeFields:function(e){var t=this;$.each(e.split(" "),function(e,i){var s=t._getField($('[name="'+i+'"]'));t.$fields=t.$fields.filter(function(){return!$(this).is(s)}),s.remove()}),this._inject("removeFields")},toggleFields:function(e){var t=this;$.each(e.split(" "),function(e,i){var s=t._getField($('[name="'+i+'"]'));s.data("idealforms-valid",s.is(":visible")).toggle()}),this._inject("toggleFields")}}}},{}],9:[function(e){!function(t){var i={};i.name="idealsteps",i.defaults={nav:".idealsteps-nav",navItems:"li",buildNavItems:!0,wrap:".idealsteps-wrap",step:".idealsteps-step",activeClass:"idealsteps-step-active",before:null,after:null,fadeSpeed:0},i.methods={_init:function(){var e=this,i=this.opts.activeClass;this.$el=t(this.el),this.$nav=this.$el.find(this.opts.nav),this.$navItems=this.$nav.find(this.opts.navItems),this.$wrap=this.$el.find(this.opts.wrap),this.$steps=this.$wrap.find(this.opts.step),this.opts.buildNavItems&&this._buildNavItems(),this.$steps.hide().first().show(),this.$navItems.removeClass(i).first().addClass(i),this.$navItems.click(function(t){t.preventDefault(),e.go(e.$navItems.index(this))})},_buildNavItems:function(){var e,i=this,s="function"==typeof this.opts.buildNavItems,n=function(e){return'
  • '+e+"
  • "};e=s?this.$steps.map(function(e){return n(i.opts.buildNavItems.call(i,e))}).get():this.$steps.map(function(e){return n(++e)}).get(),this.$navItems=t(e.join("")),this.$nav.append(t("
      ").append(this.$navItems))},_getCurIdx:function(){return this.$steps.index(this.$steps.filter(":visible"))},go:function(e){var t=this.opts.activeClass,i=this.opts.fadeSpeed;"function"==typeof e&&(e=e.call(this,this._getCurIdx())),e>=this.$steps.length&&(e=0),0>e&&(e=this.$steps.length-1),this.opts.before&&this.opts.before.call(this,e),this.$navItems.removeClass(t).eq(e).addClass(t),this.$steps.fadeOut(i).eq(e).fadeIn(i),this.opts.after&&this.opts.after.call(this,e)},prev:function(){this.go(this._getCurIdx()-1)},next:function(){this.go(this._getCurIdx()+1)},first:function(){this.go(0)},last:function(){this.go(this.$steps.length-1)}},e("../../plugin")(i)}(jQuery,window,document)},{"../../plugin":12}],10:[function(e,t){e("./idealsteps"),t.exports={name:"steps",options:{steps:{container:".idealsteps-container",nav:".idealsteps-nav",navItems:"li",buildNavItems:function(e){return"Step "+(e+1)},wrap:".idealsteps-wrap",step:".idealsteps-step",activeClass:"idealsteps-step-active",before:null,after:null,fadeSpeed:0}},methods:{_init:function(){this._buildSteps()},_validate:function(){var e=this;this._updateSteps(),this._hasExtension("ajax")&&$.each($.idealforms._requests,function(t,i){i.done(function(){e._updateSteps()})})},focusFirstInvalid:function(e){this.$stepsContainer.idealsteps("go",function(){return this.$steps.filter(function(){return $(this).find(e).length}).index()})},_buildSteps:function(){var e=this,t=!$.isEmptyObject(this.opts.rules),i=this.opts.steps.buildNavItems,s=t?'':'0';this.opts.steps.buildNavItems&&(this.opts.steps.buildNavItems=function(t){return i.call(e,t)+s}),this.$stepsContainer=this.$form.closest(this.opts.steps.container).idealsteps(this.opts.steps)},_updateSteps:function(){var e=this;this.$stepsContainer.idealsteps("_inject",function(){var t=this;this.$navItems.each(function(i){var s=t.$steps.eq(i).find(e.getInvalid()).length;$(this).find("span").text(s).toggleClass("zero",!s)})})},addRules:function(){this.firstStep()},addFields:function(e){e.after=this.$stepsContainer.find(this.opts.steps.step).eq(e.appendToStep).find("input, textarea, select").last()[0].name},toggleFields:function(){this._updateSteps()},removeFields:function(){this._updateSteps()},goToStep:function(e){this.$stepsContainer.idealsteps("go",e)},prevStep:function(){this.$stepsContainer.idealsteps("prev")},nextStep:function(){this.$stepsContainer.idealsteps("next")},firstStep:function(){this.$stepsContainer.idealsteps("first")},lastStep:function(){this.$stepsContainer.idealsteps("last")}}}},{"./idealsteps":9}],11:[function(e){/*! +!function e(t,i,s){function n(o,r){if(!i[o]){if(!t[o]){var l="function"==typeof require&&require;if(!r&&l)return l(o,!0);if(a)return a(o,!0);throw new Error("Cannot find module '"+o+"'")}var d=i[o]={exports:{}};t[o][0].call(d.exports,function(e){var i=t[o][1][e];return n(i?i:e)},d,d.exports,e,t,i,s)}return i[o].exports}for(var a="function"==typeof require&&require,o=0;o').appendTo("body").css("width").replace("px","")},methods:{_init:function(){function e(){var e=t.$form.outerWidth(),i=t.opts.adaptiveWidth>e;t.$form.toggleClass("adaptive",i),t._hasExtension("steps")&&t.$stepsContainer.toggleClass("adaptive",i),$("#ui-datepicker-div").hide()}var t=this;$(window).resize(e),e(),this.$form.find("select, .datepicker").each(function(){t._getField(this).find(t.opts.error).addClass("hidden")}),$("p.idealforms-field-width").remove()}}}},{}],3:[function(e,t){t.exports={name:"ajax",methods:{_init:function(){$.extend($.idealforms,{_requests:{}}),$.idealforms.errors.ajax=$.idealforms.errors.ajax||"Loading...",$.extend($.idealforms.rules,{ajax:function(e){var t=this,i=this._getField(e),s=$(e).data("idealforms-ajax"),n=$.idealforms._getKey("errors."+e.name+".ajaxError",t.opts),a=$.idealforms._requests,o={};return o[e.name]=e.value,i.addClass("ajax"),a[e.name]&&a[e.name].abort(),a[e.name]=$.post(s,o,function(s){s===!0?(i.data("idealforms-valid",!0),t._handleError(e),t._handleStyle(e)):t._handleError(e,n),i.removeClass("ajax")},"json"),!1}})},_validate:function(e,t){"ajax"!=t&&$.idealforms._requests[e.name]&&($.idealforms._requests[e.name].abort(),this._getField(e).removeClass("ajax"))}}}},{}],4:[function(e,t){e("./idealfile"),e("./idealradiocheck"),t.exports={name:"customInputs",options:{customInputs:{i18n:{open:"Open"}}},methods:{_init:function(){this._buildCustomInputs()},addFields:function(){this._buildCustomInputs()},_buildCustomInputs:function(){this.$form.find(":file").idealfile(this.opts.customInputs.i18n),this.$form.find(":checkbox, :radio").idealradiocheck()}}}},{"./idealfile":5,"./idealradiocheck":6}],5:[function(e){!function(t){var i="undefined"!=typeof t("")[0].multiple,s=/msie/i.test(navigator.userAgent),n={};n.name="idealfile",n.defaults={open:"Open"},n.methods={_init:function(){var e=t(this.el).addClass("ideal-file"),n=t('
      '),a=t(''),o=t('"),r=t('");s&&r.add(o).addClass("ie"),e.css({position:"absolute",left:"-9999px"}),n.append(a,s?r:o).insertAfter(e),e.attr("tabIndex",-1),o.attr("tabIndex",-1),o.click(function(){e.focus().click()}),e.change(function(){var t,s,n=[];if(i){t=e[0].files;for(var o=0,r=t.length;r>o;o++)n.push(t[o].name);s=n.join(", ")}else s=e.val().split("\\").pop();a.val(s).attr("title",s)}),a.on({blur:function(){e.trigger("blur")},keydown:function(i){if(13===i.which)s||e.trigger("click"),t(this).closest("form").one("keydown",function(e){13===e.which&&e.preventDefault()});else{if(8!==i.which&&46!==i.which)return 9===i.which?void 0:!1;s&&e.replaceWith(e=e.clone(!0)),e.val("").trigger("change"),a.val("")}}})}},e("../../plugin")(n)}(jQuery,window,document)},{"../../plugin":12}],6:[function(e){!function(t){var i={};i.name="idealradiocheck",i.methods={_init:function(){var e=t(this.el),i=t("");i.addClass("ideal-"+(e.is(":checkbox")?"check":"radio")),e.is(":checked")&&i.addClass("checked"),i.insertAfter(e),e.parent("label").addClass("ideal-radiocheck-label").attr("onclick",""),e.css({position:"absolute",left:"-9999px"}),e.on({change:function(){var e=t(this);e.is('input[type="radio"]')&&e.parent().siblings("label").find(".ideal-radio").removeClass("checked"),i.toggleClass("checked",e.is(":checked"))},focus:function(){i.addClass("focus")},blur:function(){i.removeClass("focus")},click:function(){t(this).trigger("focus")}})}},e("../../plugin")(i)}(jQuery,window,document)},{"../../plugin":12}],7:[function(e,t){t.exports={name:"datepicker",methods:{_init:function(){this._buildDatepicker()},_buildDatepicker:function(){var e=this.$form.find("input.datepicker");jQuery.ui&&($.datepicker._checkOffset=function(e,t){return t}),jQuery.ui&&e.length&&(e.each(function(){$(this).datepicker({beforeShow:function(e){$(e).addClass("open")},onChangeMonthYear:function(){var e=$(this),t=e.outerWidth();setTimeout(function(){e.datepicker("widget").css("width",t)},1)},onClose:function(){$(this).removeClass("open")}})}),e.on("focus keyup",function(){var e=$(this),t=e.outerWidth();e.datepicker("widget").css("width",t)}))}}}},{}],8:[function(e,t){function i(e,t){var i=/\{@([^}]+)\}(.+?)\{\/\1\}/g,s=/\{#([^}]+)\}/g,n=/\{([^}]+)\}/g;return e.replace(i,function(e,i,n){return $.map(t[i],function(e){return n.replace(s,function(t,i){return e[i]})}).join("")}).replace(n,function(e,i){return t[i]||""})}t.exports={name:"dynamicFields",options:{templates:{base:'
      {field}
      ',text:'',file:'',textarea:'',group:'

      {@list} {/list}

      ',select:' '}},methods:{addFields:function(e){var t=this;$.each(e,function(e,s){var n=s.type.split(":"),a={},o=t.$form.find(t.opts.field).last();s.name=e,s.type=n[0],n[1]&&(s.subtype=n[1]),s.html=i(t.opts.templates.base,{label:s.label,field:i(t.opts.templates[s.type],s)}),t._inject("addFields",s),s.after||s.before?t.$form.find('[name="'+(s.after||s.before)+'"]').first().each(function(){t._getField(this)[s.after?"after":"before"](s.html)}):o.length?o.after(s.html):t.$form.append(s.html),s.rules&&(a[e]=s.rules,t.addRules(a))})},removeFields:function(e){var t=this;$.each(e.split(" "),function(e,i){var s=t._getField($('[name="'+i+'"]'));t.$fields=t.$fields.filter(function(){return!$(this).is(s)}),s.remove()}),this._inject("removeFields")},toggleFields:function(e){var t=this;$.each(e.split(" "),function(e,i){var s=t._getField($('[name="'+i+'"]'));s.data("idealforms-valid",s.is(":visible")).toggle()}),this._inject("toggleFields")}}}},{}],9:[function(e){!function(t){var i={};i.name="idealsteps",i.defaults={nav:".idealsteps-nav",navItems:"li",buildNavItems:!0,wrap:".idealsteps-wrap",step:".idealsteps-step",activeClass:"idealsteps-step-active",before:null,after:null,fadeSpeed:0},i.methods={_init:function(){var e=this,i=this.opts.activeClass;this.$el=t(this.el),this.$nav=this.$el.find(this.opts.nav),this.$navItems=this.$nav.find(this.opts.navItems),this.$wrap=this.$el.find(this.opts.wrap),this.$steps=this.$wrap.find(this.opts.step),this.opts.buildNavItems&&this._buildNavItems(),this.$steps.hide().first().show(),this.$navItems.removeClass(i).first().addClass(i),this.$navItems.click(function(t){t.preventDefault(),e.go(e.$navItems.index(this))})},_buildNavItems:function(){var e,i=this,s="function"==typeof this.opts.buildNavItems,n=function(e){return'
    • '+e+"
    • "};e=s?this.$steps.map(function(e){return n(i.opts.buildNavItems.call(i,e))}).get():this.$steps.map(function(e){return n(++e)}).get(),this.$navItems=t(e.join("")),this.$nav.append(t("
        ").append(this.$navItems))},_getCurIdx:function(){return this.$steps.index(this.$steps.filter(":visible"))},go:function(e){var t=this.opts.activeClass,i=this.opts.fadeSpeed;"function"==typeof e&&(e=e.call(this,this._getCurIdx())),e>=this.$steps.length&&(e=0),0>e&&(e=this.$steps.length-1),this.opts.before&&this.opts.before.call(this,e),this.$navItems.removeClass(t).eq(e).addClass(t),this.$steps.fadeOut(i).eq(e).fadeIn(i),this.opts.after&&this.opts.after.call(this,e)},prev:function(){this.go(this._getCurIdx()-1)},next:function(){this.go(this._getCurIdx()+1)},first:function(){this.go(0)},last:function(){this.go(this.$steps.length-1)}},e("../../plugin")(i)}(jQuery,window,document)},{"../../plugin":12}],10:[function(e,t){e("./idealsteps"),t.exports={name:"steps",options:{steps:{container:".idealsteps-container",nav:".idealsteps-nav",navItems:"li",buildNavItems:function(e){return this.opts.steps.i18n.step+" "+(e+1)},wrap:".idealsteps-wrap",step:".idealsteps-step",activeClass:"idealsteps-step-active",before:null,after:null,fadeSpeed:0,i18n:{step:"Step"}}},methods:{_init:function(){this._buildSteps()},_validate:function(){var e=this;this._updateSteps(),this._hasExtension("ajax")&&$.each($.idealforms._requests,function(t,i){i.done(function(){e._updateSteps()})})},focusFirstInvalid:function(e){this.$stepsContainer.idealsteps("go",function(){return this.$steps.filter(function(){return $(this).find(e).length}).index()})},_buildSteps:function(){var e=this,t=!$.isEmptyObject(this.opts.rules),i=this.opts.steps.buildNavItems,s=t?'':'0';this.opts.steps.buildNavItems&&(this.opts.steps.buildNavItems=function(t){return i.call(e,t)+s}),this.$stepsContainer=this.$form.closest(this.opts.steps.container).idealsteps(this.opts.steps)},_updateSteps:function(){var e=this;this.$stepsContainer.idealsteps("_inject",function(){var t=this;this.$navItems.each(function(i){var s=t.$steps.eq(i).find(e.getInvalid()).length;$(this).find("span").text(s).toggleClass("zero",!s)})})},addRules:function(){this.firstStep()},addFields:function(e){e.after=this.$stepsContainer.find(this.opts.steps.step).eq(e.appendToStep).find("input, textarea, select").last()[0].name},toggleFields:function(){this._updateSteps()},removeFields:function(){this._updateSteps()},goToStep:function(e){this.$stepsContainer.idealsteps("go",e)},prevStep:function(){this.$stepsContainer.idealsteps("prev")},nextStep:function(){this.$stepsContainer.idealsteps("next")},firstStep:function(){this.$stepsContainer.idealsteps("first")},lastStep:function(){this.$stepsContainer.idealsteps("last")}}}},{"./idealsteps":9}],11:[function(e){/*! * jQuery Ideal Forms * @author: Cedric Ruiz * @version: 3.0 * @license GPL or MIT */ -!function(t){var i={};i.name="idealforms",i.defaults={field:".field",error:".error",iconHtml:"",iconClass:"icon",invalidClass:"invalid",validClass:"valid",silentLoad:!0,onValidate:t.noop,onSubmit:t.noop},i.global={_format:function(e){var t=[].slice.call(arguments,1);return e.replace(/\{(\d)\}/g,function(e,i){return t[+i]||""}).replace(/\{\*([^*}]*)\}/g,function(e,i){return t.join(i||", ")})},_getKey:function(e,t){return e.split(".").reduce(function(e,t){return e&&e[t]},t)},ruleSeparator:" ",argSeparator:":",rules:e("./rules"),errors:e("./errors"),extensions:[e("./extensions/dynamic-fields/dynamic-fields.ext"),e("./extensions/ajax/ajax.ext"),e("./extensions/steps/steps.ext"),e("./extensions/custom-inputs/custom-inputs.ext"),e("./extensions/datepicker/datepicker.ext"),e("./extensions/adaptive/adaptive.ext")]},i.methods=t.extend({},e("./private"),e("./public")),e("./plugin")(i)}(jQuery,window,document)},{"./errors":1,"./extensions/adaptive/adaptive.ext":2,"./extensions/ajax/ajax.ext":3,"./extensions/custom-inputs/custom-inputs.ext":4,"./extensions/datepicker/datepicker.ext":7,"./extensions/dynamic-fields/dynamic-fields.ext":8,"./extensions/steps/steps.ext":10,"./plugin":12,"./private":13,"./public":14,"./rules":15}],12:[function(e,t){t.exports=function(){var e=Array.prototype;return function(t){function i(e,i){this.opts=$.extend({},t.defaults,i),this.el=e,this._name=t.name,this._init()}t=$.extend(!0,{name:"plugin",defaults:{disabledExtensions:"none"},methods:{},global:{}},t),$[t.name]=$.extend({addExtension:function(e){t.global.extensions.push(e)}},t.global),i._extended={},i.prototype._hasExtension=function(e){var i=this;return t.global.extensions.filter(function(t){return t.name==e&&i.opts.disabledExtensions.indexOf(t.name)<0}).length},i.prototype._extend=function(e){var t=this;$.each(e,function(e,s){$.extend(t.opts,$.extend(!0,s.options,t.opts)),$.each(s.methods,function(e,n){t.opts.disabledExtensions.indexOf(s.name)>-1||(i.prototype[e]?(i._extended[e]=i._extended[e]||[],i._extended[e].push({name:s.name,fn:n})):i.prototype[e]=n)})})},i.prototype._inject=function(e){var t=[].slice.call(arguments,1);if("function"==typeof e)return e.call(this);var s=this;i._extended[e]&&$.each(i._extended[e],function(e,i){i.fn.apply(s,t)})},i.prototype._init=$.noop,i.prototype[t.name]=function(t){if(!t)return this;try{return this[t].apply(this,e.slice.call(arguments,1))}catch(i){}},$.extend(i.prototype,t.methods),$.fn[t.name]=function(){var s,n=e.slice.call(arguments),a="string"==typeof n[0]&&n[0].split(":"),o=a[a.length>1?1:0],r=a.length>1&&a[0],l="object"==typeof n[0]&&n[0],d=n.slice(1);return r&&(o=r+o.substr(0,1).toUpperCase()+o.substr(1,o.length-1)),this.each(function(){var e=$.data(this,t.name);return e?s=e[t.name].apply(e,[o].concat(d)):$.data(this,t.name,new i(this,l))}),r?s:this}}}()},{}],13:[function(e,t){t.exports={_init:function(){var e=this;this._extend($.idealforms.extensions),this.$form=$(this.el),this.$fields=$(),this.$inputs=$(),this._inject("_init"),this.addRules(this.opts.rules||{}),this.$form.submit(function(t){t.preventDefault(),e._validateAll(),e.focusFirstInvalid(),e.opts.onSubmit.call(e,e.getInvalid().length,t)}),this.opts.silentLoad||this.focusFirstInvalid()},_buildField:function(e){var t,i=this._getField(e);t=$(this.opts.iconHtml,{"class":this.opts.iconClass,click:function(){$(e).focus()}}),this.$fields.filter(i).length||(this.$fields=this.$fields.add(i),this.opts.iconHtml&&i.append(t),i.addClass("idealforms-field idealforms-field-"+e.type)),this._addEvents(e),this._inject("_buildField",e)},_addEvents:function(e){var t=this,i=this._getField(e);$(e).on("change keyup",function(e){9!=e.which&&16!=e.which&&t._validate(this,!0,!0)}).focus(function(){return t.isValid(this.name)?!1:((t._isRequired(this)||this.value)&&i.find(t.opts.error).show(),void 0)}).blur(function(){i.find(t.opts.error).hide()})},_isRequired:function(e){return $(e).is(":checkbox, :radio, select")?!0:this.opts.rules[e.name].indexOf("required")>-1},_getRelated:function(e){return this._getField(e).find('[name="'+e.name+'"]')},_getField:function(e){return $(e).closest(this.opts.field)},_getFirstInvalid:function(){return this.getInvalid().first().find("input:first, textarea, select")},_handleError:function(e,t,i){i=i||this.isValid(e.name);var s=this._getField(e).find(this.opts.error);this.$form.find(this.opts.error).hide(),t&&s.text(t),s.toggle(!i)},_handleStyle:function(e,t){t=t||this.isValid(e.name),this._getField(e).removeClass(this.opts.validClass+" "+this.opts.invalidClass).addClass(t?this.opts.validClass:this.opts.invalidClass).find("."+this.opts.iconClass).show()},_fresh:function(e){this._getField(e).removeClass(this.opts.validClass+" "+this.opts.invalidClass).find(this.opts.error).hide().end().find("."+this.opts.iconClass).toggle(this._isRequired(e))},_validate:function(e,t,i){var s,n=this,a=this._getField(e),o=this.opts.rules[e.name].split($.idealforms.ruleSeparator),r=a.data("idealforms-value"),l=!0;return $(e).is(":checkbox, :radio")||r!=e.value?(a.data("idealforms-value",e.value),e.value||this._isRequired(e)?$.each(o,function(o,r){r=r.split($.idealforms.argSeparator),s=r[0];var d,u=$.idealforms.rules[s],c=r.slice(1);return d=$.idealforms._format.apply(null,[$.idealforms._getKey("errors."+e.name+"."+s,n.opts)||$.idealforms.errors[s]].concat(c)),l="function"==typeof u?u.apply(n,[e,e.value].concat(c)):u.test(e.value),a.data("idealforms-valid",l),t&&n._handleError(e,d,l),i&&n._handleStyle(e,l),n.opts.onValidate.call(n,e,s,l),l}):(a.removeData("idealforms-valid"),this._fresh(e)),this._inject("_validate",e,s,l),l):a.data("idealforms-valid")},_validateAll:function(){var e=this;this.$inputs.each(function(){e._validate(this,!0)})}}},{}],14:[function(e,t){t.exports={addRules:function(e){var t=this,i=this.$form.find($.map(e,function(e,t){return'[name="'+t+'"]'}).join(","));$.extend(this.opts.rules,e),i.each(function(){t._buildField(this)}),this.$inputs=this.$inputs.add(i),this._validateAll(),this.$fields.find(this.opts.error).hide(),this._inject("addRules")},getInvalid:function(){return this.$fields.filter(function(){return $(this).data("idealforms-valid")===!1})},focusFirstInvalid:function(){var e=this._getFirstInvalid()[0];e&&(this._handleError(e),this._handleStyle(e),this._inject("focusFirstInvalid",e),e.focus())},isValid:function(e){return e?!this.getInvalid().find('[name="'+e+'"]').length:!this.getInvalid().length},reset:function(e){var t=this,i=this.$inputs;e&&(i=i.filter('[name="'+e+'"]')),i.filter("input:not(:checkbox, :radio)").val(""),i.filter(":checkbox, :radio").prop("checked",!1),i.filter("select").find("option").prop("selected",function(){return this.defaultSelected}),i.change().each(function(){t._resetErrorAndStyle(this)}),this._inject("reset",e)}}},{}],15:[function(e,t){t.exports={required:/.+/,digits:/^\d+$/,email:/^[^@]+@[^@]+\..{2,6}$/,username:/^[a-z](?=[\w.]{3,31}$)\w*\.?\w*$/i,pass:/(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/,strongpass:/(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,phone:/^[2-9]\d{2}-\d{3}-\d{4}$/,zip:/^\d{5}$|^\d{5}-\d{4}$/,url:/^(?:(ftp|http|https):\/\/)?(?:[\w\-]+\.)+[a-z]{2,6}([\:\/?#].*)?$/i,number:function(e,t){return!isNaN(t)},range:function(e,t,i,s){return Number(t)>=min&&Number(t)<=s},min:function(e,t,i){return t.length>=i},max:function(e,t,i){return t.length<=i},minoption:function(e,t,i){return this._getRelated(e).filter(":checked").length>=i},maxoption:function(e,t,i){return this._getRelated(e).filter(":checked").length<=i},minmax:function(e,t,i,s){return t.length>=i&&t.length<=s},select:function(e,t,i){return t!=i},extension:function(e){var t=[].slice.call(arguments,1),i=!1;return $.each(e.files||[{name:e.value}],function(e,s){i=$.inArray(s.name.split(".").pop().toLowerCase(),t)>-1}),i},equalto:function(e,t,i){var s=this,n=$('[name="'+i+'"]');return this.getInvalid().find(n).length?!1:(n.off("keyup.equalto").on("keyup.equalto",function(){s._getField(e).removeData("idealforms-value"),s._validate(e,!1,!0)}),e.value==n.val())},date:function(e,t,i){function s(e,t){for(var i,s,n,a=0,o=t.length;o>a;a++)/m/.test(t[a])&&(i=e[a]),/d/.test(t[a])&&(s=e[a]),/y/.test(t[a])&&(n=e[a]);return i&&s&&n?i>0&&13>i&&n&&4==n.length&&s>0&&s<=new Date(n,i,0).getDate():!1}i=i||"mm/dd/yyyy";var n=/[^mdy]/.exec(i)[0],a=i.split(n),o=t.split(n);return s(o,a)}}},{}]},{},[11]); \ No newline at end of file +!function(t){var i={};i.name="idealforms",i.defaults={i18n:"en",field:".field",error:".error",iconHtml:"",iconClass:"icon",invalidClass:"invalid",validClass:"valid",silentLoad:!0,onValidate:t.noop,onSubmit:t.noop},i.global={_format:function(e){var t=[].slice.call(arguments,1);return e.replace(/\{(\d)\}/g,function(e,i){return t[+i]||""}).replace(/\{\*([^*}]*)\}/g,function(e,i){return t.join(i||", ")})},_getKey:function(e,t){return e.split(".").reduce(function(e,t){return e&&e[t]},t)},i18n:{},ruleSeparator:" ",argSeparator:":",rules:e("./rules"),errors:e("./errors"),extensions:[e("./extensions/dynamic-fields/dynamic-fields.ext"),e("./extensions/ajax/ajax.ext"),e("./extensions/steps/steps.ext"),e("./extensions/custom-inputs/custom-inputs.ext"),e("./extensions/datepicker/datepicker.ext"),e("./extensions/adaptive/adaptive.ext")]},i.methods=t.extend({},e("./private"),e("./public")),e("./plugin")(i)}(jQuery,window,document)},{"./errors":1,"./extensions/adaptive/adaptive.ext":2,"./extensions/ajax/ajax.ext":3,"./extensions/custom-inputs/custom-inputs.ext":4,"./extensions/datepicker/datepicker.ext":7,"./extensions/dynamic-fields/dynamic-fields.ext":8,"./extensions/steps/steps.ext":10,"./plugin":12,"./private":13,"./public":14,"./rules":15}],12:[function(e,t){t.exports=function(){var e=Array.prototype;return function(t){function i(e,i){this.opts=$.extend({},t.defaults,i),this.el=e,this._name=t.name,this._init()}t=$.extend(!0,{name:"plugin",defaults:{disabledExtensions:"none"},methods:{},global:{}},t),$[t.name]=$.extend({addExtension:function(e){t.global.extensions.push(e)}},t.global),i._extended={},i.prototype._hasExtension=function(e){var i=this;return t.global.extensions.filter(function(t){return t.name==e&&i.opts.disabledExtensions.indexOf(t.name)<0}).length},i.prototype._extend=function(e){var t=this;$.each(e,function(e,s){$.extend(t.opts,$.extend(!0,s.options,t.opts)),$.each(s.methods,function(e,n){t.opts.disabledExtensions.indexOf(s.name)>-1||(i.prototype[e]?(i._extended[e]=i._extended[e]||[],i._extended[e].push({name:s.name,fn:n})):i.prototype[e]=n)})})},i.prototype._inject=function(e){var t=[].slice.call(arguments,1);if("function"==typeof e)return e.call(this);var s=this;i._extended[e]&&$.each(i._extended[e],function(e,i){i.fn.apply(s,t)})},i.prototype._init=$.noop,i.prototype[t.name]=function(t){if(!t)return this;try{return this[t].apply(this,e.slice.call(arguments,1))}catch(i){}},$.extend(i.prototype,t.methods),$.fn[t.name]=function(){var s,n=e.slice.call(arguments),a="string"==typeof n[0]&&n[0].split(":"),o=a[a.length>1?1:0],r=a.length>1&&a[0],l="object"==typeof n[0]&&n[0],d=n.slice(1);return r&&(o=r+o.substr(0,1).toUpperCase()+o.substr(1,o.length-1)),this.each(function(){var e=$.data(this,t.name);return e?s=e[t.name].apply(e,[o].concat(d)):$.data(this,t.name,new i(this,l))}),r?s:this}}}()},{}],13:[function(e,t){t.exports={_init:function(){var e=this;this.$form=$(this.el),this.$fields=$(),this.$inputs=$(),this._extend($.idealforms.extensions),this._i18n(),this._inject("_init"),this.addRules(this.opts.rules||{}),this.$form.submit(function(t){t.preventDefault(),e._validateAll(),e.focusFirstInvalid(),e.opts.onSubmit.call(e,e.getInvalid().length,t)}),this.opts.silentLoad||this.focusFirstInvalid()},_i18n:function(){if("en"!=this.opts.i18n){var e=$.idealforms.i18n[this.opts.i18n],t=e.errors,i={};delete e.errors;for(var s in e)i[s]={i18n:e[s]};$.extend($.idealforms.errors,t),$.extend(!0,this.opts,i)}},_buildField:function(e){var t,i=this._getField(e);t=$(this.opts.iconHtml,{"class":this.opts.iconClass,click:function(){$(e).focus()}}),this.$fields.filter(i).length||(this.$fields=this.$fields.add(i),this.opts.iconHtml&&i.append(t),i.addClass("idealforms-field idealforms-field-"+e.type)),this._addEvents(e),this._inject("_buildField",e)},_addEvents:function(e){var t=this,i=this._getField(e);$(e).on("change keyup",function(e){9!=e.which&&16!=e.which&&t._validate(this,!0,!0)}).focus(function(){return t.isValid(this.name)?!1:((t._isRequired(this)||this.value)&&i.find(t.opts.error).show(),void 0)}).blur(function(){i.find(t.opts.error).hide()})},_isRequired:function(e){return $(e).is(":checkbox, :radio, select")?!0:this.opts.rules[e.name].indexOf("required")>-1},_getRelated:function(e){return this._getField(e).find('[name="'+e.name+'"]')},_getField:function(e){return $(e).closest(this.opts.field)},_getFirstInvalid:function(){return this.getInvalid().first().find("input:first, textarea, select")},_handleError:function(e,t,i){i=i||this.isValid(e.name);var s=this._getField(e).find(this.opts.error);this.$form.find(this.opts.error).hide(),t&&s.text(t),s.toggle(!i)},_handleStyle:function(e,t){t=t||this.isValid(e.name),this._getField(e).removeClass(this.opts.validClass+" "+this.opts.invalidClass).addClass(t?this.opts.validClass:this.opts.invalidClass).find("."+this.opts.iconClass).show()},_fresh:function(e){this._getField(e).removeClass(this.opts.validClass+" "+this.opts.invalidClass).find(this.opts.error).hide().end().find("."+this.opts.iconClass).toggle(this._isRequired(e))},_validate:function(e,t,i){var s,n=this,a=this._getField(e),o=this.opts.rules[e.name].split($.idealforms.ruleSeparator),r=a.data("idealforms-value"),l=!0;return $(e).is(":checkbox, :radio")||r!=e.value?(a.data("idealforms-value",e.value),e.value||this._isRequired(e)?$.each(o,function(o,r){r=r.split($.idealforms.argSeparator),s=r[0];var d,u=$.idealforms.rules[s],c=r.slice(1);return d=$.idealforms._format.apply(null,[$.idealforms._getKey("errors."+e.name+"."+s,n.opts)||$.idealforms.errors[s]].concat(c)),l="function"==typeof u?u.apply(n,[e,e.value].concat(c)):u.test(e.value),a.data("idealforms-valid",l),t&&n._handleError(e,d,l),i&&n._handleStyle(e,l),n.opts.onValidate.call(n,e,s,l),l}):(a.removeData("idealforms-valid"),this._fresh(e)),this._inject("_validate",e,s,l),l):a.data("idealforms-valid")},_validateAll:function(){var e=this;this.$inputs.each(function(){e._validate(this,!0)})}}},{}],14:[function(e,t){t.exports={addRules:function(e){var t=this,i=this.$form.find($.map(e,function(e,t){return'[name="'+t+'"]'}).join(","));$.extend(this.opts.rules,e),i.each(function(){t._buildField(this)}),this.$inputs=this.$inputs.add(i),this._validateAll(),this.$fields.find(this.opts.error).hide(),this._inject("addRules")},getInvalid:function(){return this.$fields.filter(function(){return $(this).data("idealforms-valid")===!1})},focusFirstInvalid:function(){var e=this._getFirstInvalid()[0];e&&(this._handleError(e),this._handleStyle(e),this._inject("focusFirstInvalid",e),e.focus())},isValid:function(e){return e?!this.getInvalid().find('[name="'+e+'"]').length:!this.getInvalid().length},reset:function(e){var t=this,i=this.$inputs;e&&(i=i.filter('[name="'+e+'"]')),i.filter("input:not(:checkbox, :radio)").val(""),i.filter(":checkbox, :radio").prop("checked",!1),i.filter("select").find("option").prop("selected",function(){return this.defaultSelected}),i.change().each(function(){t._resetErrorAndStyle(this)}),this._inject("reset",e)}}},{}],15:[function(e,t){t.exports={required:/.+/,digits:/^\d+$/,email:/^[^@]+@[^@]+\..{2,6}$/,username:/^[a-z](?=[\w.]{3,31}$)\w*\.?\w*$/i,pass:/(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/,strongpass:/(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,phone:/^[2-9]\d{2}-\d{3}-\d{4}$/,zip:/^\d{5}$|^\d{5}-\d{4}$/,url:/^(?:(ftp|http|https):\/\/)?(?:[\w\-]+\.)+[a-z]{2,6}([\:\/?#].*)?$/i,number:function(e,t){return!isNaN(t)},range:function(e,t,i,s){return Number(t)>=min&&Number(t)<=s},min:function(e,t,i){return t.length>=i},max:function(e,t,i){return t.length<=i},minoption:function(e,t,i){return this._getRelated(e).filter(":checked").length>=i},maxoption:function(e,t,i){return this._getRelated(e).filter(":checked").length<=i},minmax:function(e,t,i,s){return t.length>=i&&t.length<=s},select:function(e,t,i){return t!=i},extension:function(e){var t=[].slice.call(arguments,1),i=!1;return $.each(e.files||[{name:e.value}],function(e,s){i=$.inArray(s.name.split(".").pop().toLowerCase(),t)>-1}),i},equalto:function(e,t,i){var s=this,n=$('[name="'+i+'"]');return this.getInvalid().find(n).length?!1:(n.off("keyup.equalto").on("keyup.equalto",function(){s._getField(e).removeData("idealforms-value"),s._validate(e,!1,!0)}),e.value==n.val())},date:function(e,t,i){function s(e,t){for(var i,s,n,a=0,o=t.length;o>a;a++)/m/.test(t[a])&&(i=e[a]),/d/.test(t[a])&&(s=e[a]),/y/.test(t[a])&&(n=e[a]);return i&&s&&n?i>0&&13>i&&n&&4==n.length&&s>0&&s<=new Date(n,i,0).getDate():!1}i=i||"mm/dd/yyyy";var n=/[^mdy]/.exec(i)[0],a=i.split(n),o=t.split(n);return s(o,a)}}},{}]},{},[11]); \ No newline at end of file diff --git a/js/private.js b/js/private.js index 5caef4a..5c63ba5 100644 --- a/js/private.js +++ b/js/private.js @@ -7,12 +7,14 @@ module.exports = { var self = this; - this._extend($.idealforms.extensions); - this.$form = $(this.el); this.$fields = $(); this.$inputs = $(); + this._extend($.idealforms.extensions); + + this._i18n(); + this._inject('_init'); this.addRules(this.opts.rules || {}); @@ -27,6 +29,22 @@ module.exports = { if (! this.opts.silentLoad) this.focusFirstInvalid(); }, + _i18n: function() { + + if (this.opts.i18n == 'en') return; + + var lang = $.idealforms.i18n[this.opts.i18n] + , errors = lang.errors + , options = {}; + + delete lang.errors; + + for (var ext in lang) options[ext] = { i18n: lang[ext] }; + + $.extend($.idealforms.errors, errors); + $.extend(true, this.opts, options); + }, + _buildField: function(input) { var self = this