Skip to content

Commit

Permalink
Merge pull request #412 from compodoc/add_examples_tab_to_services
Browse files Browse the repository at this point in the history
1) Added examples tab to services and hiding of example-url tag on Info tab
  • Loading branch information
vogloblinsky authored Dec 18, 2017
2 parents 3d47d4c + 8293c51 commit 687b04c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/app/compiler/dependencies.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface IInjectableDep extends IDep {
methods: Array<any>;
description: string;
sourceCode: string;
exampleUrls?;

accessors?: Object;
constructorObj?: Object;
Expand All @@ -25,7 +26,7 @@ export interface IInterceptorDep extends IDep {
methods: Array<any>;
description: string;
sourceCode: string;

accessors?: Object;
constructorObj?: Object;
jsdoctags?: Array<string>;
Expand Down
3 changes: 2 additions & 1 deletion src/app/compiler/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ export class Dependencies {
properties: IO.properties,
methods: IO.methods,
description: IO.description,
sourceCode: srcFile.getText()
sourceCode: srcFile.getText(),
exampleUrls: this.componentHelper.getComponentExampleUrls(srcFile.getText())
};
if (IO.constructor) {
injectableDeps.constructorObj = IO.constructor;
Expand Down
4 changes: 4 additions & 0 deletions src/resources/styles/compodoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ code {
padding-left: 20px;
}

example-url {
display: none;
}

i {
font-style: italic;
}
Expand Down
15 changes: 15 additions & 0 deletions src/templates/partials/injectable.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
</li>
{{/unless}}
{{#if injectable.exampleUrls}}
<li>
<a href="#example" role="tab" id="example-tab" data-toggle="tab" data-link="example">Examples</a>
</li>
{{/if}}
</ul>

<div class="tab-content">
Expand Down Expand Up @@ -86,4 +91,14 @@
<pre class="line-numbers"><code class="language-typescript">{{injectable.sourceCode}}</code></pre>
</div>
{{/unless}}

{{#if injectable.exampleUrls}}
<div class="tab-pane fade" id="c-example">
{{#each injectable.exampleUrls}}
<iframe src="{{this}}" style="height: 100vh; width: 100%;">
<p>Your browser does not support iframes.</p>
</iframe>
{{/each}}
</div>
{{/if}}
</div>

0 comments on commit 687b04c

Please sign in to comment.