diff --git a/dist/bootstrap-decorator.min.js b/dist/bootstrap-decorator.min.js index 6fdb10abf..fb96aa7b1 100644 --- a/dist/bootstrap-decorator.min.js +++ b/dist/bootstrap-decorator.min.js @@ -1 +1 @@ -angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/actions-trcl.html",'
'),e.put("directives/decorators/bootstrap/actions.html",'
'),e.put("directives/decorators/bootstrap/checkbox.html",'
{{form.description}}
'),e.put("directives/decorators/bootstrap/checkboxes.html",'
{{form.description}}
'),e.put("directives/decorators/bootstrap/default.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/fieldset-trcl.html",'
{{ form.title }}
'),e.put("directives/decorators/bootstrap/fieldset.html",'
{{ form.title }}
'),e.put("directives/decorators/bootstrap/help.html",'
'),e.put("directives/decorators/bootstrap/radio-buttons.html",'
{{form.description}}
'),e.put("directives/decorators/bootstrap/radios.html",'
{{form.description}}
'),e.put("directives/decorators/bootstrap/readonly.html",'
{{form.description}}
'),e.put("directives/decorators/bootstrap/section.html",'
'),e.put("directives/decorators/bootstrap/select.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
'),e.put("directives/decorators/bootstrap/submit.html",'
'),e.put("directives/decorators/bootstrap/tabs.html",'
'),e.put("directives/decorators/bootstrap/textarea.html",'
{{ (hasError() && errorMessage(schemaError())) || form.description}}
')}]),angular.module("schemaForm").config(["schemaFormDecoratorsProvider",function(e){var t="directives/decorators/bootstrap/";e.createDecorator("bootstrapDecorator",{textarea:t+"textarea.html",fieldset:t+"fieldset.html",tabs:t+"tabs.html",section:t+"section.html",conditional:t+"section.html",actions:t+"actions.html",select:t+"select.html",checkbox:t+"checkbox.html",checkboxes:t+"checkboxes.html",number:t+"default.html",password:t+"default.html",submit:t+"submit.html",button:t+"submit.html",radios:t+"radios.html",radiobuttons:t+"radio-buttons.html",help:t+"help.html","default":t+"default.html"},[function(e){return e.readonly&&e.key&&"fieldset"!==e.type?t+"readonly.html":void 0}]),e.createDirectives({textarea:t+"textarea.html",select:t+"select.html",checkbox:t+"checkbox.html",checkboxes:t+"checkboxes.html",number:t+"default.html",submit:t+"submit.html",button:t+"submit.html",text:t+"default.html",date:t+"default.html",password:t+"default.html",datepicker:t+"datepicker.html",input:t+"default.html",radios:t+"radios.html",radiobuttons:t+"radio-buttons.html"})}]).directive("sfFieldset",function(){return{transclude:!0,scope:!0,templateUrl:"directives/decorators/bootstrap/fieldset-trcl.html",link:function(e,t,s){e.title=e.$eval(s.title)}}}); \ No newline at end of file +angular.module("schemaForm").run(["$templateCache",function(e){e.put("directives/decorators/bootstrap/actions-trcl.html",'
'),e.put("directives/decorators/bootstrap/actions.html",'
'),e.put("directives/decorators/bootstrap/checkbox.html",'
'),e.put("directives/decorators/bootstrap/checkboxes.html",'
'),e.put("directives/decorators/bootstrap/default.html",'
'),e.put("directives/decorators/bootstrap/fieldset-trcl.html",'
{{ form.title }}
'),e.put("directives/decorators/bootstrap/fieldset.html",'
{{ form.title }}
'),e.put("directives/decorators/bootstrap/help.html",'
'),e.put("directives/decorators/bootstrap/radio-buttons.html",'
'),e.put("directives/decorators/bootstrap/radios.html",'
'),e.put("directives/decorators/bootstrap/readonly.html",'
'),e.put("directives/decorators/bootstrap/section.html",'
'),e.put("directives/decorators/bootstrap/select.html",'
'),e.put("directives/decorators/bootstrap/submit.html",'
'),e.put("directives/decorators/bootstrap/tabs.html",'
'),e.put("directives/decorators/bootstrap/textarea.html",'
')}]),angular.module("schemaForm").config(["schemaFormDecoratorsProvider",function(e){var t="directives/decorators/bootstrap/";e.createDecorator("bootstrapDecorator",{textarea:t+"textarea.html",fieldset:t+"fieldset.html",tabs:t+"tabs.html",section:t+"section.html",conditional:t+"section.html",actions:t+"actions.html",select:t+"select.html",checkbox:t+"checkbox.html",checkboxes:t+"checkboxes.html",number:t+"default.html",password:t+"default.html",submit:t+"submit.html",button:t+"submit.html",radios:t+"radios.html",radiobuttons:t+"radio-buttons.html",help:t+"help.html","default":t+"default.html"},[function(e){return e.readonly&&e.key&&"fieldset"!==e.type?t+"readonly.html":void 0}]),e.createDirectives({textarea:t+"textarea.html",select:t+"select.html",checkbox:t+"checkbox.html",checkboxes:t+"checkboxes.html",number:t+"default.html",submit:t+"submit.html",button:t+"submit.html",text:t+"default.html",date:t+"default.html",password:t+"default.html",datepicker:t+"datepicker.html",input:t+"default.html",radios:t+"radios.html",radiobuttons:t+"radio-buttons.html"})}]).directive("sfFieldset",function(){return{transclude:!0,scope:!0,templateUrl:"directives/decorators/bootstrap/fieldset-trcl.html",link:function(e,t,s){e.title=e.$eval(s.title)}}}); \ No newline at end of file diff --git a/examples/bootstrap-example.html b/examples/bootstrap-example.html index 55320a68e..735135334 100644 --- a/examples/bootstrap-example.html +++ b/examples/bootstrap-example.html @@ -118,7 +118,7 @@

