Skip to content

Commit c528edf

Browse files
committed
fix(form) Slight improvements when passing attributes to directives
1 parent 82d7339 commit c528edf

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

dist/forms-angular.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,8 +2410,10 @@ var fng;
24102410
if (cssFrameworkService.framework() === 'bs3' && isHorizontalStyle(options.formstyle) && fieldInfo.type !== 'checkbox') {
24112411
value = '<div class="bs3-input ' + markupVars.sizeClassBS3 + '">' + value + '</div>';
24122412
}
2413-
if (fieldInfo.helpInline) {
2414-
value += '<span class="' + (cssFrameworkService.framework() === 'bs2' ? 'help-inline' : 'help-block') + '">' + fieldInfo.helpInline + '</span>';
2413+
// Hack to cope with inline help in directives
2414+
var inlineHelp = (fieldInfo.helpInline || '') + (fieldInfo.helpinline || '');
2415+
if (inlineHelp.length > 0) {
2416+
value += '<span class="' + (cssFrameworkService.framework() === 'bs2' ? 'help-inline' : 'help-block') + '">' + inlineHelp + '</span>';
24152417
}
24162418
// If we have chosen
24172419
value += '<div ng-if="' + (options.name || 'myForm') + '.' + fieldInfo.id + '.$dirty" class="help-block">' +
@@ -2538,7 +2540,7 @@ var fng;
25382540
options[prop.slice(6).toLowerCase()] = deserialize(attr[prop]);
25392541
}
25402542
else if (directiveName && prop.slice(0, directiveNameLength) === directiveName) {
2541-
directiveOptions[prop.slice(directiveNameLength).toLowerCase()] = deserialize(attr[prop]);
2543+
directiveOptions[_.kebabCase(prop.slice(directiveNameLength))] = deserialize(attr[prop]);
25422544
}
25432545
}
25442546
}

dist/forms-angular.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/services/form-markup-helper.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,10 @@ module fng.services {
170170
if (cssFrameworkService.framework() === 'bs3' && isHorizontalStyle(options.formstyle) && fieldInfo.type !== 'checkbox') {
171171
value = '<div class="bs3-input ' + markupVars.sizeClassBS3 + '">' + value + '</div>';
172172
}
173-
if (fieldInfo.helpInline) {
174-
value += '<span class="' + (cssFrameworkService.framework() === 'bs2' ? 'help-inline' : 'help-block') + '">' + fieldInfo.helpInline + '</span>';
173+
// Hack to cope with inline help in directives
174+
var inlineHelp = (fieldInfo.helpInline || '') + (fieldInfo.helpinline || '');
175+
if (inlineHelp.length > 0) {
176+
value += '<span class="' + (cssFrameworkService.framework() === 'bs2' ? 'help-inline' : 'help-block') + '">' + inlineHelp + '</span>';
175177
}
176178
// If we have chosen
177179
value += '<div ng-if="' + (options.name || 'myForm') + '.' + fieldInfo.id + '.$dirty" class="help-block">' +

js/services/plugin-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module fng.services {
3333
} else if (prop.slice(0, 6) === 'fngOpt') {
3434
options[prop.slice(6).toLowerCase()] = deserialize(attr[prop]);
3535
} else if (directiveName && prop.slice(0, directiveNameLength) === directiveName) {
36-
directiveOptions[prop.slice(directiveNameLength).toLowerCase()] = deserialize(attr[prop]);
36+
directiveOptions[_.kebabCase(prop.slice(directiveNameLength))] = deserialize(attr[prop]);
3737
}
3838
}
3939
}

0 commit comments

Comments
 (0)