From 90b85e5b237ad7cba4c3db2fc1bb77571ffb7e56 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 22 Jul 2015 10:26:58 +1000 Subject: [PATCH] FIX: missing category from title in non-js view --- app/views/topics/show.html.erb | 2 +- lib/topic_view.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 76404ccfa76..9478eefd8fc 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -61,4 +61,4 @@ image: @topic_view.image_url) %> <% end %> -<% content_for(:title) { @topic_view.title } %> +<% content_for(:title) { "#{@topic_view.page_title}" } %> diff --git a/lib/topic_view.rb b/lib/topic_view.rb index c4e23aef6bf..29ca2d951f6 100644 --- a/lib/topic_view.rb +++ b/lib/topic_view.rb @@ -131,6 +131,14 @@ class TopicView @topic.relative_url end + def page_title + title = @topic.title + unless @topic.category_id == SiteSetting.uncategorized_category_id + title += " - #{topic.category.name}" + end + title + end + def title @topic.title end