Schema

}, "soul": { "title": "Terms Of Service", - "description": "I agree to sell my undying soul", + "description": "I agree to sell my undying soul", "type": "boolean", "default": true, }, @@ -192,7 +192,13 @@

Schema

] }, { key: "date", minDate: "2014-06-20" }, - { key: "radio", type: "radios" }, + { key: "radio", + type: "radios", + titleMap: { + "Transistor": "Transistor
Not the tube kind.", + "Tube": "Tube
The tube kind." + } + }, { key: "radiobuttons", type: "radiobuttons" }, { type: 'actions', diff --git a/src/directives/decorators/bootstrap/checkbox.html b/src/directives/decorators/bootstrap/checkbox.html index e2b7cea69..3a532ea97 100644 --- a/src/directives/decorators/bootstrap/checkbox.html +++ b/src/directives/decorators/bootstrap/checkbox.html @@ -5,8 +5,8 @@ ng-model="$$value$$" schema-validate="form.schema" ng-required="form.required"> - {{form.title}} + - {{form.description}} +
diff --git a/src/directives/decorators/bootstrap/checkboxes.html b/src/directives/decorators/bootstrap/checkboxes.html index f7874c14f..026e5adde 100644 --- a/src/directives/decorators/bootstrap/checkboxes.html +++ b/src/directives/decorators/bootstrap/checkboxes.html @@ -6,9 +6,9 @@ sf-changed="form" ng-model="checkboxValues[value]" ng-change="$$value$$ = checkboxValuesToList(checkboxValues)" > - {{name}} + - {{form.description}} +
diff --git a/src/directives/decorators/bootstrap/default.html b/src/directives/decorators/bootstrap/default.html index c2027d104..363c06b4a 100644 --- a/src/directives/decorators/bootstrap/default.html +++ b/src/directives/decorators/bootstrap/default.html @@ -12,5 +12,5 @@ - {{ (hasError() && errorMessage(schemaError())) || form.description}} +
diff --git a/src/directives/decorators/bootstrap/radio-buttons.html b/src/directives/decorators/bootstrap/radio-buttons.html index 354d99854..a45d0dc38 100644 --- a/src/directives/decorators/bootstrap/radio-buttons.html +++ b/src/directives/decorators/bootstrap/radio-buttons.html @@ -9,8 +9,8 @@ style="display: none;" ng-model="$$value$$" ng-value="value"> - {{name}} + - {{form.description}} +
diff --git a/src/directives/decorators/bootstrap/radios.html b/src/directives/decorators/bootstrap/radios.html index 772c28261..21e6e0de7 100644 --- a/src/directives/decorators/bootstrap/radios.html +++ b/src/directives/decorators/bootstrap/radios.html @@ -6,8 +6,8 @@ sf-changed="form" ng-model="$$value$$" ng-value="value"> - {{name}} + - {{form.description}} +
diff --git a/src/directives/decorators/bootstrap/readonly.html b/src/directives/decorators/bootstrap/readonly.html index 5f170ab5c..4f0b1d126 100644 --- a/src/directives/decorators/bootstrap/readonly.html +++ b/src/directives/decorators/bootstrap/readonly.html @@ -2,5 +2,5 @@ - {{form.description}} - \ No newline at end of file +
+ diff --git a/src/directives/decorators/bootstrap/select.html b/src/directives/decorators/bootstrap/select.html index 937da19fe..160910495 100644 --- a/src/directives/decorators/bootstrap/select.html +++ b/src/directives/decorators/bootstrap/select.html @@ -9,5 +9,5 @@ ng-required="form.required" ng-options="val as name for (val,name) in form.titleMap"> - {{ (hasError() && errorMessage(schemaError())) || form.description}} +
diff --git a/src/directives/decorators/bootstrap/textarea.html b/src/directives/decorators/bootstrap/textarea.html index 8f556f89c..a4525b10c 100644 --- a/src/directives/decorators/bootstrap/textarea.html +++ b/src/directives/decorators/bootstrap/textarea.html @@ -8,5 +8,5 @@ - {{ (hasError() && errorMessage(schemaError())) || form.description}} +
diff --git a/test/schema-form-test.js b/test/schema-form-test.js index 59268e335..2e44a8cf4 100644 --- a/test/schema-form-test.js +++ b/test/schema-form-test.js @@ -6,6 +6,12 @@ describe('Schema form',function(){ describe('directive',function(){ beforeEach(module('templates')); beforeEach(module('schemaForm')); + beforeEach( + //We don't need no sanitation. We don't need no though control. + module(function($sceProvider){ + $sceProvider.enabled(false); + }) + ); @@ -686,6 +692,53 @@ describe('Schema form',function(){ }); }); + it.only('should use radio buttons with HTML',function(){ + + inject(function($compile,$rootScope){ + var scope = $rootScope.$new(); + scope.person = {}; + + scope.schema = { + "type": "object", + "properties": { + "names": { + "type": "string", + "enum": ["one","two"], + "description": "Cats are so cool.", + "title": "testlokol" + }, + "opts": { + "type": "string", + "enum": ["one","two"] + }, + "boxe": { + "type": "boolean", + "title": "whavre", + "description": "Cats are so cool." + }, + } + }; + + scope.form = [ + { key: "names", type: "radios",titleMap: { one: "onedirection", two: "
Baby spice
" }}, + { key: "opts", type: "radiobuttons",titleMap: { one: "One", two: "The rest" }}, + "boxe" + ]; + + var tmpl = angular.element('
'); + + $compile(tmpl)(scope); + $rootScope.$apply(); + + tmpl.find('.spicegirls').length.should.be.equal(1); + tmpl.find('#testerish').length.should.be.equal(1); + tmpl.find('#bawkses').length.should.be.equal(1); + tmpl.find('#gh').length.should.be.equal(2); + + }); + }); + + it('should handle a simple div when type "section" is specified',function(){ @@ -893,7 +946,7 @@ describe('Schema form',function(){ }); }); - it.only('should render tabs with items in them when specified',function(){ + it('should render tabs with items in them when specified',function(){ inject(function($compile,$rootScope){ var scope = $rootScope.$new();