diff options
| author | Vojta Jina | 2011-11-11 16:50:19 -0800 | 
|---|---|---|
| committer | Igor Minar | 2011-11-13 16:40:31 -0800 | 
| commit | 260725efcd15e960941af6bc1f468e3fb1ac45c5 (patch) | |
| tree | 3f8d0976679d5258409244fbac2ed4141c5dd610 /docs | |
| parent | 4afad1da299cadf6761604d42ceb069158201170 (diff) | |
| download | angular.js-260725efcd15e960941af6bc1f468e3fb1ac45c5.tar.bz2 | |
feat(docs): allow examples with hidden source code
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/src/templates/doc_widgets.js | 13 | 
1 files changed, 11 insertions, 2 deletions
diff --git a/docs/src/templates/doc_widgets.js b/docs/src/templates/doc_widgets.js index 1890e93a..6ae82917 100644 --- a/docs/src/templates/doc_widgets.js +++ b/docs/src/templates/doc_widgets.js @@ -28,19 +28,28 @@      //jqlite instead. jqlite's find() method currently supports onlt getElementsByTagName!      var example = element.find('pre').eq(0),  //doc-source          exampleSrc = example.text(), +        showSource = example.attr('source') !== 'false',          jsfiddle = example.attr('jsfiddle') || true,          scenario = element.find('pre').eq(1); //doc-scenario      var code = indent(exampleSrc);      var tabHtml = -      '<ul class="doc-example">' + +      '<ul class="doc-example">'; + +    // show source tab, if not disabled +    if (showSource) { +      tabHtml +=          '<li class="doc-example-heading"><h3>Source</h3></li>' +          '<li class="doc-example-source" ng:non-bindable>' +          jsFiddleButton(jsfiddle) + // may or may not have value          '<pre class="brush: js; html-script: true; highlight: [' + -          code.hilite + ']; toolbar: false;"></pre></li>' + +          code.hilite + ']; toolbar: false;"></pre></li>'; +    } +    // show live preview tab +    tabHtml +=          '<li class="doc-example-heading"><h3>Live Preview</h3></li>' +          '<li class="doc-example-live">' + exampleSrc +'</li>'; +    // show scenario tab, if present      if (scenario.text()) {        tabHtml +=          '<li class="doc-example-heading"><h3>Scenario Test</h3></li>' +  | 
