mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: Don't show the filter title on the default route
This commit is contained in:
parent
10b8eca9a6
commit
28864e74bc
2 changed files with 15 additions and 2 deletions
|
@ -50,7 +50,7 @@ class ListController < ApplicationController
|
|||
].flatten
|
||||
|
||||
# Create our filters
|
||||
Discourse.filters.each do |filter|
|
||||
Discourse.filters.each_with_index do |filter, idx|
|
||||
define_method(filter) do |options = nil|
|
||||
list_opts = build_topic_list_options
|
||||
list_opts.merge!(options) if options
|
||||
|
@ -68,7 +68,8 @@ class ListController < ApplicationController
|
|||
@description = SiteSetting.site_description
|
||||
@rss = filter
|
||||
|
||||
if use_crawler_layout?
|
||||
# Note the first is the default and we don't add a title
|
||||
if idx > 0 && use_crawler_layout?
|
||||
filter_title = I18n.t("js.filters.#{filter.to_s}.title")
|
||||
if list_opts[:category]
|
||||
@title = I18n.t('js.filters.with_category', filter: filter_title, category: Category.find(list_opts[:category]).name)
|
||||
|
|
|
@ -11,6 +11,18 @@ describe ListController do
|
|||
SiteSetting.stubs(:top_menu).returns('latest,-video|new|unread|categories|category/beer')
|
||||
end
|
||||
|
||||
describe 'titles for crawler layout' do
|
||||
it 'has no title for the default URL' do
|
||||
xhr :get, Discourse.anonymous_filters[0], _escaped_fragment_: 'true'
|
||||
expect(assigns(:title)).to be_blank
|
||||
end
|
||||
|
||||
it 'has a title for non-default URLs' do
|
||||
xhr :get, Discourse.anonymous_filters[1], _escaped_fragment_: 'true'
|
||||
expect(assigns(:title)).to be_present
|
||||
end
|
||||
end
|
||||
|
||||
describe 'indexes' do
|
||||
|
||||
(Discourse.anonymous_filters - [:categories]).each do |filter|
|
||||
|
|
Loading…
Reference in a new issue