Skip to content

Commit

Permalink
feat: proper handle child tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtek-krysiak committed Jul 2, 2020
1 parent 168b6ac commit 369c76b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
19 changes: 18 additions & 1 deletion publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,22 @@ function buildMemberNav(items, itemHeading, itemsSeen, linktoFn) {
} else {
displayName = item.name
}
itemsNav += '<li>' + linktoFn(item.longname, displayName.replace(/\b(module|event):/g, '')) + '</li>'
itemsNav += '<li>' + linktoFn(item.longname, displayName.replace(/\b(module|event):/g, ''))

if (item.children && item.children.length) {
itemsNav += '<ul>'
item.children.forEach(child => {
if (env.conf.templates.default.useLongnameInNav) {
displayName = child.longname
} else {
displayName = child.name
}
itemsNav += '<li>' + linktoFn(child.longname, displayName.replace(/\b(module|event):/g, '')) + '</li>'
})
itemsNav += '</ul>'
}

itemsNav += '</li>'

itemsSeen[item.longname] = true
}
Expand Down Expand Up @@ -695,7 +710,9 @@ exports.publish = function(taffyData, opts, tutorials) {

// once for all
view.nav = buildNav(members, null, conf.betterDocs)

view.tutorialsNav = buildNav(members, ['tutorials'], conf.betterDocs)

bundler(members.components, outdir, conf)
attachModuleSymbols( find({ longname: {left: 'module:'} }), members.modules )

Expand Down
2 changes: 1 addition & 1 deletion static/styles/app.min.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions styles/components/sidebar.sass
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
padding: 0 0 rem(4px) rem(16px)
li
padding: rem(3px) 0
li > ul
padding: 0 0 0px 25px

.category
h2
Expand Down
10 changes: 0 additions & 10 deletions tmpl/tutorial.tmpl
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
<section>

<header>
<?js if (children.length > 0) { ?>
<ul><?js
var self = this;
children.forEach(function(t) { ?>
<li><?js= self.tutoriallink(t.name) ?></li>
<?js }); ?></ul>
<?js } ?>
</header>

<article>
<?js= content ?>
</article>
Expand Down

0 comments on commit 369c76b

Please sign in to comment.