diff options
| author | Misko Hevery | 2011-09-08 13:56:29 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-10-11 11:01:45 -0700 |
| commit | 4f78fd692c0ec51241476e6be9a4df06cd62fdd6 (patch) | |
| tree | 91f70bb89b9c095126fbc093f51cedbac5cb0c78 /docs/src/ngdoc.js | |
| parent | df6d2ba3266de405ad6c2f270f24569355706e76 (diff) | |
| download | angular.js-4f78fd692c0ec51241476e6be9a4df06cd62fdd6.tar.bz2 | |
feat(forms): new and improved forms
Diffstat (limited to 'docs/src/ngdoc.js')
| -rw-r--r-- | docs/src/ngdoc.js | 104 |
1 files changed, 33 insertions, 71 deletions
diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 8a20e64a..1a4f5d25 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -13,6 +13,11 @@ exports.scenarios = scenarios; exports.merge = merge; exports.Doc = Doc; +var BOOLEAN_ATTR = {}; +['multiple', 'selected', 'checked', 'disabled', 'readOnly', 'required'].forEach(function(value, key) { + BOOLEAN_ATTR[value] = true; +}); + ////////////////////////////////////////////////////////// function Doc(text, file, line) { if (typeof text == 'object') { @@ -385,69 +390,21 @@ Doc.prototype = { }); }, - html_usage_formatter: function(dom){ - var self = this; - dom.h('Usage', function(){ - dom.h('In HTML Template Binding', function(){ - dom.code(function(){ - if (self.inputType=='select') - dom.text('<select name="bindExpression"'); - else - dom.text('<input type="text" name="bindExpression"'); - dom.text(' ng:format="'); - dom.text(self.shortName); - self.parameters(dom, ':', false, true); - dom.text('">'); - }); - }); - - dom.h('In JavaScript', function(){ - dom.code(function(){ - dom.text('var userInputString = angular.formatter.'); - dom.text(self.shortName); - dom.text('.format(modelValue'); - self.parameters(dom, ', ', false, true); - dom.text(');'); - dom.text('\n'); - dom.text('var modelValue = angular.formatter.'); - dom.text(self.shortName); - dom.text('.parse(userInputString'); - self.parameters(dom, ', ', false, true); - dom.text(');'); - }); - }); - - self.html_usage_parameters(dom); - self.html_usage_this(dom); - self.html_usage_returns(dom); - }); - }, - - html_usage_validator: function(dom){ + html_usage_inputType: function(dom){ var self = this; dom.h('Usage', function(){ - dom.h('In HTML Template Binding', function(){ - dom.code(function(){ - dom.text('<input type="text" ng:validate="'); - dom.text(self.shortName); - self.parameters(dom, ':', true); - dom.text('"/>'); - }); - }); - - dom.h('In JavaScript', function(){ - dom.code(function(){ - dom.text('angular.validator.'); - dom.text(self.shortName); - dom.text('('); - self.parameters(dom, ', '); - dom.text(')'); + dom.code(function(){ + dom.text('<input type="' + self.shortName + '"'); + (self.param||[]).forEach(function(param){ + dom.text('\n '); + dom.text(param.optional ? ' [' : ' '); + dom.text(param.name); + dom.text(BOOLEAN_ATTR[param.name] ? '' : '="..."'); + dom.text(param.optional ? ']' : ''); }); + dom.text('>'); }); - self.html_usage_parameters(dom); - self.html_usage_this(dom); - self.html_usage_returns(dom); }); }, @@ -473,11 +430,11 @@ Doc.prototype = { dom.text('<'); dom.text(self.shortName); (self.param||[]).forEach(function(param){ - if (param.optional) { - dom.text(' [' + param.name + '="..."]'); - } else { - dom.text(' ' + param.name + '="..."'); - } + dom.text('\n '); + dom.text(param.optional ? ' [' : ' '); + dom.text(param.name); + dom.text(BOOLEAN_ATTR[param.name] ? '' : '="..."'); + dom.text(param.optional ? ']' : ''); }); dom.text('></'); dom.text(self.shortName); @@ -533,12 +490,18 @@ Doc.prototype = { dom.h('Events', this.events, function(event){ dom.h(event.shortName, event, function(){ dom.html(event.description); - dom.tag('div', {class:'inline'}, function(){ - dom.h('Type:', event.type); - }); - dom.tag('div', {class:'inline'}, function(){ - dom.h('Target:', event.target); - }); + if (event.type == 'listen') { + dom.tag('div', {class:'inline'}, function(){ + dom.h('Listen on:', event.target); + }); + } else { + dom.tag('div', {class:'inline'}, function(){ + dom.h('Type:', event.type); + }); + dom.tag('div', {class:'inline'}, function(){ + dom.h('Target:', event.target); + }); + } event.html_usage_parameters(dom); self.html_usage_this(dom); @@ -632,10 +595,9 @@ var KEYWORD_PRIORITY = { '.angular.Object': 7, '.angular.directive': 7, '.angular.filter': 7, - '.angular.formatter': 7, '.angular.scope': 7, '.angular.service': 7, - '.angular.validator': 7, + '.angular.inputType': 7, '.angular.widget': 7, '.angular.mock': 8, '.dev_guide.overview': 1, |
