Skip to content

Commit 282154e

Browse files
author
Chris Houseknecht
committed
Clean up of css class override feature. Added a select on click to spinner directive.
1 parent de0aae8 commit 282154e

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<script src="/bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
5757
<script src="/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
5858
<script src="/app/js/sampleApp.js"></script>
59-
<script src="/dist/angular-forms.min.js"></script>
59+
<script src="/dist/angular-forms.js"></script>
6060
<script src="/dist/angular-modal.js"></script>
6161
<script src="/app/js/forms/SampleForm.js"></script>
6262
<script src="/app/js/forms/CheckBoxForm.js"></script>

dist/angular-forms.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,33 @@ angular.module('AngularFormsModule', [])
3737
}])
3838

3939
.factory('AngularForms', [ '$compile', 'Empty', function($compile, Empty) {
40-
var defaultCss = {
41-
help: 'help-text',
42-
error: 'error'
43-
};
44-
4540
return function(params) {
46-
41+
4742
var fn = function() {
43+
44+
this.defaultCss = {
45+
help: 'help-text',
46+
error: 'error'
47+
};
4848

4949
this.init = function() {
50+
var key;
5051
this.form = params.form;
5152
this.targetId = params.targetId;
5253
this.scope = params.scope;
5354

54-
if (typeof params.formCss === 'undefined') {
55-
this.formCss = defaultCss;
55+
if (Empty(params.formCss)) {
56+
this.formCss = this.defaultCss;
5657
} else {
5758
this.formCss = params.formCss;
5859

5960
// copy defaults for undefined classes
60-
if (typeof this.formCss.help === 'undefined') {
61-
this.formCss.help = 'help-text';
62-
}
63-
if (typeof this.formCss.error === 'undefined') {
64-
this.formCss.error = 'error';
61+
for (key in this.defaultCss) {
62+
if (Empty(this.formCss[key])) {
63+
this.formCss[key] = this.defaultCss[key];
64+
}
6565
}
6666
}
67-
6867
this.col_size = "col-sm-10";
6968
};
7069

@@ -320,7 +319,7 @@ angular.module('AngularFormsModule', [])
320319
};
321320

322321
this.addValidations = function(f, fld) {
323-
var html = '';
322+
var msg, html = '';
324323
if (fld.required || fld.ngRequired) {
325324
html += "<div class=\"";
326325
html += this.formCss.error;
@@ -556,6 +555,9 @@ angular.module('AngularFormsModule', [])
556555
}
557556
}
558557
});
558+
$(element).on('click', function() {
559+
$(this).select();
560+
});
559561
}
560562
};
561563
}]);

0 commit comments

Comments
 (0)