From ba186b25a799d869c3128ae037beddf7f02b654f Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 25 Jan 2015 15:53:11 +1100 Subject: [PATCH] FEATURE: optional top level bookmarks tab --- config/locales/client.en.yml | 4 ++++ config/locales/server.en.yml | 2 +- config/site_settings.yml | 1 + lib/discourse.rb | 2 +- lib/topic_query.rb | 4 ++++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 78356760a49..ed1af4ce526 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -819,6 +819,7 @@ en: posted: "You haven't posted in any topics yet." latest: "There are no latest topics. That's sad." hot: "There are no hot topics." + bookmarks: "You have no bookmarked topics yet." category: "There are no {{category}} topics." top: "There are no top topics." educate: @@ -1465,6 +1466,9 @@ en: posted: title: "My Posts" help: "topics you have posted in" + bookmarks: + title: "Bookmarks" + help: "topics you have bookmarked" category: title: zero: "{{categoryName}}" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index e57e5d5c90c..1136c092a1a 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -740,7 +740,7 @@ en: enable_noscript_support: "Enable standard webcrawler search engine support via the noscript tag" allow_moderators_to_create_categories: "Allow moderators to create new categories" cors_origins: "Allowed origins for cross-origin requests (CORS). Each origin must include http:// or https://. The DISCOURSE_ENABLE_CORS env variable must be set to true to enable CORS." - top_menu: "Determine which items appear in the homepage navigation, and in what order. Example latest|new|unread|starred|categories|top|read|posted" + top_menu: "Determine which items appear in the homepage navigation, and in what order. Example latest|new|unread|categories|top|read|posted|bookmarks" post_menu: "Determine which items appear on the post menu, and in what order. Example like|edit|flag|delete|share|bookmark|reply" post_menu_hidden_items: "The menu items to hide by default in the post menu unless an expansion ellipsis is clicked on." share_links: "Determine which items appear on the share dialog, and in what order." diff --git a/config/site_settings.yml b/config/site_settings.yml index c9b02b60580..0b644cdc382 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -92,6 +92,7 @@ basic: - categories - read - posted + - bookmarks post_menu: client: true type: list diff --git a/lib/discourse.rb b/lib/discourse.rb index c5546eb0136..8030079a398 100644 --- a/lib/discourse.rb +++ b/lib/discourse.rb @@ -56,7 +56,7 @@ module Discourse class CSRF < Exception; end def self.filters - @filters ||= [:latest, :unread, :new, :read, :posted] + @filters ||= [:latest, :unread, :new, :read, :posted, :bookmarks] end def self.feed_filters diff --git a/lib/topic_query.rb b/lib/topic_query.rb index fe6d8e8e69a..69369fd9e5e 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -88,6 +88,10 @@ class TopicQuery create_list(:posted) {|l| l.where('tu.posted') } end + def list_bookmarks + create_list(:bookmarks) {|l| l.where('tu.bookmarked') } + end + def list_top_for(period) score = "#{period}_score" create_list(:top, unordered: true) do |topics|