Permalink
Browse files

Distribution

  • Loading branch information...
1 parent 4889d18 commit 49d6706097484327bc2f4be5127a9efab61da7bf @powmedia committed Oct 12, 2012
@@ -788,7 +788,8 @@ Form.Field = (function() {
id: editor.id,
type: schema.type,
editor: '<b class="bbf-tmp-editor"></b>',
- help: '<b class="bbf-tmp-help"></b>'
+ help: '<b class="bbf-tmp-help"></b>',
+ error: '<b class="bbf-tmp-error"></b>'
};
},
@@ -829,7 +830,11 @@ Form.Field = (function() {
this.$help = $('.bbf-tmp-help', $field).parent();
this.$help.empty();
if (this.schema.help) this.$help.html(this.schema.help);
-
+
+ //Create error container
+ this.$error = $($('.bbf-tmp-error', $field).parent()[0]);
+ if (this.$error) this.$error.empty();
+
//Add custom CSS class names
if (this.schema.fieldClass) $field.addClass(this.schema.fieldClass);
@@ -894,7 +899,11 @@ Form.Field = (function() {
this.$el.addClass(errClass);
- if (this.$help) this.$help.html(msg);
+ if (this.$error) {
+ this.$error.html(msg);
+ } else if (this.$help) {
+ this.$help.html(msg);
+ }
},
/**
@@ -906,7 +915,9 @@ Form.Field = (function() {
this.$el.removeClass(errClass);
// some fields (e.g., Hidden), may not have a help el
- if (this.$help) {
+ if (this.$error) {
+ this.$error.empty();
+ } else if (this.$help) {
this.$help.empty();
//Reset help text if available
@@ -961,6 +972,7 @@ Form.Field = (function() {
})();
+
//========================================================================
//EDITORS
//========================================================================
@@ -2256,6 +2268,7 @@ Form.editors = (function() {
<label for="{{id}}">{{title}}</label>\
<div class="bbf-editor">{{editor}}</div>\
<div class="bbf-help">{{help}}</div>\
+ <div class="bbf-error">{{error}}</div>\
</li>\
',
@@ -2264,6 +2277,7 @@ Form.editors = (function() {
<label for="{{id}}">{{title}}</label>\
<div class="bbf-editor">{{editor}}</div>\
<div class="bbf-help">{{help}}</div>\
+ <div class="bbf-error">{{error}}</div>\
</li>\
',

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -28,15 +28,18 @@ define(['jquery', 'underscore', 'backbone', 'backbone-forms'], function($, _, Ba
<div class="control-group field-{{key}}">\
<label class="control-label" for="{{id}}">{{title}}</label>\
<div class="controls">\
- <div class="input-xlarge">{{editor}}</div>\
+ {{editor}}\
+ <div class="help-inline">{{error}}</div>\
<div class="help-block">{{help}}</div>\
</div>\
</div>\
',
nestedField: '\
<div class="field-{{key}}">\
- <div title="{{title}}" class="input-xlarge">{{editor}}</div>\
+ <div title="{{title}}" class="input-xlarge">{{editor}}\
+ <div class="help-inline">{{error}}</div>\
+ </div>\
<div class="help-block">{{help}}</div>\
</div>\
',
@@ -34,6 +34,12 @@
color: #999;
}
+ .bbf-field .bbf-error {
+ margin-left: 25%;
+ width: 74%;
+ color: red;
+ }
+
.bbf-field.bbf-error .bbf-editor {
outline: 1px solid red;
}
@@ -28,6 +28,7 @@ define(['jquery', 'underscore', 'backbone', 'backbone-forms'], function($, _, Ba
<label for="{{id}}">{{title}}</label>\
<div class="bbf-editor">{{editor}}</div>\
<div class="bbf-help">{{help}}</div>\
+ <div class="bbf-error">{{error}}</div>\
</li>\
',
@@ -36,6 +37,7 @@ define(['jquery', 'underscore', 'backbone', 'backbone-forms'], function($, _, Ba
<label for="{{id}}">{{title}}</label>\
<div class="bbf-editor">{{editor}}</div>\
<div class="bbf-help">{{help}}</div>\
+ <div class="bbf-error">{{error}}</div>\
</li>\
',
@@ -801,7 +801,8 @@ Form.Field = (function() {
id: editor.id,
type: schema.type,
editor: '<b class="bbf-tmp-editor"></b>',
- help: '<b class="bbf-tmp-help"></b>'
+ help: '<b class="bbf-tmp-help"></b>',
+ error: '<b class="bbf-tmp-error"></b>'
};
},
@@ -842,7 +843,11 @@ Form.Field = (function() {
this.$help = $('.bbf-tmp-help', $field).parent();
this.$help.empty();
if (this.schema.help) this.$help.html(this.schema.help);
-
+
+ //Create error container
+ this.$error = $($('.bbf-tmp-error', $field).parent()[0]);
+ if (this.$error) this.$error.empty();
+
//Add custom CSS class names
if (this.schema.fieldClass) $field.addClass(this.schema.fieldClass);
@@ -907,7 +912,11 @@ Form.Field = (function() {
this.$el.addClass(errClass);
- if (this.$help) this.$help.html(msg);
+ if (this.$error) {
+ this.$error.html(msg);
+ } else if (this.$help) {
+ this.$help.html(msg);
+ }
},
/**
@@ -919,7 +928,9 @@ Form.Field = (function() {
this.$el.removeClass(errClass);
// some fields (e.g., Hidden), may not have a help el
- if (this.$help) {
+ if (this.$error) {
+ this.$error.empty();
+ } else if (this.$help) {
this.$help.empty();
//Reset help text if available
@@ -974,6 +985,7 @@ Form.Field = (function() {
})();
+
//========================================================================
//EDITORS
//========================================================================
@@ -2269,6 +2281,7 @@ Form.editors = (function() {
<label for="{{id}}">{{title}}</label>\
<div class="bbf-editor">{{editor}}</div>\
<div class="bbf-help">{{help}}</div>\
+ <div class="bbf-error">{{error}}</div>\
</li>\
',
@@ -2277,6 +2290,7 @@ Form.editors = (function() {
<label for="{{id}}">{{title}}</label>\
<div class="bbf-editor">{{editor}}</div>\
<div class="bbf-help">{{help}}</div>\
+ <div class="bbf-error">{{error}}</div>\
</li>\
',

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -31,15 +31,18 @@
<div class="control-group field-{{key}}">\
<label class="control-label" for="{{id}}">{{title}}</label>\
<div class="controls">\
- <div class="input-xlarge">{{editor}}</div>\
+ {{editor}}\
+ <div class="help-inline">{{error}}</div>\
<div class="help-block">{{help}}</div>\
</div>\
</div>\
',
nestedField: '\
<div class="field-{{key}}">\
- <div title="{{title}}" class="input-xlarge">{{editor}}</div>\
+ <div title="{{title}}" class="input-xlarge">{{editor}}\
+ <div class="help-inline">{{error}}</div>\
+ </div>\
<div class="help-block">{{help}}</div>\
</div>\
',
@@ -34,6 +34,12 @@
color: #999;
}
+ .bbf-field .bbf-error {
+ margin-left: 25%;
+ width: 74%;
+ color: red;
+ }
+
.bbf-field.bbf-error .bbf-editor {
outline: 1px solid red;
}
@@ -31,6 +31,7 @@
<label for="{{id}}">{{title}}</label>\
<div class="bbf-editor">{{editor}}</div>\
<div class="bbf-help">{{help}}</div>\
+ <div class="bbf-error">{{error}}</div>\
</li>\
',
@@ -39,6 +40,7 @@
<label for="{{id}}">{{title}}</label>\
<div class="bbf-editor">{{editor}}</div>\
<div class="bbf-help">{{help}}</div>\
+ <div class="bbf-error">{{error}}</div>\
</li>\
',

0 comments on commit 49d6706

Please sign in to comment.