Permalink
Browse files

Display a component's inherited examples separately from its own exam…

…ples.
  • Loading branch information...
1 parent 7b38a96 commit 2f60951f87c971efe6573766a049bca76059475f @rgrove committed Jul 29, 2011
Showing with 33 additions and 4 deletions.
  1. +7 −0 bin/selleck
  2. +26 −4 themes/default/layouts/main.mustache
View
@@ -228,6 +228,11 @@ if (options.server) {
validator: componentValidator
}), stack.add(function (err, result) {
if (err) { throw err; }
+
+ if (result.meta.examples) {
+ result.meta.hasOwnExamples = true;
+ }
+
components[result.meta.name] = result;
}));
});
@@ -248,6 +253,8 @@ if (options.server) {
if (module && moduleName !== example.componentName
&& !example.inherited) {
+ module.meta.hasInheritedExamples = true;
+
module.meta.examples || (module.meta.examples = []);
module.meta.examples.push(util.merge(example, {
inherited: true
@@ -35,7 +35,7 @@
</div>
{{/hideTableOfContents}}
- {{#if examples}}
+ {{#if hasOwnExamples}}
<div class="sidebox">
<div class="hd">
<h2 class="no-toc">Examples</h2>
@@ -44,9 +44,31 @@
<div class="bd">
<ul class="examples">
{{#examples}}
- <li data-description="{{description}}">
- <a href="../{{componentName}}/{{name}}.html">{{displayName}}</a>
- </li>
+ {{#unless inherited}}
+ <li data-description="{{description}}">
+ <a href="{{name}}.html">{{displayName}}</a>
+ </li>
+ {{/unless}}
+ {{/examples}}
+ </ul>
+ </div>
+ </div>
+ {{/if}}
+
+ {{#if hasInheritedExamples}}
+ <div class="sidebox">
+ <div class="hd">
+ <h2 class="no-toc">Examples That Use This Component</h2>
+ </div>
+
+ <div class="bd">
+ <ul class="examples">
+ {{#examples}}
+ {{#if inherited}}
+ <li data-description="{{description}}">
+ <a href="../{{componentName}}/{{name}}.html">{{displayName}}</a>
+ </li>
+ {{/if}}
{{/examples}}
</ul>
</div>

0 comments on commit 2f60951

Please sign in to comment.