REFACTOR: Fixes poor class hierarchy for listing topics

- Upgrades Ember to latest
- Fixes a bunch of bugs with page titles and missing "active" states
This commit is contained in:
Robin Ward
2014-01-14 12:48:57 -05:00
committed by Régis Hanol
parent 86214989f5
commit 4981525047
178 changed files with 8441 additions and 4573 deletions

View File

@@ -31,11 +31,11 @@ module Discourse
class CSRF < Exception; end
def self.filters
@filters ||= [:latest, :hot, :unread, :new, :starred, :read, :posted]
@filters ||= [:latest, :unread, :new, :starred, :read, :posted]
end
def self.anonymous_filters
@anonymous_filters ||= [:latest, :hot]
@anonymous_filters ||= [:latest]
end
def self.logged_in_filters
@@ -43,11 +43,11 @@ module Discourse
end
def self.top_menu_items
@top_menu_items ||= Discourse.filters.concat([:category, :categories, :top])
@top_menu_items ||= Discourse.filters + [:category, :categories, :top]
end
def self.anonymous_top_menu_items
@anonymous_top_menu_items ||= Discourse.anonymous_filters.concat([:category, :categories, :top])
@anonymous_top_menu_items ||= Discourse.anonymous_filters + [:category, :categories, :top]
end
def self.activate_plugins!

View File

@@ -4,7 +4,7 @@ desc 'Creates the integration fixtures. Requires a development instance running.
task 'integration:create_fixtures' => :environment do
fixtures = {
list: ["/latest.json", "/categories.json", "/category/bug.json"],
discovery: ["/latest.json", "/categories.json", "/category/bug/l/latest.json"],
topic: ["/t/280.json"],
user: ["/users/eviltrout.json",
"/user_actions.json?offset=0&username=eviltrout",
@@ -38,6 +38,7 @@ task 'integration:create_fixtures' => :environment do
File.write(filename, content)
end
end
@@ -54,4 +55,4 @@ def fake_xhr(url)
result
end
end

View File

@@ -67,12 +67,6 @@ class TopicQuery
end
end
def list_hot
create_list(:hot, unordered: true) do |topics|
topics.joins(:hot_topic).order(TopicQuerySQL.order_hotness(@user))
end
end
def list_new
TopicList.new(:new, @user, new_results)
end

View File

@@ -24,23 +24,6 @@ module TopicQuerySQL
END DESC"
end
def order_hotness(user)
if user
# When logged in take into accounts what pins you've closed
"CASE
WHEN (COALESCE(topics.pinned_at, '#{lowest_date}') > COALESCE(tu.cleared_pinned_at, '#{lowest_date}'))
THEN 100
ELSE hot_topics.score + (COALESCE(categories.hotness, 5.0) / 11.0)
END DESC"
else
# When anonymous, don't use topic_user
"CASE
WHEN topics.pinned_at IS NOT NULL THEN 100
ELSE hot_topics.score + (COALESCE(categories.hotness, 5.0) / 11.0)
END DESC"
end
end
def order_by_category_sql(dir)
"CASE WHEN categories.id = #{SiteSetting.uncategorized_category_id.to_i} THEN '' ELSE categories.name END #{dir}"
end