From 09f61059f2845e2f671da2c130e4b34bc9fe0e7d Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com> Date: Tue, 21 Mar 2017 19:23:45 -0400 Subject: [PATCH] Added tag navigation to main page. --- source/index.html.haml | 5 +++-- source/shared/_tags_nav.haml | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 source/shared/_tags_nav.haml diff --git a/source/index.html.haml b/source/index.html.haml index 24a558e..5cb9956 100644 --- a/source/index.html.haml +++ b/source/index.html.haml @@ -33,5 +33,6 @@ per_page: 6 .col-md-9 = partial('shared/page_articles', locals: { page_articles: page_articles, paginate: paginate }) - -#.col-md-3 - -# {{> "tags"}} + .col-md-3 + = partial('shared/tags_nav', + locals: { blog: blog, selected_tag: 'all' }) diff --git a/source/shared/_tags_nav.haml b/source/shared/_tags_nav.haml new file mode 100644 index 0000000..0917224 --- /dev/null +++ b/source/shared/_tags_nav.haml @@ -0,0 +1,11 @@ +%nav.menu.tags + - if selected_tag == 'all' + %a.menu-item.selected{"data-slug" => "all", :href => "/"} All posts + - else + %a.menu-item{"data-slug" => "all", :href => "/"} All posts + + - blog.tags.each do |tag, articles| + - if selected_tag == tag + %a.menu-item.tag.selected{"data-slug" => tag, :href => tag_path(tag)}= tag + - else + %a.menu-item.tag{"data-slug" => tag, :href => tag_path(tag)}= tag -- GitLab