Skip to content

Commit

Permalink
Provides the ability to create a left menu automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpedromoreno committed Oct 21, 2016
1 parent 340dd68 commit 40fc9e9
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/main/scala/microsites/layouts/DocsLayout.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,23 @@ class DocsLayout(config: MicrositeSettings) extends Layout(config) {
div(cls := "brand-wrapper", style := "background:url('{{site.baseurl}}/img/sidebar_brand.png') no-repeat", span(config.name))
)
),
"{% if site.data.menu.options %}",
"{% assign items = site.data.menu.options %} {% for x in items %} ",
li(
a(href := s"$baseUrl{{x.url}}", cls := "{% if x.title == page.title %} active {% endif %}", "{{x.title}}"),
"{% if x.nested_options %} ",
ul(cls := "sub_section",
"{% for sub in x.nested_options %} ",
li(a(href := s"$baseUrl{{sub.url}}", cls := "{% if sub.title == page.title and x.section == page.section %} active {% endif %}", "{{sub.title}}")),
"{% endfor %}"
),
"{% endif %} {% endfor %}"
))
"{% if x.nested_options %} ",
ul(cls := "sub_section",
"{% for sub in x.nested_options %} ",
li(a(href := s"$baseUrl{{sub.url}}", cls := "{% if sub.title == page.title and x.section == page.section %} active {% endif %}", "{{sub.title}}")),
"{% endfor %}"
),
"{% endif %} {% endfor %}",
"{% else %}",
"{% assign items = site.pages | sort: 'weight' %} {% for x in items %} {% if x.section == page.section %}",
li(a(href := "{{ site.baseurl }}{{x.url}}", cls := "{% if x.title == page.title %} active {% endif %}", "{{x.title}}")),
"{% endif %} {% endfor %}",
"{% endif %}"
))
}

def scriptsDocs: List[TypedTag[String]] = scripts ++
Expand Down

0 comments on commit 40fc9e9

Please sign in to comment.