From 89b475e538eb9744ed0ecd05e04c573290c7121e Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Wed, 3 Jun 2015 18:13:33 +1000 Subject: [PATCH] FEATURE: clean up microdata breadcrumb * do not include any breadcrumb for uncategorized * do not include the work "Categories" as a breadcrumb --- Gemfile.lock | 3 +++ app/helpers/topics_helper.rb | 5 ++--- app/views/topics/show.html.erb | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e69072faf3e..2b2f3aa8d62 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -484,3 +484,6 @@ DEPENDENCIES uglifier unf unicorn + +BUNDLED WITH + 1.10.2 diff --git a/app/helpers/topics_helper.rb b/app/helpers/topics_helper.rb index cb330dcf2bc..3a1d8393102 100644 --- a/app/helpers/topics_helper.rb +++ b/app/helpers/topics_helper.rb @@ -5,11 +5,10 @@ module TopicsHelper end def categories_breadcrumb(topic) - breadcrumb = [{url: categories_path, - name: I18n.t('js.filters.categories.title')}] + breadcrumb = [] category = topic.category - if category + if category && !category.uncategorized? if (parent = category.parent_category) breadcrumb.push url: parent.url, name: parent.name end diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 87fe6413cf0..9fd1fc836c7 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -2,8 +2,10 @@ <%= render_topic_title(@topic_view.topic) %> +<% @breadcrumbs = categories_breadcrumb(@topic_view.topic) + if @breadcrumbs.present? %>
- <% categories_breadcrumb(@topic_view.topic).each_with_index do |c,i| %> + <% @breadcrumbs.each_with_index do |c,i| %> <%= link_to c[:url], itemprop: 'item' do %> <%= c[:name] %> @@ -12,6 +14,7 @@ <% end %>
+<% end %> <%= server_plugin_outlet "topic_header" %>