some improvements

This commit is contained in:
elclanrs 2013-10-10 07:49:09 -04:00
parent 3767e07518
commit 17eb28af2c
6 changed files with 15 additions and 188 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -23,8 +23,8 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="472.88775"
inkscape:cy="619.76777"
inkscape:cx="645.7187"
inkscape:cy="587.89319"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
@ -68,7 +68,7 @@
<path
inkscape:export-ydpi="90"
inkscape:export-xdpi="90"
inkscape:export-filename="/home/elclanrs/Desktop/idealforms3.png"
inkscape:export-filename="/home/elclanrs/www/idealforms-docs/img/logo.png"
sodipodi:nodetypes="cccccccc"
inkscape:connector-curvature="0"
id="rect2989"
@ -79,7 +79,7 @@
transform="scale(1.0066801,0.99336421)"
inkscape:export-ydpi="90"
inkscape:export-xdpi="90"
inkscape:export-filename="/home/elclanrs/Desktop/idealforms3.png"
inkscape:export-filename="/home/elclanrs/www/idealforms-docs/img/logo.png"
sodipodi:linespacing="51.999998%"
id="text2985"
y="438.41376"
@ -94,8 +94,8 @@
sodipodi:role="line">IDEAL FORMS </tspan></text>
<g
id="g3760"
transform="matrix(1.000000,0.000000,0.000000,1.000000,-1.000000,1.000000)"
inkscape:export-filename="/home/elclanrs/Desktop/idealforms3.png"
transform="matrix(1.000000,0.000000,0.000000,1.000000,-7.000000,1.000000)"
inkscape:export-filename="/home/elclanrs/www/idealforms-docs/img/logo.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<path
@ -116,13 +116,13 @@
id="text3766"
y="434.70209"
x="597.02643"
style="font-size:22.03571128999999829px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;text-align:start;line-height:51.99999808999999829%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#942416;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Medium"
style="font-size:22.03571129px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;text-align:start;line-height:51.99999809%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#942416;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Medium"
xml:space="preserve"
inkscape:export-filename="/home/elclanrs/Desktop/idealforms3.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
transform="scale(1.0066801,0.99336422)"><tspan
style="font-size:22.03571128999999829px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;text-align:start;line-height:51.99999808999999829%;letter-spacing:-0.90346420000000005px;writing-mode:lr-tb;text-anchor:start;fill:#942416;fill-opacity:1;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Medium"
style="font-size:22.03571129px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;text-align:start;line-height:51.99999809%;letter-spacing:-0.9034642px;writing-mode:lr-tb;text-anchor:start;fill:#942416;fill-opacity:1;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Medium"
y="434.70209"
x="597.02643"
id="tspan3768"

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -1,173 +0,0 @@
;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/**
* Errors
*/
module.exports = {
required: 'This field is required',
digits: 'Must be only digits',
name: 'Must be at least 3 characters long and must only contain letters',
email: 'Must be a valid email',
username: 'Must be at between 4 and 32 characters long and start with a letter. You may use letters, numbers, underscores, and one dot',
pass: 'Must be at least 6 characters long, and contain at least one number, one uppercase and one lowercase letter',
strongpass: 'Must be at least 8 characters long and contain at least one uppercase and one lowercase letter and one number or special character',
phone: 'Must be a valid phone number',
zip: 'Must be a valid zip code',
url: 'Must be a valid URL',
number: 'Must be a number',
range: 'Must be a number between {0} and {1}',
min: 'Must be at least {0} characters long',
max: 'Must be under {0} characters',
minoption: 'Select at least {0} options',
maxoption: 'Select no more than {0} options',
minmax: 'Must be between {0} and {1} characters long',
select: 'Select an option',
extension: 'File(s) must have a valid extension ({*})',
equalto: 'Must have the same value as the "{0}" field',
date: 'Must be a valid date {0}'
};
},{}],2:[function(require,module,exports){
/**
* Adaptive
*/
module.exports = {
name: 'adaptive',
options: {
adaptiveWidth: $('<p class="idealforms-field-width"/>').appendTo('body').css('width').replace('px','')
},
methods: {
// @extend
_init: function () {
var self = this;
function adapt() {
var formWidth = self.$form.outerWidth()
, isAdaptive = self.opts.adaptiveWidth > formWidth;
self.$form.toggleClass('adaptive', isAdaptive);
if (self._hasExtension('steps')) {
self.$stepsContainer.toggleClass('adaptive', isAdaptive);
}
$('#ui-datepicker-div').hide();
}
$(window).resize(adapt);
adapt();
this.$form.find('select, .datepicker').each(function() {
self._getField(this).find(self.opts.error).addClass('hidden');
});
$('p.idealforms-field-width').remove();
}
}
};
},{}],3:[function(require,module,exports){
module.exports = {
name: 'ajax',
methods: {
// @extend
_init: function() {
$.extend($.idealforms, { _requests: {} });
$.idealforms.errors.ajax = $.idealforms.errors.ajax || 'Loading...';
$.extend($.idealforms.rules, {
ajax: function(input) {
var self = this
, $field = this._getField(input)
, url = $(input).data('idealforms-ajax')
, userError = $.idealforms._getKey('errors.'+ input.name +'.ajaxError', self.opts)
, requests = $.idealforms._requests
, data = {};
data[input.name] = input.value;
$field.addClass('ajax');
if (requests[input.name]) requests[input.name].abort();
requests[input.name] = $.post(url, data, function(resp) {
if (resp === true) {
$field.data('idealforms-valid', true);
self._handleError(input);
self._handleStyle(input);
} else {
self._handleError(input, userError);
}
$field.removeClass('ajax');
}, 'json');
return false;
}
});
},
// @extend
_validate: function(input, rule) {
if (rule != 'ajax' && $.idealforms._requests[input.name]) {
$.idealforms._requests[input.name].abort();
this._getField(input).removeClass('ajax');
}
}
}
};
},{}],4:[function(require,module,exports){
require('./idealfile');
require('./idealradiocheck');
module.exports = {
name: 'customInputs',
options: {
customInputs: {
i18n: {
open: 'Open'
}
}
},
methods: {
// @extend
_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}]

File diff suppressed because one or more lines are too long

View file

@ -26,7 +26,10 @@ module.exports = {
self.opts.onSubmit.call(self, self.getInvalid().length, e);
});
if (! this.opts.silentLoad) this.focusFirstInvalid();
if (! this.opts.silentLoad) {
// 1ms timeout to make sure error shows up
setTimeout($.proxy(this.focusFirstInvalid, this), 1);
}
},
_i18n: function() {
@ -78,10 +81,7 @@ module.exports = {
self._validate(this, true, true);
})
.focus(function() {
if (self.isValid(this.name)) return false;
if (self._isRequired(this) || this.value) {
if (! self.isValid(this.name)) {
$field.find(self.opts.error).show();
}
})

View file

@ -38,7 +38,7 @@ module.exports = {
this._handleError(firstInvalid);
this._handleStyle(firstInvalid);
this._inject('focusFirstInvalid', firstInvalid);
firstInvalid.focus();
$(firstInvalid).focus();
}
},