Skip to content

Commit

Permalink
Added dependency declarations in preparation for using Juicer for dep…
Browse files Browse the repository at this point in the history
…endency resolving

git-svn-id: https://svn.cjohansen.no/validatious2/trunk@2666 1ed5ca13-5fb8-644a-9ef7-ad08ef2e8add
  • Loading branch information
christian committed Dec 28, 2008
1 parent 607ed81 commit 4b751ad
Show file tree
Hide file tree
Showing 33 changed files with 58 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/bridge/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* when in standalone mode. When bridging Validatious to frameworks you need
* to replicate the functionality in this file leveraging the frameworks custom
* functionality. This will help you minimize duplication.
*
* @depends ../lib/add_dom_load_event.js
* @depends ../lib/Base.js
* @depends ../lib/events.js
*/
// Global namespace
if (typeof v2 === 'undefined' || v2 === null) {
Expand Down
1 change: 1 addition & 0 deletions src/core/checkbox_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Checkbox input controls
*
* @implements v2.FieldElement
* @depends input_element.js
*/
v2.CheckboxElement = v2.RadioElement.extend(/** @scope v2.CheckboxElement.prototype */{

Expand Down
2 changes: 2 additions & 0 deletions src/core/composite_form_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*
* The private boolean __passOnAny is used to serve the passOnAny() method. It's
* default value is false.
*
* @depends v2.js
*/
v2.CompositeFormItem = Base.extend(/** @scope v2.CompositeFormItem.prototype */{
type: 'generic', // Makes for easier type checking
Expand Down
8 changes: 5 additions & 3 deletions src/core/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* @implements v2.Composite
* @implements v2.FormItem
* @depends composite_form_item.js
* @depends input_element.js
*/
v2.Field = v2.CompositeFormItem.extend(/** @scope v2.Field.prototype */{
validateHidden: false, // If a field should be validated even if it's not
Expand Down Expand Up @@ -100,10 +102,10 @@ v2.Field = v2.CompositeFormItem.extend(/** @scope v2.Field.prototype */{

this.__monitored = true;
var obj = this.parent && this.parent.type === 'fieldset' ? this.parent : this;
var validate = obj.validate.bind(this);
var validate = obj.validate.bind(this);

this.element.monitor(function(e) {
validate(e);
});
validate(e);
});
}
});
4 changes: 4 additions & 0 deletions src/core/field_validator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/**
* @class Represents a single field and validator along with an optional custom
* error message when the default message is not suitable.
*
* @depends field.js
* @depends validator.js
* @depends message.js
*/
v2.FieldValidator = Base.extend(/** @scope v2.FieldValidator.prototype */{
invert: false,
Expand Down
1 change: 1 addition & 0 deletions src/core/fieldset.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*
* @implements v2.Composite
* @implements v2.FormItem
* @depends composite_form_item.js
*/
v2.Fieldset = v2.CompositeFormItem.extend(/** @scope v2.Fieldset.prototype */{
type: 'fieldset', // Makes for easier typechecking
Expand Down
2 changes: 2 additions & 0 deletions src/core/form.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* Forms with validation logic. Implements the v2.Composite and v2.FormItem
* interfaces.
*
* @depends composite_form_item.js
*/
v2.Form = v2.CompositeFormItem.extend(/** @scope v2.Form.prototype */{
type: 'form', // Eases type checking
Expand Down
1 change: 1 addition & 0 deletions src/core/input_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Generic input control
*
* @implements v2.FieldElement
* @depends composite_form_item.js
*/
v2.InputElement = Base.extend(/** @scope v2.InputElement.prototype */{

Expand Down
2 changes: 2 additions & 0 deletions src/core/message.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* @class The message object store an error message with interpolated
* parameters.
*
* @depends v2.js
*/
v2.Message = Base.extend(/** @scope v2.Message */{
/**
Expand Down
1 change: 1 addition & 0 deletions src/core/radio_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @implements v2.Composite
* @implements v2.FormItem
* @implements v2.FieldElement
* @depends input_element.js
*/
v2.RadioElement = v2.InputElement.extend(/** @scope v2.RadioElement.prototype */{
/**
Expand Down
1 change: 1 addition & 0 deletions src/core/select_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Input controls based on select boxes
*
* @implements v2.FieldElement
* @depends input_element.js
*/
v2.SelectElement = v2.InputElement.extend(/** @scope v2.SelectElement.prototype */{

Expand Down
1 change: 1 addition & 0 deletions src/core/textarea_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Textarea input control
*
* @implements v2.FieldElement
* @depends input_element.js
*/
v2.TextareaElement = v2.InputElement.extend(/** @scope v2.TextareaElement.prototype */{
});
3 changes: 3 additions & 0 deletions src/core/validator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
* @class A validator encapsulates the logic required to validate a value with
* some parameters.
*
* @depends v2.js
* @depends message.js
*/
v2.Validator = Base.extend(/** @scope v2.Validator.prototype */{
constructor: function(name, fn, message, params, aliases) {
Expand Down
2 changes: 2 additions & 0 deletions src/extensions/dsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* @author Christian Johansen (christian@cjohansen.no)
* @version 0.9
* @license BSD
* @depends ../core/field.js
* @depends ../core/form.js
*/

/**
Expand Down
3 changes: 3 additions & 0 deletions src/extensions/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* @author Christian Johansen (christian@cjohansen.no)
* @version 0.9
* @license BSD
* @depends ../core/validator.js
* @depends ../core/form.js
* @depends ../core/message.js
*/

/**
Expand Down
3 changes: 3 additions & 0 deletions src/extensions/reporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* @author Christian Johansen (christian@cjohansen.no)
* @version 0.9
* @license BSD
* @depends ../core/form.js
* @depends ../core/fieldset.js
* @depends ../core/field.js
*/
v2.ErrorReporting = {
displayErrors: -1, // How many error messages to display per item
Expand Down
2 changes: 2 additions & 0 deletions src/messages/errors.en.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/**
* English default error messages
*
* @depends ../core/message.js
*/
v2.$msg({
'alpha': '${field} should only contain letters',
Expand Down
2 changes: 2 additions & 0 deletions src/messages/errors.no.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/**
* Norwegian default error messages
*
* @depends ../core/message.js
*/
v2.$msg({
'alpha': '${field} skal bare inneholde bokstaver',
Expand Down
1 change: 1 addition & 0 deletions src/validators/alpha.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Validates that a value contans only letters.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('alpha', function(field, value, params) {
return /^[a-zA-Z\u00A1-\uFFFF]*$/.test(value);
Expand Down
1 change: 1 addition & 0 deletions src/validators/alphanum.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Validates that a value only contains letters and numbers.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('alphanum', function(field, value, params) {
return /^([a-zA-Z\u00A1-\uFFFF0-9])*$/.test(value);
Expand Down
2 changes: 2 additions & 0 deletions src/validators/car_regnum_nor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* Validates that a value is a valid norwegian car registration number (as in
* license plates).
*
* @depends ../core/validator.js
*/
v2.Validator.reg('car-regnum-nor', function(field, value, params) {
return /^[a-zA-Z]{1,2}[\s\t]*[0-9]{3,5}$/.test(value.replace(/\s/g, ''));
Expand Down
1 change: 1 addition & 0 deletions src/validators/confirmation_of.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Validates that a value is a confirmation of another field.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('confirmation-of', function(field, value, params) {
return value === v2.$f(params[0]).getValue();
Expand Down
1 change: 1 addition & 0 deletions src/validators/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Validates a value as an email address.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('email', function(field, value, params) {
// This doesn't compress... http://www.regular-expressions.info/email.html
Expand Down
1 change: 1 addition & 0 deletions src/validators/max_length.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* <code>${max}</code>.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('max-length', function(field, value, params) {
return value.length < params[0];
Expand Down
1 change: 1 addition & 0 deletions src/validators/max_val.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* <code>${max}</code>.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('max-val', function(field, value, params) {
return value <= params[0];
Expand Down
1 change: 1 addition & 0 deletions src/validators/min_length.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* <code>${min}</code>.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('min-length', function(field, value, params) {
return value.length >= params[0];
Expand Down
1 change: 1 addition & 0 deletions src/validators/min_val.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* <code>${min}</code>.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('min-val', function(field, value, params) {
return value >= params[0];
Expand Down
1 change: 1 addition & 0 deletions src/validators/numeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Validates that a value only contains numbers.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('numeric', function(field, value, params) {
return /^[0-9]*(\.[0-9]+)?$/.test(value);
Expand Down
2 changes: 2 additions & 0 deletions src/validators/phone_nor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/**
* Validates that a value is a valid norwegian telephone number.
*
* @depends ../core/validator.js
*/
v2.Validator.reg('phone-nor', function(field, value, params) {
return /^((00|\+)\d\d)?\d{8}$/.test(value.replace(/\s/g, ''));
Expand Down
1 change: 1 addition & 0 deletions src/validators/required.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Validates that a field has a value.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('required', function(field, value, params) {
return !v2.empty(value) && !(typeof value.length !== 'undefined' && value.length === 0);
Expand Down
2 changes: 2 additions & 0 deletions src/validators/ssn_nor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/**
* Validates that a value is a valid norwegian social security number.
*
* @depends ../core/validator.js
*/
v2.Validator.reg('ssn-nor', function(field, value, params) {
var ok = true;
Expand Down
1 change: 1 addition & 0 deletions src/validators/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Validates that a value is a valid URL.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('url', function(field, value, params) {
return /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(value);
Expand Down
1 change: 1 addition & 0 deletions src/validators/word.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* underscores and dashes.
*
* @builtin
* @depends ../core/validator.js
*/
v2.Validator.reg('word', function(field, value, params) {
return /^([a-zA-Z\u00A1-\uFFFF0-9_\-\s\t])*$/.test(value);
Expand Down

0 comments on commit 4b751ad

Please sign in to comment.