From 372a472fbfb93733a4787670f99855046894b4d8 Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Tue, 27 Sep 2011 23:46:02 -0300 Subject: [PATCH] Empty aspect stream when no aspect selected on the left nav --- config/locales/javascript/javascript.en.yml | 1 + public/javascripts/widgets/aspect-navigation.js | 2 ++ public/javascripts/widgets/stream.js | 13 ++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/config/locales/javascript/javascript.en.yml b/config/locales/javascript/javascript.en.yml index 235775635..13f8ff7bd 100644 --- a/config/locales/javascript/javascript.en.yml +++ b/config/locales/javascript/javascript.en.yml @@ -56,3 +56,4 @@ en: aspect_navigation: select_all: "Select all" deselect_all: "Deselect all" + no_aspects: "No aspects selected" diff --git a/public/javascripts/widgets/aspect-navigation.js b/public/javascripts/widgets/aspect-navigation.js index 704ed22cf..354b09695 100644 --- a/public/javascripts/widgets/aspect-navigation.js +++ b/public/javascripts/widgets/aspect-navigation.js @@ -54,6 +54,8 @@ this.perform = function() { if (self.noneSelected()) { self.abortAjax(); + Diaspora.page.stream.empty(); + Diaspora.page.stream.setHeaderTitle(Diaspora.I18n.t('aspect_navigation.no_aspects')); self.fadeIn(); } else { self.performAjax(); diff --git a/public/javascripts/widgets/stream.js b/public/javascripts/widgets/stream.js index 037b76ed9..09630c6ae 100644 --- a/public/javascripts/widgets/stream.js +++ b/public/javascripts/widgets/stream.js @@ -5,7 +5,9 @@ this.subscribe("widget/ready", function(evt, stream) { $.extend(self, { - stream: $(stream) + stream: $(stream), + mainStream: $(stream).find('#main_stream'), + headerTitle: $(stream).find('#aspect_stream_header > h3') }); $.each(self.stream.find(".stream_element"), function() { @@ -31,6 +33,15 @@ this.addPost = function(post) { self.streamElements[post.attr("id")] = self.instantiate("StreamElement", post); }; + + this.empty = function() { + self.mainStream.empty(); + self.headerTitle.text(Diaspora.I18n.t('stream.no_aspects')); + }; + + this.setHeaderTitle = function(newTitle) { + self.headerTitle.text(newTitle); + }; }; Diaspora.Widgets.Stream = Stream;