From 21f2f76d2d3b06421e6e57331271a8e1ecc3dbd6 Mon Sep 17 00:00:00 2001 From: Xavier Cambar Date: Sat, 25 Aug 2018 22:57:11 +0200 Subject: [PATCH] Auto-generated API docs are no longer displayed automatcally Displaying the API docs is now opt-in, this allows for better control over the information architcture for the developer --- .../docs-viewer/api-nav-list/component.js | 12 ++++++++++++ .../docs-viewer/api-nav-list/template.hbs | 12 ++++++++++++ addon/components/docs-viewer/x-nav/template.hbs | 15 +-------------- 3 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 addon/components/docs-viewer/api-nav-list/component.js create mode 100644 addon/components/docs-viewer/api-nav-list/template.hbs diff --git a/addon/components/docs-viewer/api-nav-list/component.js b/addon/components/docs-viewer/api-nav-list/component.js new file mode 100644 index 000000000..403475864 --- /dev/null +++ b/addon/components/docs-viewer/api-nav-list/component.js @@ -0,0 +1,12 @@ +import Component from '@ember/component'; +import layout from './template'; + +export default Component.extend({ + layout, + + root: 'docs', + + // Currently provided by the calling template + // while there is no central access to the resource + project: null +}); diff --git a/addon/components/docs-viewer/api-nav-list/template.hbs b/addon/components/docs-viewer/api-nav-list/template.hbs new file mode 100644 index 000000000..7cc43d1fa --- /dev/null +++ b/addon/components/docs-viewer/api-nav-list/template.hbs @@ -0,0 +1,12 @@ +{{!-- Autogenerated API docs --}} +{{#if (gt project.modules.length 0)}} + {{docs-viewer/x-section 'API Reference' style='large'}} + + {{#each-in project.navigationIndex as |type items|}} + {{docs-viewer/x-section type}} + + {{#each items as |item|}} + {{docs-viewer/x-nav-item (break-on item.name '/') (concat root '.api.item') item.path}} + {{/each}} + {{/each-in}} +{{/if}} \ No newline at end of file diff --git a/addon/components/docs-viewer/x-nav/template.hbs b/addon/components/docs-viewer/x-nav/template.hbs index c61c6e006..d9f1cbaa4 100644 --- a/addon/components/docs-viewer/x-nav/template.hbs +++ b/addon/components/docs-viewer/x-nav/template.hbs @@ -26,26 +26,13 @@ {{/if}} - {{#docs-viewer/x-nav-list}} {{yield (hash section=(component 'docs-viewer/x-section') item=(component 'docs-viewer/x-nav-item') subnav=(component 'docs-viewer/x-nav-list' class='ml-4') + api-nav=(component 'docs-viewer/api-nav-list' class='ml-4' project=project) )}} - - {{!-- Autogenerated API docs --}} - {{#if (gt project.modules.length 0)}} - {{docs-viewer/x-section 'API Reference' style='large'}} - - {{#each-in project.navigationIndex as |type items|}} - {{docs-viewer/x-section type}} - - {{#each items as |item|}} - {{docs-viewer/x-nav-item (break-on item.name '/') (concat root '.api.item') item.path}} - {{/each}} - {{/each-in}} - {{/if}} {{/docs-viewer/x-nav-list}}