Skip to content

Commit 2318b8c

Browse files
committed
Fix from @mpina83 for obsolete bootstrap decorator init; Fixes OptimalBPM#63
1 parent 9960e18 commit 2318b8c

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

angular-schema-form-dynamic-select.js

+38-14
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
root.angularSchemaFormDynamicSelect = factory(root.schemaForm);
88
}
99
}(this, function(schemaForm) {
10-
angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/strap/strapmultiselect.html","<div ng-controller=\"dynamicSelectController\" class=\"form-group {{form.htmlClass}}\"\n ng-class=\"{\'has-error\': hasError(), \'has-success\': hasSuccess()}\">\n <label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label>\n\n <div class=\"form-group {{form.fieldHtmlClass}}\" ng-init=\"populateTitleMap(form)\">\n <button type=\"button\" class=\"btn btn-default\" sf-changed=\"form\" schema-validate=\"form\" ng-model=\"$$value$$\"\n data-placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}\"\n data-html=\"1\"\n data-multiple=\"1\"\n data-placement=\"{{form.options.placement || \'bottom-left\'}}\"\n data-max-length=\"{{form.options.inlineMaxLength}}\"\n data-max-length-html=\"{{form.options.inlineMaxLengthHtml}}\"\n bs-options=\"item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:&quot;$$value$$&quot;\"\n bs-select>\n </button>\n <span class=\"help-block\">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span>\n </div>\n</div>\n");
11-
$templateCache.put("directives/decorators/bootstrap/strap/strapselect.html","<div ng-controller=\"dynamicSelectController\" class=\"form-group {{form.htmlClass}}\"\n ng-class=\"{\'has-error\': hasError(), \'has-success\': hasSuccess()}\">\n <label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label>\n\n <div class=\"form-group {{form.fieldHtmlClass}}\" ng-init=\"populateTitleMap(form)\">\n <button ng-if=\"(form.options.multiple == \'true\') || (form.options.multiple == true)\"\n type=\"button\" class=\"btn btn-default\" sf-changed=\"form\" schema-validate=\"form\" ng-model=\"$$value$$\"\n data-placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}\"\n data-html=\"1\" data-multiple=\"1\" data-max-length=\"{{form.options.inlineMaxLength}}\"\n data-placement=\"{{form.options.placement || \'bottom-left\'}}\"\n data-max-length-html=\"{{form.options.inlineMaxLengthHtml}}\"\n bs-options=\"item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:&quot;$$value$$&quot;\"\n bs-select>\n </button>\n <button ng-if=\"!((form.options.multiple == \'true\') || (form.options.multiple == true))\"\n type=\"button\" class=\"btn btn-default\" sf-changed=\"form\" schema-validate=\"form\" ng-model=\"$$value$$\"\n data-placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}\"\n data-html=\"1\"\n data-placement=\"{{form.options.placement || \'bottom-left\'}}\"\n bs-options=\"item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:&quot;$$value$$&quot;\"\n bs-select>\n </button>\n <span class=\"help-block\">{{ (hasError() && errorMessage(schemaError())) || form.description}} </span>\n </div>\n</div>\n\n");}]);
10+
angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/strap/strapmultiselect.html","<div ng-controller=\"dynamicSelectController\" class=\"form-group {{form.htmlClass}}\"\n ng-class=\"{\'has-error\': hasError(), \'has-success\': hasSuccess()}\">\n <label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label>\n\n <div class=\"form-group {{form.fieldHtmlClass}}\" ng-init=\"populateTitleMap(form)\">\n <button type=\"button\" class=\"btn btn-default\" sf-changed=\"form\" schema-validate=\"form\" sf-field-model=\"\"\n data-placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}\"\n data-html=\"1\"\n data-multiple=\"1\"\n data-placement=\"{{form.options.placement || \'bottom-left\'}}\"\n data-max-length=\"{{form.options.inlineMaxLength}}\"\n data-max-length-html=\"{{form.options.inlineMaxLengthHtml}}\"\n bs-options=\"item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:&quot;$$value$$&quot;\"\n bs-select>\n </button>\n <span class=\"help-block\">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span>\n </div>\n</div>\n");
11+
$templateCache.put("directives/decorators/bootstrap/strap/strapselect.html","<div ng-controller=\"dynamicSelectController\" class=\"form-group {{form.htmlClass}}\"\n ng-class=\"{\'has-error\': hasError(), \'has-success\': hasSuccess()}\">\n <label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label>\n\n <div class=\"form-group {{form.fieldHtmlClass}}\" ng-init=\"populateTitleMap(form)\">\n <button ng-if=\"(form.options.multiple == \'true\') || (form.options.multiple == true)\"\n type=\"button\" class=\"btn btn-default\" sf-changed=\"form\" schema-validate=\"form\" sf-field-model=\"\"\n data-placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}\"\n data-html=\"1\" data-multiple=\"1\" data-max-length=\"{{form.options.inlineMaxLength}}\"\n data-placement=\"{{form.options.placement || \'bottom-left\'}}\"\n data-max-length-html=\"{{form.options.inlineMaxLengthHtml}}\"\n bs-options=\"item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:&quot;$$value$$&quot;\"\n bs-select>\n </button>\n <button ng-if=\"!((form.options.multiple == \'true\') || (form.options.multiple == true))\"\n type=\"button\" class=\"btn btn-default\" sf-changed=\"form\" schema-validate=\"form\" sf-field-model=\"\"\n data-placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}\"\n data-html=\"1\"\n data-placement=\"{{form.options.placement || \'bottom-left\'}}\"\n bs-options=\"item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:&quot;$$value$$&quot;\"\n bs-select>\n </button>\n <span class=\"help-block\">{{ (hasError() && errorMessage(schemaError())) || form.description}} </span>\n </div>\n</div>\n\n");}]);
1212
angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/uiselect/uiselect.html","<div ng-controller=\"dynamicSelectController\" class=\"form-group\"\n ng-class=\"{\'has-error\': hasError(), \'has-success\': hasSuccess(), \'has-feedback\': form.feedback !== false}\"\n ng-init=\"insideModel=$$value$$;\">\n <label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label>\n\n <div class=\"form-group\">\n <ui-select ng-model=\"select_model.selected\"\n ng-if=\"!(form.options.tagging||false)\" theme=\"bootstrap\" ng-disabled=\"form.disabled\"\n on-select=\"$$value$$=$item.value\" class=\"{{form.options.uiClass}}\">\n <ui-select-match\n placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}\">\n {{select_model.selected.name}}\n </ui-select-match>\n <ui-select-choices refresh=\"populateTitleMap(form, $select.search)\"\n refresh-delay=\"form.options.refreshDelay\" group-by=\"form.options.groupBy\"\n repeat=\"item in form.titleMap | propsFilter: {name: $select.search, description: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\') }\">\n <div ng-bind-html=\"item.name | highlight: $select.search\"></div>\n <div ng-if=\"item.description\">\n <span ng-bind-html=\"\'<small>\' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\'))+ \'</small>\'\"></span>\n </div>\n </ui-select-choices>\n </ui-select>\n <ui-select ng-controller=\"dynamicSelectController\" ng-model=\"select_model.selected\"\n ng-if=\"(form.options.tagging||false) && !(form.options.groupBy || false)\"\n tagging=\"form.options.tagging||false\" tagging-label=\"form.options.taggingLabel\"\n tagging-tokens=\"form.options.taggingTokens\"\n theme=\"bootstrap\" ng-disabled=\"form.disabled\" on-select=\"$$value$$=$item.value\"\n class=\"{{form.options.uiClass}}\">\n <ui-select-match\n placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}\">\n {{select_model.selected.name}}&nbsp;\n <small>{{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}</small>\n </ui-select-match>\n <!--repeat code because tagging does not display properly under group by but is still useful -->\n <ui-select-choices refresh=\"populateTitleMap(form, $select.search)\"\n refresh-delay=\"form.options.refreshDelay\"\n repeat=\"item in form.titleMap | propsFilter: {name: $select.search, description: (form.options.searchDescription===true ? $select.search : \'NOTSEARCHINGFORTHIS\') }\">\n <div ng-if=\"item.isTag\"\n ng-bind-html=\"\'<div>\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'</div><div class=&quot;divider&quot;></div>\'\"></div>\n <div ng-if=\"!item.isTag\" ng-bind-html=\"item.name + item.isTag| highlight: $select.search\"></div>\n <div ng-if=\"item.description\">\n <span ng-bind-html=\"\'<small>\' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'</small>\'\"></span>\n </div>\n </ui-select-choices>\n </ui-select>\n\n <!--repeat code because tagging does not display properly under group by but is still useful -->\n\n <ui-select ng-controller=\"dynamicSelectController\" ng-model=\"select_model.selected\"\n ng-if=\"(form.options.tagging||false) && (form.options.groupBy || false)\"\n tagging=\"form.options.tagging||false\" tagging-label=\"form.options.taggingLabel\"\n tagging-tokens=\"form.options.taggingTokens\"\n theme=\"bootstrap\" ng-disabled=\"form.disabled\" on-select=\"$$value$$=$item.value\"\n class=\"{{form.options.uiClass}}\">\n <ui-select-match\n placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}\">\n {{select_model.selected.name}}&nbsp;\n <small>{{(select_model.selected.isTag===true ? form.options.taggingLabel : \'\')}}</small>\n </ui-select-match>\n <ui-select-choices group-by=\"form.options.groupBy\"\n refresh=\"populateTitleMap(form, $select.search)\"\n refresh-delay=\"form.options.refreshDelay\"\n repeat=\"item in form.titleMap | propsFilter: {name: $select.search, description: (form.options.searchDescription===true ? $select.search : \'NOTSEARCHINGFORTHIS\') }\">\n <div ng-if=\"item.isTag\"\n ng-bind-html=\"\'<div>\' + (item.name | highlight: $select.search) + \' \' + form.options.taggingLabel + \'</div><div class=&quot;divider&quot;></div>\'\"></div>\n <div ng-if=\"!item.isTag\" ng-bind-html=\"item.name + item.isTag| highlight: $select.search\"></div>\n <div ng-if=\"item.description\">\n <span ng-bind-html=\"\'<small>\' + (\'\'+item.description | highlight: (form.options.searchDescriptions===true ? $select.search : \'NOTSEARCHINGFORTHIS\')) + \'</small>\'\"></span>\n </div>\n </ui-select-choices>\n </ui-select>\n\n <input\n type=\"hidden\"\n name=\"{{form.key.slice(-1)[0]}}\"\n toggle-single-model\n sf-changed=\"form\"\n ng-model=\"insideModel\"\n schema-validate=\"form\"/>\n\n <span ng-if=\"form.feedback !== false\"\n class=\"form-control-feedback\"\n id=\"{{form.key.slice(-1)[0] + \'Status\'}}\"\n ng-class=\"evalInScope(form.feedback) || {\'glyphicon\': true, \'glyphicon-ok\': hasSuccess(), \'glyphicon-remove\': hasError() }\"></span>\n\n <div class=\"help-block\" sf-message=\"form.description\"></div>\n\n </div>\n</div>\n");
1313
$templateCache.put("directives/decorators/bootstrap/uiselect/uiselectmultiple.html","\n<div class=\"form-group\" ng-class=\"{\'has-error\': hasError(), \'has-success\': hasSuccess(), \'has-feedback\': form.feedback !== false}\"\n ng-controller=\"dynamicSelectController\" ng-init=\"$$value$$=$$value$$||[];uiMultiSelectInitInternalModel($$value$$)\">\n <label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label>\n <div class=\"form-group\">\n <ui-select multiple sortable-options=\"{{form.sortableOptions}}\" ng-model=\"internalModel\" theme=\"bootstrap\"\n on-select=\"$$value$$.push($item.value)\" on-remove=\"$$value$$.splice($$value$$.indexOf($item.value), 1)\"\n class=\"{{form.options.uiClass}}\">\n <ui-select-match placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\' | translate)}}\">{{$item.name}}</ui-select-match>\n <ui-select-choices repeat=\"item in form.titleMap | propsFilter: {name: $select.search}\"\n refresh=\"populateTitleMap(form, $select.search)\"\n refresh-delay=\"form.options.refreshDelay\"\n group-by=\"form.options.groupBy\">\n <div ng-bind-html=\"item.name | highlight: $select.search\"></div>\n </ui-select-choices>\n </ui-select>\n <span ng-if=\"form.feedback !== false\"\n class=\"form-control-feedback\"\n ng-class=\"evalInScope(form.feedback) || {\'glyphicon\': true, \'glyphicon-ok\': hasSuccess(), \'glyphicon-remove\': hasError() }\"></span>\n <div class=\"help-block\"\n ng-show=\"(hasError() && errorMessage(schemaError())) || form.description\"\n ng-bind-html=\"(hasError() && errorMessage(schemaError())) || form.description\"></div>\n </div>\n</div>\n");}]);
1414
angular.module('schemaForm').config(
15-
['schemaFormProvider', 'schemaFormDecoratorsProvider', 'sfPathProvider',
16-
function (schemaFormProvider, schemaFormDecoratorsProvider, sfPathProvider) {
15+
['schemaFormProvider', 'schemaFormDecoratorsProvider', 'sfPathProvider', 'sfBuilderProvider',
16+
function (schemaFormProvider, schemaFormDecoratorsProvider, sfPathProvider, sfBuilderProvider) {
1717

1818
var select = function (name, schema, options) {
1919
if ((schema.type === 'string') && ("enum" in schema)) {
@@ -26,11 +26,28 @@ angular.module('schemaForm').config(
2626
};
2727

2828
schemaFormProvider.defaults.string.unshift(select);
29-
29+
// Building up new angular schema for builders;
30+
31+
var simpleTransclusion = sfBuilderProvider.builders.simpleTransclusion;
32+
var ngModelOptions = sfBuilderProvider.builders.ngModelOptions;
33+
var ngModel = sfBuilderProvider.builders.ngModel;
34+
var sfField = sfBuilderProvider.builders.sfField;
35+
var condition = sfBuilderProvider.builders.condition;
36+
var array = sfBuilderProvider.builders.array;
37+
var defaults = [sfField, ngModel, ngModelOptions, condition];
38+
3039
//Add to the bootstrap directive
31-
schemaFormDecoratorsProvider.addMapping('bootstrapDecorator', 'strapselect',
32-
'directives/decorators/bootstrap/strap/strapselect.html');
33-
40+
/*schemaFormDecoratorsProvider.addMapping('bootstrapDecorator', 'strapselect',
41+
'directives/decorators/bootstrap/strap/strapselect.html');*/
42+
43+
//Add to the bootstrap directive with non deprecated methods
44+
schemaFormDecoratorsProvider.defineAddOn(
45+
'bootstrapDecorator',
46+
'strapselect',
47+
'directives/decorators/bootstrap/strap/strapselect.html',
48+
defaults
49+
);
50+
3451
schemaFormDecoratorsProvider.addMapping('bootstrapDecorator', 'strapmultiselect',
3552
'directives/decorators/bootstrap/strap/strapmultiselect.html');
3653

@@ -39,17 +56,24 @@ angular.module('schemaForm').config(
3956

4057
schemaFormDecoratorsProvider.addMapping('bootstrapDecorator', 'strapmultiselectdynamic',
4158
'directives/decorators/bootstrap/strap/strapmultiselect.html');
42-
43-
59+
4460
// UI SELECT
4561
//Add to the bootstrap directive
46-
schemaFormDecoratorsProvider.addMapping('bootstrapDecorator', 'uiselect',
47-
'directives/decorators/bootstrap/uiselect/uiselect.html');
48-
49-
62+
/*schemaFormDecoratorsProvider.addMapping('bootstrapDecorator', 'uiselect',
63+
'directives/decorators/bootstrap/uiselect/uiselect.html');*/
64+
65+
//Add to the bootstrap directive with non deprecated methods
66+
schemaFormDecoratorsProvider.defineAddOn(
67+
'bootstrapDecorator',
68+
'uiselect',
69+
'directives/decorators/bootstrap/uiselect/uiselect.html',
70+
defaults
71+
);
72+
5073
schemaFormDecoratorsProvider.addMapping('bootstrapDecorator', 'uiselectmultiple',
5174
'directives/decorators/bootstrap/uiselect/uiselectmultiple.html');
5275

76+
5377

5478
}])
5579
.directive("toggleSingleModel", function() {

0 commit comments

Comments
 (0)