forked from json-schema-form/angular-schema-form-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap-decorator.js
More file actions
162 lines (149 loc) · 41.5 KB
/
Copy pathbootstrap-decorator.js
File metadata and controls
162 lines (149 loc) · 41.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("decorators/bootstrap/actions-trcl.html","<div class=\"btn-group schema-form-actions {{form.htmlClass}}\" ng-transclude=\"\"></div>");
$templateCache.put("decorators/bootstrap/actions.html","<div class=\"btn-group schema-form-actions {{form.htmlClass}}\"><input ng-repeat-start=\"item in form.items\" type=\"submit\" class=\"btn {{ item.style || \'btn-default\' }} {{form.fieldHtmlClass}}\" value=\"{{item.title}}\" ng-if=\"item.type === \'submit\'\"> <button ng-repeat-end=\"\" class=\"btn {{ item.style || \'btn-default\' }} {{form.fieldHtmlClass}}\" type=\"button\" ng-disabled=\"form.readonly\" ng-if=\"item.type !== \'submit\'\" ng-click=\"buttonClick($event,item)\"><span ng-if=\"item.icon\" class=\"{{item.icon}}\"></span>{{item.title}}</button></div>");
$templateCache.put("decorators/bootstrap/array.html","<div ng-if=\"form.readonly && $$value$$\" sf-array=\"form\" class=\"schema-form-array {{form.htmlClass}}\" ng-model=\"$$value$$\" ng-model-options=\"form.ngModelOptions\"><label class=\"control-label\" ng-show=\"showTitle()\">{{ form.title }}</label><ol class=\"list-group\" ng-model=\"modelArray\" ui-sortable=\"\"><li class=\"list-group-item {{form.fieldHtmlClass}}\" ng-repeat=\"item in modelArray track by $index\"><sf-decorator ng-init=\"arrayIndex = $index\" form=\"copyWithIndex($index)\"></sf-decorator></li></ol></div><div sf-array=\"form\" class=\"schema-form-array {{form.htmlClass}}\" ng-if=\"!form.readonly\" ng-model=\"$$value$$\" ng-model-options=\"form.ngModelOptions\"><label class=\"control-label\" ng-show=\"showTitle()\">{{ form.title }}</label><ol class=\"list-group\" ng-model=\"modelArray\" ui-sortable=\"\"><li class=\"list-group-item {{form.fieldHtmlClass}}\" ng-repeat=\"item in modelArray track by $index\"><button ng-hide=\"form.readonly || form.remove === null\" ng-click=\"deleteFromArray($index)\" style=\"position: relative; z-index: 20;\" type=\"button\" class=\"close pull-right\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button><sf-decorator ng-init=\"arrayIndex = $index\" form=\"copyWithIndex($index)\"></sf-decorator></li></ol><div class=\"clearfix\" style=\"padding: 15px;\"><button ng-hide=\"form.readonly || form.add === null\" ng-click=\"appendToArray()\" type=\"button\" class=\"btn {{ form.style.add || \'btn-default\' }} pull-right\"><i class=\"glyphicon glyphicon-plus\"></i> {{ form.add || \'Add\'}}</button></div><div class=\"help-block\" ng-show=\"(hasError() && errorMessage(schemaError())) || form.description\" ng-bind-html=\"(hasError() && errorMessage(schemaError())) || form.description\"></div></div>");
$templateCache.put("decorators/bootstrap/checkbox.html","<div class=\"checkbox schema-form-checkbox {{form.htmlClass}}\" ng-class=\"{\'has-error\': form.disableErrorState !== true && hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess()}\"><label class=\"{{form.labelHtmlClass}}\"><input type=\"checkbox\" sf-changed=\"form\" ng-disabled=\"form.readonly\" ng-model=\"$$value$$\" ng-model-options=\"form.ngModelOptions\" schema-validate=\"form\" class=\"{{form.fieldHtmlClass}}\" name=\"{{form.key.slice(-1)[0]}}\"> <span ng-bind-html=\"form.title\"></span></label><div class=\"help-block\" sf-message=\"form.description\"></div></div>");
$templateCache.put("decorators/bootstrap/checkboxes.html","<div sf-array=\"form\" ng-model=\"$$value$$\" class=\"form-group schema-form-checkboxes {{form.htmlClass}}\" ng-class=\"{\'has-error\': form.disableErrorState !== true && hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess()}\"><label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label><div class=\"checkbox\" ng-repeat=\"val in titleMapValues track by $index\"><label><input type=\"checkbox\" ng-disabled=\"form.readonly\" sf-changed=\"form\" class=\"{{form.fieldHtmlClass}}\" ng-model=\"titleMapValues[$index]\" name=\"{{form.key.slice(-1)[0]}}\"> <span ng-bind-html=\"form.titleMap[$index].name\"></span></label></div><div class=\"help-block\" sf-message=\"form.description\"></div></div>");
$templateCache.put("decorators/bootstrap/cut-image.html","<style>\r\n .cropArea {\r\n background: #E4E4E4;\r\n overflow: hidden;\r\n /*width:500px;*/\r\n height:350px;\r\n }\r\n\r\n /** Styling input[type=file] **/\r\n .btn-file { position: relative; overflow: hidden; margin-right: 4px; }\r\n .btn-file input { position: absolute; top: 0; right: 0; margin: 0; opacity: 0; filter: alpha(opacity=0);\r\n transform: translate(-300px, 0) scale(4); font-size: 23px; direction: ltr; cursor: pointer; }\r\n /* Fix for IE 7: */\r\n * + html .btn-file { padding: 2px 15px; margin: 1px 0 0 0; }\r\n</style><div class=\"dialog\"><div class=\"modal-header\"><h3 class=\"modal-title\">{{title}}</h3></div><div class=\"modal-body\"><div><div class=\"cropArea\"><img-crop image=\"fullImage\" result-image=\"croppedImage\" area-type=\"square\"></img-crop></div></div></div><div class=\"modal-footer\"><span class=\"btn btn-default btn-file navbar-left\"><i class=\"glyphicon glyphicon-folder-open\"></i> <input type=\"file\" id=\"fileInput\" name=\"fileInput\" onchange=\"angular.element(this).scope().file_changed(this)\"></span> <button class=\"btn btn-primary\" ng-click=\"ok()\">{{translate(\'button.ok\')}}</button> <button class=\"btn btn-warning\" ng-click=\"cancel()\">{{translate(\'button.cancel\')}}</button></div></div>");
$templateCache.put("decorators/bootstrap/default.html","<div ng-if=\"form.readonly && $$value$$ && $$value$$.length > 0\" class=\"panel panel-default schema-form-{{form.type}} {{form.htmlClass}}\"><div class=\"panel-heading\"><label ng-show=\"showTitle()\">{{form.title}}</label></div><div class=\"panel-body\"><span ng-bind=\"$$value$$\"></span> <button ng-if=\"form.description\" class=\"btn btn-default pull-right\" ng-click=\"tab.show_index = !tab.show_index ? $index : tab.show_index !== $index ? $index : null\"><i class=\"glyphicon glyphicon-question-sign\"></i></button></div><div class=\"panel-footer\" ng-if=\"form.feedback || (form.description && tab.show_index === $index )\"><span ng-if=\"form.feedback !== false\" class=\"form-control-feedback\" aria-hidden=\"true\"></span><div ng-show=\"tab.show_index === $index\" class=\"help-block\" sf-message=\"form.description\"></div></div></div><div class=\"form-group schema-form-{{form.type}} {{form.htmlClass}}\" ng-if=\"!form.readonly\" ng-class=\"{\'has-error\': form.disableErrorState !== true && hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess(), \'has-feedback\': form.feedback !== false }\"><label class=\"control-label {{form.labelHtmlClass}}\" ng-class=\"{\'sr-only\': !showTitle()}\" for=\"{{form.key.slice(-1)[0]}}\">{{form.title}}</label><div ng-class=\"{\'input-group\': form.description || hasSuccess() }\" ng-if=\"!form.fieldAddonLeft && !form.fieldAddonRight\"><input ng-show=\"form.key\" type=\"{{form.type}}\" step=\"any\" sf-changed=\"form\" placeholder=\"{{form.placeholder}}\" class=\"form-control {{form.fieldHtmlClass}}\" id=\"{{form.key.slice(-1)[0]}}\" ng-model-options=\"form.ngModelOptions\" ng-model=\"$$value$$\" ng-disabled=\"form.readonly\" schema-validate=\"form\" name=\"{{form.key.slice(-1)[0]}}\" aria-describedby=\"{{form.key.slice(-1)[0] + \'Status\'}}\"> <span class=\"input-group-btn\"><button class=\"btn btn-default\" style=\"border-color: #3c763d;\" ng-if=\"hasSuccess() && form.feedback !== false\" disabled=\"disabled\"><i class=\"glyphicon glyphicon-ok\" style=\"color: #3c763d;\"></i></button> <button ng-if=\"form.description\" class=\"btn btn-default\" ng-click=\"tab.show_index = !tab.show_index ? $index : tab.show_index !== $index ? $index : null\"><i class=\"glyphicon glyphicon-question-sign\"></i></button></span></div><div ng-if=\"form.fieldAddonLeft || form.fieldAddonRight\" class=\"input-group\"><span ng-if=\"form.fieldAddonLeft\" class=\"input-group-addon\" ng-bind-html=\"form.fieldAddonLeft\"></span> <input ng-show=\"form.key\" type=\"{{form.type}}\" step=\"any\" sf-changed=\"form\" placeholder=\"{{form.placeholder}}\" class=\"form-control {{form.fieldHtmlClass}}\" id=\"{{form.key.slice(-1)[0]}}\" ng-model-options=\"form.ngModelOptions\" ng-model=\"$$value$$\" ng-disabled=\"form.readonly\" schema-validate=\"form\" name=\"{{form.key.slice(-1)[0]}}\" aria-describedby=\"{{form.key.slice(-1)[0] + \'Status\'}}\"> <span class=\"input-group-btn\"><button class=\"btn btn-default\" style=\"border-color: #3c763d;\" ng-if=\"hasSuccess() && form.feedback !== false\" disabled=\"disabled\"><i class=\"glyphicon glyphicon-ok\" style=\"color: #3c763d;\"></i></button> <button ng-if=\"form.description\" class=\"btn btn-default\" ng-click=\"tab.show_index = !tab.show_index ? $index : tab.show_index !== $index ? $index : null\"><i class=\"glyphicon glyphicon-question-sign\"></i></button></span> <span ng-if=\"form.fieldAddonRight\" class=\"input-group-addon\" ng-bind-html=\"form.fieldAddonRight\"></span></div><span ng-if=\"hasError() || hasSuccess()\" id=\"{{form.key.slice(-1)[0] + \'Status\'}}\" class=\"sr-only\">{{ hasSuccess() ? \'(success)\' : \'(error)\' }}</span><div ng-show=\"$index === tab.show_index\" class=\"help-block\" ng-if=\"form.description\" sf-message=\"form.description\"></div></div>");
$templateCache.put("decorators/bootstrap/fieldset.html","<fieldset ng-disabled=\"form.readonly\" class=\"schema-form-fieldset {{form.htmlClass}}\"><legend ng-class=\"{\'sr-only\': !showTitle() }\">{{ form.title }}</legend><div class=\"help-block\" ng-show=\"form.description\" ng-bind-html=\"form.description\"></div><sf-decorator ng-repeat=\"item in form.items\" form=\"item\"></sf-decorator></fieldset>");
$templateCache.put("decorators/bootstrap/help.html","<div class=\"helpvalue schema-form-helpvalue {{form.htmlClass}}\" ng-bind-html=\"form.helpvalue\"></div>");
$templateCache.put("decorators/bootstrap/image-url.html","<div ng-if=\"form.readonly && $$value$$ && $$value$$.length > 0\" class=\"panel panel-default schema-form-{{form.type}} {{form.htmlClass}}\"><div class=\"panel-heading\"><label ng-show=\"showTitle()\">{{form.title}}</label></div><div class=\"panel-body\"><img class=\"img-responsive\" ng-src=\"{{$$value$$}}\" alt=\"\"> <button ng-if=\"form.description\" class=\"btn btn-default pull-right\" ng-click=\"tab.show_index = !tab.show_index ? $index : tab.show_index !== $index ? $index : null\"><i class=\"glyphicon glyphicon-question-sign\"></i></button></div><div class=\"panel-footer\" ng-if=\"form.feedback || (form.description && tab.show_index === $index )\"><span ng-if=\"form.feedback !== false\" class=\"form-control-feedback\" aria-hidden=\"true\"></span><div ng-show=\"tab.show_index === $index\" class=\"help-block\" sf-message=\"form.description\"></div></div></div><div class=\"form-group schema-form-{{form.type}} {{form.htmlClass}}\" ng-if=\"!form.readonly\" ng-class=\"{\'has-error\': form.disableErrorState !== true && hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess(), \'has-feedback\': form.feedback !== false }\"><label class=\"control-label {{form.labelHtmlClass}}\" ng-class=\"{\'sr-only\': !showTitle()}\" for=\"{{form.key.slice(-1)[0]}}\">{{form.title}}</label><div ng-class=\"{\'input-group\': form.description || hasSuccess() }\" ng-if=\"!form.fieldAddonLeft && !form.fieldAddonRight\"><input ng-if=\"!form.fieldAddonLeft && !form.fieldAddonRight\" ng-show=\"form.key\" type=\"{{form.type}}\" step=\"any\" sf-changed=\"form\" placeholder=\"{{form.placeholder}}\" class=\"form-control {{form.fieldHtmlClass}}\" id=\"{{form.key.slice(-1)[0]}}\" ng-model-options=\"form.ngModelOptions\" ng-model=\"$$value$$\" ng-disabled=\"form.readonly\" schema-validate=\"form\" name=\"{{form.key.slice(-1)[0]}}\" aria-describedby=\"{{form.key.slice(-1)[0] + \'Status\'}}\"> <span class=\"input-group-btn\"><button class=\"btn btn-default\" ng-if=\"hasSuccess() && form.feedback !== false\" disabled=\"disabled\"><i class=\"glyphicon glyphicon-ok\" style=\"color: #3c763d;\"></i></button> <button ng-if=\"form.description\" class=\"btn btn-default\" ng-click=\"tab.show_index = !tab.show_index ? $index : tab.show_index !== $index ? $index : null\"><i class=\"glyphicon glyphicon-question-sign\"></i></button></span></div><button class=\"btn btn-default\" ng-click=\"$ctrl.open()\"><i class=\"glyphicon glyphicon-plus-sign\"></i> <span>Add image</span></button><script type=\"text/ng-template\" id=\"myModalContent.html\"><style> </style> <div class=\"modal-header\"> <h3 class=\"modal-title\" id=\"modal-title\">I\'m a modal!</h3> </div> <div class=\"modal-body\" id=\"modal-body\"> <ul> <li ng-repeat=\"item in $ctrl.items\"> <a href=\"#\" ng-click=\"$event.preventDefault(); $ctrl.selected.item = item\">{{ item }}</a> </li> </ul> Selected: <b>{{ $ctrl.selected.item }}</b> </div> <div class=\"modal-footer\"> <button class=\"btn btn-primary\" type=\"button\" ng-click=\"$ctrl.ok()\">OK</button> <button class=\"btn btn-warning\" type=\"button\" ng-click=\"$ctrl.cancel()\">Cancel</button> </div></script><div ng-if=\"form.fieldAddonLeft || form.fieldAddonRight\" ng-class=\"{\'input-group\': (form.fieldAddonLeft || form.fieldAddonRight)}\"><span ng-if=\"form.fieldAddonLeft\" class=\"input-group-addon\" ng-bind-html=\"form.fieldAddonLeft\"></span> <input ng-show=\"form.key\" type=\"{{form.type}}\" step=\"any\" sf-changed=\"form\" placeholder=\"{{form.placeholder}}\" class=\"form-control {{form.fieldHtmlClass}}\" id=\"{{form.key.slice(-1)[0]}}\" ng-model-options=\"form.ngModelOptions\" ng-model=\"$$value$$\" ng-disabled=\"form.readonly\" schema-validate=\"form\" name=\"{{form.key.slice(-1)[0]}}\" aria-describedby=\"{{form.key.slice(-1)[0] + \'Status\'}}\"> <span class=\"input-group-btn\"><button class=\"btn btn-default\" ng-if=\"hasSuccess() && form.feedback !== false\" disabled=\"disabled\"><i class=\"glyphicon glyphicon-ok\" style=\"color: #3c763d;\"></i></button> <button ng-if=\"form.description\" class=\"btn btn-default\" ng-click=\"tab.show_index = !tab.show_index ? $index : tab.show_index !== $index ? $index : null\"><i class=\"glyphicon glyphicon-question-sign\"></i></button></span> <img class=\"img-thumbnail\" ng-show=\"form.key\" ng-src=\"{{$$value$$}}\" alt=\"\" width=\"{{form.preview.width}}\" height=\"{{form.preview.height}}\"> <span ng-if=\"form.fieldAddonRight\" class=\"input-group-addon\" ng-bind-html=\"form.fieldAddonRight\"></span></div><span ng-if=\"hasError() || hasSuccess()\" id=\"{{form.key.slice(-1)[0] + \'Status\'}}\" class=\"sr-only\">{{ hasSuccess() ? \'(success)\' : \'(error)\' }}</span><div ng-show=\"$index === tab.show_index\" class=\"help-block\" sf-message=\"form.description\"></div></div><script>\r\n\r\n angular.module(\'ui.bootstrap.demo\', [\'ngAnimate\', \'ngSanitize\', \'ui.bootstrap\']);\r\n angular.module(\'ui.bootstrap.demo\').controller(\'ModalDemoCtrl\', function ($uibModal, $log) {\r\n var $ctrl = this;\r\n $ctrl.items = [\'item1\', \'item2\', \'item3\'];\r\n\r\n $ctrl.animationsEnabled = true;\r\n\r\n $ctrl.title = \"asdasd\";\r\n\r\n $ctrl.open = function (size) {\r\n var modalInstance = $uibModal.open({\r\n animation: $ctrl.animationsEnabled,\r\n ariaLabelledBy: \'modal-title\',\r\n ariaDescribedBy: \'modal-body\',\r\n templateUrl: \'myModalContent.html\',\r\n controller: \'ModalInstanceCtrl\',\r\n controllerAs: \'$ctrl\',\r\n size: size,\r\n resolve: {\r\n items: function () {\r\n return $ctrl.items;\r\n }\r\n }\r\n });\r\n\r\n modalInstance.result.then(function (selectedItem) {\r\n $ctrl.selected = selectedItem;\r\n }, function () {\r\n $log.info(\'Modal dismissed at: \' + new Date());\r\n });\r\n };\r\n\r\n $ctrl.openComponentModal = function () {\r\n var modalInstance = $uibModal.open({\r\n animation: $ctrl.animationsEnabled,\r\n component: \'modalComponent\',\r\n resolve: {\r\n items: function () {\r\n return $ctrl.items;\r\n }\r\n }\r\n });\r\n\r\n modalInstance.result.then(function (selectedItem) {\r\n $ctrl.selected = selectedItem;\r\n }, function () {\r\n $log.info(\'modal-component dismissed at: \' + new Date());\r\n });\r\n };\r\n\r\n $ctrl.toggleAnimation = function () {\r\n $ctrl.animationsEnabled = !$ctrl.animationsEnabled;\r\n };\r\n });\r\n\r\n // Please note that $uibModalInstance represents a modal window (instance) dependency.\r\n // It is not the same as the $uibModal service used above.\r\n\r\n angular.module(\'ui.bootstrap.demo\').controller(\'ModalInstanceCtrl\', function ($uibModalInstance, items) {\r\n var $ctrl = this;\r\n $ctrl.items = items;\r\n $ctrl.selected = {\r\n item: $ctrl.items[0]\r\n };\r\n\r\n $ctrl.ok = function () {\r\n $uibModalInstance.close($ctrl.selected.item);\r\n };\r\n\r\n $ctrl.cancel = function () {\r\n $uibModalInstance.dismiss(\'cancel\');\r\n };\r\n });\r\n\r\n // Please note that the close and dismiss bindings are from $uibModalInstance.\r\n\r\n angular.module(\'ui.bootstrap.demo\').component(\'modalComponent\', {\r\n templateUrl: \'myModalContent.html\',\r\n bindings: {\r\n resolve: \'<\',\r\n close: \'&\',\r\n dismiss: \'&\'\r\n },\r\n controller: function () {\r\n var $ctrl = this;\r\n\r\n $ctrl.$onInit = function () {\r\n $ctrl.items = $ctrl.resolve.items;\r\n $ctrl.selected = {\r\n item: $ctrl.items[0]\r\n };\r\n };\r\n\r\n $ctrl.ok = function () {\r\n $ctrl.close({$value: $ctrl.selected.item});\r\n };\r\n\r\n $ctrl.cancel = function () {\r\n $ctrl.dismiss({$value: \'cancel\'});\r\n };\r\n }\r\n });\r\n\r\n</script>");
$templateCache.put("decorators/bootstrap/radio-buttons-allergens.html","<div ng-if=\"form.readonly\" class=\"form-group panel panel-default {{form.htmlClass}}\"><div class=\"panel-heading\"><label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label></div><div ng-repeat=\"item in form.titleMap\"><p class=\"panel-body\" ng-if=\"item.value == $$value$$\"><i ng-if=\"item.value === \'C\'\" class=\"allergencolor fa fa-lg fa-square\"></i> <i ng-if=\"item.value === \'T\'\" class=\"allergencolor fa fa-lg fa-play fa-rotate-270\"></i> <i ng-if=\"item.value === \'F\'\" class=\"allergencolor fa fa-lg fa-circle\"></i> <i ng-if=\"item.value === \'U\'\" class=\"allergencolor fa fa-lg fa-question-circle\"></i> {{item.name}}</p></div><div ng-if=\"form.description\" class=\"panel-footer help-block\" sf-message=\"form.description\"></div></div><div ng-if=\"!form.readonly\" class=\"form-group schema-form-radiobuttons {{form.htmlClass}}\" ng-class=\"{\'has-error\': form.disableErrorState !== true && hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess()}\"><div><label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label></div><div class=\"btn-group\"><label class=\"btn {{ (item.value === $$value$$) ? form.style.selected || \'btn-default\' : form.style.unselected || \'btn-default\'; }}\" ng-class=\"{ active: item.value === $$value$$ }\" ng-repeat=\"item in form.titleMap\"><input type=\"radio\" class=\"{{form.fieldHtmlClass}}\" sf-changed=\"form\" style=\"display: none;\" ng-disabled=\"form.readonly\" ng-model=\"$$value$$\" ng-model-options=\"form.ngModelOptions\" schema-validate=\"form\" ng-value=\"item.value\" name=\"{{form.key.join(\'.\')}}\"> <span ng-bind-html=\"item.name\"></span></label></div><div class=\"help-block\" sf-message=\"form.description\"></div></div>");
$templateCache.put("decorators/bootstrap/radio-buttons.html","<div ng-if=\"form.readonly\" class=\"form-group panel panel-default {{form.htmlClass}}\"><div class=\"panel-heading\"><label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label></div><div ng-repeat=\"item in form.titleMap\"><p class=\"panel-body\" ng-if=\"item.value == $$value$$\">{{item.name}}</p></div><div ng-if=\"form.description\" class=\"panel-footer help-block\" sf-message=\"form.description\"></div></div><div ng-if=\"!form.readonly\" class=\"form-group schema-form-radiobuttons {{form.htmlClass}}\" ng-class=\"{\'has-error\': form.disableErrorState !== true && hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess()}\"><div><label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label></div><div class=\"btn-group\"><label class=\"btn {{ (item.value === $$value$$) ? form.style.selected || \'btn-default\' : form.style.unselected || \'btn-default\'; }}\" ng-class=\"{ active: item.value === $$value$$ }\" ng-repeat=\"item in form.titleMap\"><input type=\"radio\" class=\"{{form.fieldHtmlClass}}\" sf-changed=\"form\" style=\"display: none;\" ng-disabled=\"form.readonly\" ng-model=\"$$value$$\" ng-model-options=\"form.ngModelOptions\" schema-validate=\"form\" ng-value=\"item.value\" name=\"{{form.key.join(\'.\')}}\"> <span ng-bind-html=\"item.name\"></span></label></div><div class=\"help-block\" sf-message=\"form.description\"></div></div>");
$templateCache.put("decorators/bootstrap/radios-inline.html","<div class=\"form-group schema-form-radios-inline {{form.htmlClass}}\" ng-class=\"{\'has-error\': form.disableErrorState !== true && hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess()}\"><label ng-model=\"$$value$$\" ng-model-options=\"form.ngModelOptions\" schema-validate=\"form\" class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label><div><label class=\"radio-inline\" ng-repeat=\"item in form.titleMap\"><input type=\"radio\" class=\"{{form.fieldHtmlClass}}\" sf-changed=\"form\" ng-disabled=\"form.readonly\" ng-model=\"$$value$$\" ng-value=\"item.value\" name=\"{{form.key.join(\'.\')}}\"> <span ng-bind-html=\"item.name\"></span></label></div><div class=\"help-block\" sf-message=\"form.description\"></div></div>");
$templateCache.put("decorators/bootstrap/radios.html","<div class=\"form-group schema-form-radios {{form.htmlClass}}\" ng-class=\"{\'has-error\': form.disableErrorState !== true && hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess()}\"><label ng-model=\"$$value$$\" ng-model-options=\"form.ngModelOptions\" schema-validate=\"form\" class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label><div class=\"radio\" ng-repeat=\"item in form.titleMap\"><label><input type=\"radio\" class=\"{{form.fieldHtmlClass}}\" sf-changed=\"form\" ng-disabled=\"form.readonly\" ng-model=\"$$value$$\" ng-value=\"item.value\" name=\"{{form.key.join(\'.\')}}\"> <span ng-bind-html=\"item.name\"></span></label></div><div class=\"help-block\" sf-message=\"form.description\"></div></div>");
$templateCache.put("decorators/bootstrap/rollup.html","<fieldset ng-disabled=\"form.readonly\" class=\"schema-form-fieldset {{form.htmlClass}}\"><div ng-click=\"form.hide_fieldset = !form.hide_fieldset\"><label class=\"control-label\">{{ form.title }}</label> <i class=\"pull-right glyphicon ng-scope\" ng-class=\"{\'glyphicon-chevron-down\': form.hide_fieldset, \'glyphicon-chevron-right\': !form.hide_fieldset}\"></i></div><div ng-show=\"!form.hide_fieldset\" style=\"border-top: 1px solid #ddd; margin-bottom: 20px;\"></div><div class=\"help-block\" ng-show=\"form.description\" ng-bind-html=\"form.description\"></div><ol ng-show=\"form.hide_fieldset\" class=\"list-group\"><li class=\"list-group-item {{form.fieldHtmlClass}}\"><sf-decorator ng-repeat=\"item in form.items\" form=\"item\"></sf-decorator></li></ol></fieldset>");
$templateCache.put("decorators/bootstrap/section.html","<div class=\"schema-form-section {{form.htmlClass}}\"><sf-decorator ng-repeat=\"item in form.items\" form=\"item\"></sf-decorator></div>");
$templateCache.put("decorators/bootstrap/select.html","<div class=\"form-group {{form.htmlClass}} schema-form-select\" ng-class=\"{\'has-error\': form.disableErrorState !== true && hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess(), \'has-feedback\': form.feedback !== false}\"><label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label><select ng-model=\"$$value$$\" ng-model-options=\"form.ngModelOptions\" ng-disabled=\"form.readonly\" sf-changed=\"form\" class=\"form-control {{form.fieldHtmlClass}}\" schema-validate=\"form\" ng-options=\"item.value as item.name group by item.group for item in form.titleMap\" name=\"{{form.key.slice(-1)[0]}}\"></select><div class=\"help-block\" sf-message=\"form.description\"></div></div>");
$templateCache.put("decorators/bootstrap/strapselect.html","<div ng-if=\"!form.readonly\" ng-controller=\"dynamicSelectController\" class=\"form-group {{form.htmlClass}}\" ng-class=\"{\'has-error\': hasError(), \'has-success\': hasSuccess()}\"><label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label><div class=\"form-group {{form.fieldHtmlClass}}\" ng-init=\"populateTitleMap(form)\"><button ng-if=\"(form.options.multiple == \'true\') || (form.options.multiple == true)\" type=\"button\" class=\"btn btn-default\" sf-changed=\"form\" schema-validate=\"form\" ng-model=\"$$value$$\" data-placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}\" data-html=\"1\" data-multiple=\"1\" data-max-length=\"{{form.options.inlineMaxLength}}\" data-max-length-html=\"{{form.options.inlineMaxLengthHtml}}\" bs-options=\"item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:"$$value$$"\" bs-select=\"\"></button> <button ng-if=\"!((form.options.multiple == \'true\') || (form.options.multiple == true))\" type=\"button\" class=\"btn btn-default\" sf-changed=\"form\" schema-validate=\"form\" ng-model=\"$$value$$\" data-placeholder=\"{{form.placeholder || form.schema.placeholder || (\'placeholders.select\')}}\" data-html=\"1\" bs-options=\"item.value as item.name for item in form.titleMap | selectFilter:this:$$value$$:"$$value$$"\" bs-select=\"\"></button> <span class=\"help-block\">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span></div></div><div ng-if=\"form.readonly && (form.titleMap | emptyArray).length > 0 && $$value$$\" ng-controller=\"dynamicSelectController\" class=\"panel panel-default {{form.htmlClass}}\"><div class=\"panel-heading\" ng-show=\"showTitle()\"><label>{{form.title}}</label></div><div class=\"panel panel-body {{form.fieldHtmlClass}}\" ng-init=\"populateTitleMap(form)\"><div ng-if=\"(form.options.multiple === \'true\') || (form.options.multiple === true)\"><div ng-repeat=\"item in form.titleMap | filterMulti:$$value$$\">{{item.name}}</div></div><div ng-if=\"!((form.options.multiple == \'true\') || (form.options.multiple == true))\"><div ng-repeat=\"item in form.titleMap\"><div ng-if=\"item.value == $$value$$\">{{item.name}}</div></div></div></div><div ng-if=\"form.description\" class=\"panel-footer\">{{form.description}}</div></div>");
$templateCache.put("decorators/bootstrap/submit.html","<div class=\"form-group schema-form-submit {{form.htmlClass}}\"><input type=\"submit\" class=\"btn {{ form.style || \'btn-primary\' }} {{form.fieldHtmlClass}}\" value=\"{{form.title}}\" ng-disabled=\"form.readonly\" ng-if=\"form.type === \'submit\'\"> <button class=\"btn {{ form.style || \'btn-default\' }}\" type=\"button\" ng-click=\"buttonClick($event,form)\" ng-disabled=\"form.readonly\" ng-if=\"form.type !== \'submit\'\"><span ng-if=\"form.icon\" class=\"{{form.icon}}\"></span> {{form.title}}</button></div>");
$templateCache.put("decorators/bootstrap/tabarray-inline.html","<div ng-if=\"!form.readonly\" sf-array=\"form\" ng-init=\"selected = { tab: 0 }\" class=\"clearfix schema-form-tabarray schema-form-tabarray-{{form.tabType || \'left\'}} {{form.htmlClass}}\"><div ng-if=\"!form.tabType || form.tabType !== \'right\'\" ng-class=\"{\'col-xs-3\': !form.tabType || form.tabType === \'left\'}\"><ul class=\"nav nav-tabs\" ng-class=\"{ \'tabs-left\': !form.tabType || form.tabType === \'left\'}\"><li ng-repeat=\"item in modelArray track by $index\" ng-click=\"$event.preventDefault() || (selected.tab = $index)\" ng-class=\"{active: selected.tab === $index}\"><a class=\"link-hide-style\"><span>{{interp(form.title,{\'$index\':$index, value: item}) || $index}}</span><div ng-hide=\"form.readonly\" class=\"pull-right remove-hide-style\" ng-click=\"selected.tab = deleteFromArray($index).length - 1\"><i class=\"glyphicon glyphicon-trash\"></i></div></a></li><li ng-hide=\"form.readonly\" ng-click=\"$event.preventDefault() || (selected.tab = appendToArray().length - 1)\"><a href=\"#\"><i class=\"glyphicon glyphicon-plus\"></i> {{ form.add || \'Add\'}}</a></li></ul></div><div ng-class=\"{\'col-xs-9\': !form.tabType || form.tabType === \'left\' || form.tabType === \'right\'}\"><div class=\"tab-content {{form.fieldHtmlClass}}\"><div class=\"tab-pane clearfix\" ng-repeat=\"item in modelArray track by $index\" ng-show=\"selected.tab === $index\" ng-class=\"{active: selected.tab === $index}\"><sf-decorator ng-init=\"arrayIndex = $index\" form=\"copyWithIndex($index)\"></sf-decorator></div></div></div><div ng-if=\"form.tabType === \'right\'\" class=\"col-xs-3\"><ul class=\"nav nav-tabs tabs-right\"><li ng-repeat=\"item in modelArray track by $index\" ng-click=\"$event.preventDefault() || (selected.tab = $index)\" ng-class=\"{active: selected.tab === $index}\"><a href=\"#\">{{interp(form.title,{\'$index\':$index, value: item}) || $index}}</a></li><li ng-hide=\"form.readonly\" ng-click=\"$event.preventDefault() || appendToArray()\"><a href=\"#\"><i class=\"glyphicon glyphicon-plus\"></i> {{ form.add || \'Add\'}}</a></li></ul></div></div><div ng-if=\"form.readonly\" sf-array=\"form\" ng-init=\"selected = { tab: 0 }\" class=\"clearfix schema-form-tabarray schema-form-tabarray-{{form.tabType || \'left\'}} {{form.htmlClass}}\"><div ng-if=\"!form.tabType || form.tabType !== \'right\'\" ng-class=\"{\'col-xs-3\': !form.tabType || form.tabType === \'left\'}\"><ul class=\"nav nav-tabs\" ng-class=\"{ \'tabs-left\': !form.tabType || form.tabType === \'left\'}\"><li ng-repeat=\"item in modelArray track by $index\" ng-click=\"$event.preventDefault() || (selected.tab = $index)\" ng-class=\"{active: selected.tab === $index}\"><a class=\"link-hide-style\"><span>{{interp(form.title,{\'$index\':$index, value: item}) || $index}}</span></a></li></ul></div><div ng-class=\"{\'col-xs-9\': !form.tabType || form.tabType === \'left\' || form.tabType === \'right\'}\"><div class=\"tab-content {{form.fieldHtmlClass}}\"><div class=\"tab-pane clearfix\" ng-repeat=\"item in modelArray track by $index\" ng-show=\"selected.tab === $index\" ng-class=\"{active: selected.tab === $index}\"><sf-decorator ng-init=\"arrayIndex = $index\" form=\"copyWithIndex($index)\"></sf-decorator></div></div></div><div ng-if=\"form.tabType === \'right\'\" class=\"col-xs-3\"><ul class=\"nav nav-tabs tabs-right\"><li ng-repeat=\"item in modelArray track by $index\" ng-click=\"$event.preventDefault() || (selected.tab = $index)\" ng-class=\"{active: selected.tab === $index}\"><a href=\"#\">{{interp(form.title,{\'$index\':$index, value: item}) || $index}}</a></li></ul></div></div>");
$templateCache.put("decorators/bootstrap/tabarray.html","<div sf-array=\"form\" ng-init=\"selected = { tab: 0 }\" class=\"clearfix schema-form-tabarray schema-form-tabarray-{{form.tabType || \'left\'}} {{form.htmlClass}}\"><div ng-if=\"!form.tabType || form.tabType !== \'right\'\" ng-class=\"{\'col-xs-3\': !form.tabType || form.tabType === \'left\'}\"><ul class=\"nav nav-tabs\" ng-class=\"{ \'tabs-left\': !form.tabType || form.tabType === \'left\'}\"><li ng-repeat=\"item in modelArray track by $index\" ng-click=\"$event.preventDefault() || (selected.tab = $index)\" ng-class=\"{active: selected.tab === $index}\"><a href=\"#\">{{interp(form.title,{\'$index\':$index, value: item}) || $index}}</a></li><li ng-hide=\"form.readonly\" ng-click=\"$event.preventDefault() || (selected.tab = appendToArray().length - 1)\"><a href=\"#\"><i class=\"glyphicon glyphicon-plus\"></i> {{ form.add || \'Add\'}}</a></li></ul></div><div ng-class=\"{\'col-xs-9\': !form.tabType || form.tabType === \'left\' || form.tabType === \'right\'}\"><div class=\"tab-content {{form.fieldHtmlClass}}\"><div class=\"tab-pane clearfix\" ng-repeat=\"item in modelArray track by $index\" ng-show=\"selected.tab === $index\" ng-class=\"{active: selected.tab === $index}\"><sf-decorator ng-init=\"arrayIndex = $index\" form=\"copyWithIndex($index)\"></sf-decorator><button ng-hide=\"form.readonly\" ng-click=\"selected.tab = deleteFromArray($index).length - 1\" type=\"button\" class=\"btn {{ form.style.remove || \'btn-default\' }} pull-right\"><i class=\"glyphicon glyphicon-trash\"></i> {{ form.remove || \'Remove\'}}</button></div></div></div><div ng-if=\"form.tabType === \'right\'\" class=\"col-xs-3\"><ul class=\"nav nav-tabs tabs-right\"><li ng-repeat=\"item in modelArray track by $index\" ng-click=\"$event.preventDefault() || (selected.tab = $index)\" ng-class=\"{active: selected.tab === $index}\"><a href=\"#\">{{interp(form.title,{\'$index\':$index, value: item}) || $index}}</a></li><li ng-hide=\"form.readonly\" ng-click=\"$event.preventDefault() || appendToArray()\"><a href=\"#\"><i class=\"glyphicon glyphicon-plus\"></i> {{ form.add || \'Add\'}}</a></li></ul></div></div>");
$templateCache.put("decorators/bootstrap/tabs.html","<div ng-if=\"!form.readonly\" ng-init=\"selected = { tab: 0 }\" class=\"schema-form-tabs {{form.htmlClass}}\"><ul class=\"nav nav-tabs\"><li ng-repeat=\"tab in form.tabs\" ng-click=\"$event.preventDefault() || (selected.tab = $index)\" ng-class=\"{active: selected.tab === $index}\"><a href=\"#\">{{ tab.title }}</a></li></ul><div class=\"tab-content {{form.fieldHtmlClass}}\"><div class=\"tab-pane\" ng-repeat=\"tab in form.tabs\" ng-show=\"selected.tab === $index\" ng-class=\"{active: selected.tab === $index}\"><sf-decorator ng-repeat=\"item in tab.items\" form=\"item\"></sf-decorator></div></div></div><div ng-if=\"form.readonly\" class=\"schema-form-tabs {{form.htmlClass}}\"><div ng-repeat=\"tab in form.tabs\"><h1>{{tab.title}}</h1><sf-decorator ng-repeat=\"item in tab.items\" form=\"item\"></sf-decorator></div></div>");
$templateCache.put("decorators/bootstrap/textarea.html","<div class=\"form-group has-feedback {{form.htmlClass}} schema-form-textarea\" ng-class=\"{\'has-error\': form.disableErrorState !== true && hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess()}\"><label class=\"{{form.labelHtmlClass}}\" ng-class=\"{\'sr-only\': !showTitle()}\" for=\"{{form.key.slice(-1)[0]}}\">{{form.title}}</label> <textarea ng-if=\"!form.fieldAddonLeft && !form.fieldAddonRight\" class=\"form-control {{form.fieldHtmlClass}}\" id=\"{{form.key.slice(-1)[0]}}\" sf-changed=\"form\" placeholder=\"{{form.placeholder}}\" ng-disabled=\"form.readonly\" ng-model=\"$$value$$\" ng-model-options=\"form.ngModelOptions\" schema-validate=\"form\" name=\"{{form.key.slice(-1)[0]}}\"></textarea><div ng-if=\"form.fieldAddonLeft || form.fieldAddonRight\" ng-class=\"{\'input-group\': (form.fieldAddonLeft || form.fieldAddonRight)}\"><span ng-if=\"form.fieldAddonLeft\" class=\"input-group-addon\" ng-bind-html=\"form.fieldAddonLeft\"></span> <textarea class=\"form-control {{form.fieldHtmlClass}}\" id=\"{{form.key.slice(-1)[0]}}\" sf-changed=\"form\" placeholder=\"{{form.placeholder}}\" ng-disabled=\"form.readonly\" ng-model=\"$$value$$\" ng-model-options=\"form.ngModelOptions\" schema-validate=\"form\" name=\"{{form.key.slice(-1)[0]}}\"></textarea> <span ng-if=\"form.fieldAddonRight\" class=\"input-group-addon\" ng-bind-html=\"form.fieldAddonRight\"></span></div><span class=\"help-block\" sf-message=\"form.description\"></span></div>");
$templateCache.put("decorators/bootstrap/treeKm.html","<div ng-if=\"!form.readonly\" class=\"form-group\" ng-class=\"{\'has-error\': hasError(), \'has-success\': form.disableSuccessState !== true && hasSuccess()}\"><label class=\"control-label\" ng-show=\"showTitle()\">{{form.title}}</label><km-tree-view km-data=\"form.options.data\" hierarchy-key=\"{{form.options.hierarchyKey}}\" km-url=\"{{form.options.dataUrl}}\" expand-level=\"1\" validation=\"true\" placeholder=\"\" selected-node=\"$$value$$\" readonly=\"form.readonly\" form=\"form\"></km-tree-view><span class=\"help-block\" sf-message=\"form.description\"></span></div><div ng-if=\"form.readonly && $$value$$ && $$value$$.length > 0\" class=\"panel panel-default schema-form-{{form.type}} {{form.htmlClass}}\"><div class=\"panel-heading\"><label ng-show=\"showTitle()\">{{form.title}}</label></div><div class=\"panel-body\"><span ng-bind=\"$$value$$\"></span> <button ng-if=\"form.description\" class=\"btn btn-default pull-right\" ng-click=\"tab.show_index = !tab.show_index ? $index : tab.show_index !== $index ? $index : null\"><i class=\"glyphicon glyphicon-question-sign\"></i></button></div><div class=\"panel-footer\" ng-if=\"form.feedback || (form.description && $index === tab.show_index)\"><span ng-if=\"form.feedback !== false\" class=\"form-control-feedback\" aria-hidden=\"true\"></span><div ng-show=\"$index === tab.show_index\" class=\"help-block\" sf-message=\"form.description\"></div></div></div>");}]);
angular.module('schemaForm').config(['schemaFormDecoratorsProvider', function(decoratorsProvider) {
var base = 'decorators/bootstrap/';
decoratorsProvider.defineDecorator('bootstrapReportDecorator', {
textarea: {template: base + 'textarea.html', replace: false},
fieldset: {template: base + 'fieldset.html', replace: false},
/*fieldset: {template: base + 'fieldset.html', replace: true, builder: function(args) {
var children = args.build(args.form.items, args.path + '.items');
console.log('fieldset children frag', children.childNodes)
args.fieldFrag.childNode.appendChild(children);
}},*/
array: {template: base + 'array.html', replace: false},
tabarray: {template: base + 'tabarray.html', replace: false},
tabs: {template: base + 'tabs.html', replace: false},
section: {template: base + 'section.html', replace: false},
conditional: {template: base + 'section.html', replace: false},
actions: {template: base + 'actions.html', replace: false},
select: {template: base + 'select.html', replace: false},
checkbox: {template: base + 'checkbox.html', replace: false},
checkboxes: {template: base + 'checkboxes.html', replace: false},
number: {template: base + 'default.html', replace: false},
password: {template: base + 'default.html', replace: false},
submit: {template: base + 'submit.html', replace: false},
button: {template: base + 'submit.html', replace: false},
radios: {template: base + 'radios.html', replace: false},
'radios-inline': {template: base + 'radios-inline.html', replace: false},
radiobuttons: {template: base + 'radio-buttons.html', replace: false},
'radiobuttons-allergens': {template: base + 'radio-buttons-allergens.html', replace: false},
help: {template: base + 'help.html', replace: false},
'default': {template: base + 'default.html', replace: false},
'tabarray-inline': {template: base + 'tabarray-inline.html', replace: false},
treeKm: {template: base + 'treeKm.html', replace: false},
strapselect: {template: base + 'strapselect.html', replace: false},
rollup: {template: base + 'rollup.html', replace: false},
imageUrl: {template: base + 'image-url.html', replace: false},
cutImage: {template: base + 'cut-image.html', replace: false}
}, []);
//manual use directives
decoratorsProvider.createDirectives({
textarea: base + 'textarea.html',
select: base + 'select.html',
checkbox: base + 'checkbox.html',
checkboxes: base + 'checkboxes.html',
number: base + 'default.html',
submit: base + 'submit.html',
button: base + 'submit.html',
text: base + 'default.html',
date: base + 'default.html',
password: base + 'default.html',
datepicker: base + 'datepicker.html',
input: base + 'default.html',
radios: base + 'radios.html',
'radios-inline': base + 'radios-inline.html',
radiobuttons: base + 'radio-buttons.html'
});
}]).directive('sfFieldset', function() {
return {
transclude: true,
scope: true,
templateUrl: 'decorators/bootstrap/fieldset-trcl.html',
link: function(scope, element, attrs) {
scope.title = scope.$eval(attrs.title);
},
controller: function () {
// The function for adding image.
$scope.dishImages = [];
// Handler for click "addImage" Button
$scope.addImage = function () {
var modalInstance = $modal.open({
template: 'cutImage',
controller: 'CutImageCtrl',
size: '',
resolve: {
options: function () {
return {
title: i18n.t('view.dishEdit.selectImage')
};
}
}
});
modalInstance.result.then(function(croppedImage) {
$scope.onFileSelect([croppedImage.image], croppedImage.fileName);
}, function() {
//error message should be here.
});
};
}
};
}).filter('filterMulti', function() {
return function(input, arr) {
var filtered = [];
if (!angular.isArray(arr)) {
arr = [arr];
}
var arrLen = arr.length;
var inputLen = input.length;
var j;
for (var i = 0; i < arrLen; i++) {
for (j = 0; j < inputLen; j++) {
if (input[j].value === arr[i]) {
filtered.push(input[j]);
}
}
}
return filtered;
};
}).filter('emptyArray', function() {
return function(input) {
if (!input || !angular.isObject(input)) {
return input;
}
function isEmpty(e) {
if (!e) {
return false;
}
if (angular.isArray(e) || angular.isString(e)) {
return e.length > 0;
}
if (angular.isObject(e)) {
return Object.keys(e).length > 0;
}
return true;
}
return input.some(isEmpty) ? input : [];
};
});