diff --git a/app/assets/javascripts/app/views/infinite_stream_view.js b/app/assets/javascripts/app/views/infinite_stream_view.js index b8585672a..d5783d559 100644 --- a/app/assets/javascripts/app/views/infinite_stream_view.js +++ b/app/assets/javascripts/app/views/infinite_stream_view.js @@ -16,6 +16,7 @@ app.views.InfScroll = app.views.Base.extend({ this.showLoader(); this.bind("loadMore", this.fetchAndshowLoader, this); this.stream.bind("fetched", this.finishedLoading, this); + this.stream.bind("allItemsLoaded", this.showNoPostsInfo, this); this.stream.bind("allItemsLoaded", this.unbindInfScroll, this); this.collection.bind("add", this.addPostView, this); @@ -50,6 +51,13 @@ app.views.InfScroll = app.views.Base.extend({ } }, + showNoPostsInfo: function() { + if (this.postViews.length === 0) { + var noPostsInfo = new app.views.NoPostsInfo(); + this.$el.append(noPostsInfo.render().el); + } + }, + unbindInfScroll : function() { $(window).unbind("scroll"); }, diff --git a/app/assets/javascripts/app/views/no_posts_info_view.js b/app/assets/javascripts/app/views/no_posts_info_view.js new file mode 100644 index 000000000..57894b9f0 --- /dev/null +++ b/app/assets/javascripts/app/views/no_posts_info_view.js @@ -0,0 +1,3 @@ +app.views.NoPostsInfo = app.views.Base.extend({ + templateName: "no_posts_info" +}); diff --git a/app/assets/stylesheets/stream_element.scss b/app/assets/stylesheets/stream_element.scss index f99fe12ff..91f96255c 100644 --- a/app/assets/stylesheets/stream_element.scss +++ b/app/assets/stylesheets/stream_element.scss @@ -189,4 +189,9 @@ .leaflet-control-zoom { display: block; } + + .no-posts-info { + margin-bottom: 10px; + margin-top: 10px; + } } diff --git a/app/assets/templates/no_posts_info_tpl.jst.hbs b/app/assets/templates/no_posts_info_tpl.jst.hbs new file mode 100644 index 000000000..b617b72f1 --- /dev/null +++ b/app/assets/templates/no_posts_info_tpl.jst.hbs @@ -0,0 +1,5 @@ +
+
+ {{ t "stream.no_posts_yet" }} +
+
diff --git a/config/locales/javascript/javascript.en.yml b/config/locales/javascript/javascript.en.yml index 69180379b..7066e750b 100644 --- a/config/locales/javascript/javascript.en.yml +++ b/config/locales/javascript/javascript.en.yml @@ -236,6 +236,7 @@ en: disable_post_notifications: "Disable notifications for this post" permalink: "Permalink" via: "via <%= provider %>" + no_posts_yet: "There are no posts yet." likes: zero: "<%= count %> Likes" diff --git a/features/desktop/follows_tags.feature b/features/desktop/follows_tags.feature index 63448f9d4..78692e71c 100644 --- a/features/desktop/follows_tags.feature +++ b/features/desktop/follows_tags.feature @@ -41,3 +41,7 @@ Feature: posting When I go to the followed tags stream page And I unfollow the "boss" tag Then I should not see "#tag-following-boss" within "#tags_list" + + Scenario: Go to a tags page with no posts + When I go to the tag page for "NoPosts" + Then I should not see any posts in my stream diff --git a/features/desktop/signs_up.feature b/features/desktop/signs_up.feature index 7280bbcd0..dbbbf73fa 100644 --- a/features/desktop/signs_up.feature +++ b/features/desktop/signs_up.feature @@ -15,6 +15,7 @@ Feature: new user registration Then I should be on the stream page And I close the publisher And I should not see "awesome_button" + And I should not see any posts in my stream Scenario: new user tries to XSS itself When I fill in the following: diff --git a/features/step_definitions/comment_steps.rb b/features/step_definitions/comment_steps.rb index bc1436530..38f1428ad 100644 --- a/features/step_definitions/comment_steps.rb +++ b/features/step_definitions/comment_steps.rb @@ -7,7 +7,7 @@ Then /^the first comment field should be open/ do end Then /^the first comment field should be closed$/ do - page.should have_css(".stream_element") + page.should have_css(".stream_element .media") page.should_not have_selector("#main_stream .stream_element .new_comment", match: :first) end diff --git a/features/step_definitions/posts_steps.rb b/features/step_definitions/posts_steps.rb index eacd7ac93..40799cd86 100644 --- a/features/step_definitions/posts_steps.rb +++ b/features/step_definitions/posts_steps.rb @@ -15,8 +15,9 @@ Then /^I should not see an uploaded image within the photo drop zone$/ do end Then /^I should not see any posts in my stream$/ do - page.assert_selector("#paginate .loader", visible: :hidden) - page.assert_selector(".stream_element", count: 0) + expect(page).not_to have_selector("#paginate .loader") + expect(page).not_to have_selector(".stream_element .media") + expect(page).to have_selector(".stream_element .no-posts-info") end Then /^I should not see any picture in my stream$/ do diff --git a/features/support/publishing_cuke_helpers.rb b/features/support/publishing_cuke_helpers.rb index bcc7aff8a..88c57d685 100644 --- a/features/support/publishing_cuke_helpers.rb +++ b/features/support/publishing_cuke_helpers.rb @@ -113,10 +113,6 @@ module PublishingCukeHelpers end end - def stream_posts - all('.stream_element') - end - def comment_on_show_page(comment_text) within("#single-post-interactions") do make_comment(comment_text) diff --git a/spec/javascripts/app/views/no_posts_info_view_spec.js b/spec/javascripts/app/views/no_posts_info_view_spec.js new file mode 100644 index 000000000..4dd270342 --- /dev/null +++ b/spec/javascripts/app/views/no_posts_info_view_spec.js @@ -0,0 +1,11 @@ +describe("app.views.NoPostsInfo", function() { + describe("render", function() { + beforeEach(function() { + this.view = new app.views.NoPostsInfo(); + }); + + it("renders the no posts info message", function() { + expect(this.view.render().$el.text().trim()).toBe(Diaspora.I18n.t("stream.no_posts_yet")); + }); + }); +});