From 6efde34bb80035f7053074220b1ee0b57683d278 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Mon, 8 Feb 2016 17:42:36 +0100 Subject: [PATCH] Remove stream faces --- app/assets/javascripts/app/router.js | 3 -- .../app/views/stream_faces_view.js | 33 ------------ app/assets/stylesheets/_application.scss | 1 - app/assets/stylesheets/navbar_right.scss | 5 -- app/assets/stylesheets/stream-faces.scss | 7 --- app/views/streams/main_stream.html.haml | 6 --- .../app/views/stream_faces_view_spec.js | 54 ------------------- .../javascripts/app/views/stream_post_spec.js | 1 + 8 files changed, 1 insertion(+), 109 deletions(-) delete mode 100644 app/assets/javascripts/app/views/stream_faces_view.js delete mode 100644 app/assets/stylesheets/stream-faces.scss delete mode 100644 spec/javascripts/app/views/stream_faces_view_spec.js diff --git a/app/assets/javascripts/app/router.js b/app/assets/javascripts/app/router.js index 396e01918..52117d495 100644 --- a/app/assets/javascripts/app/router.js +++ b/app/assets/javascripts/app/router.js @@ -183,10 +183,7 @@ app.Router = Backbone.Router.extend({ app.publisher = app.publisher || new app.views.Publisher({collection : app.stream.items}); app.shortcuts = app.shortcuts || new app.views.StreamShortcuts({el: $(document)}); - var streamFacesView = new app.views.StreamFaces({collection : app.stream.items}); - $("#main_stream").html(app.page.render().el); - $("#selected_aspect_contacts .content").html(streamFacesView.render().el); this._hideInactiveStreamLists(); } }); diff --git a/app/assets/javascripts/app/views/stream_faces_view.js b/app/assets/javascripts/app/views/stream_faces_view.js deleted file mode 100644 index 6ad00d057..000000000 --- a/app/assets/javascripts/app/views/stream_faces_view.js +++ /dev/null @@ -1,33 +0,0 @@ -// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later - -app.views.StreamFaces = app.views.Base.extend({ - - templateName : "stream-faces", - - className : "stream-faces", - - tooltipSelector : ".avatar", - - initialize : function(){ - this.updatePeople(); - app.stream.items.bind("add", this.updatePeople, this); - app.stream.items.bind("remove", this.updatePeople, this); - }, - - presenter : function() { - return {people : this.people}; - }, - - updatePeople : function(){ - if(this.people && this.people.length >= 15) { return } - this.people = _(this.collection.models).chain() - .map(function(post){ return post.get("author") }) - .compact() - .uniq(false, function(person){ return person.id }) - .value() - .slice(0,15); - - this.render(); - } -}); -// @license-end diff --git a/app/assets/stylesheets/_application.scss b/app/assets/stylesheets/_application.scss index b75f61c30..892571d67 100644 --- a/app/assets/stylesheets/_application.scss +++ b/app/assets/stylesheets/_application.scss @@ -74,7 +74,6 @@ /* stream */ @import 'tag'; -@import 'stream-faces'; @import 'stream'; @import 'stream_element'; @import 'comments'; diff --git a/app/assets/stylesheets/navbar_right.scss b/app/assets/stylesheets/navbar_right.scss index 6737418eb..134123d30 100644 --- a/app/assets/stylesheets/navbar_right.scss +++ b/app/assets/stylesheets/navbar_right.scss @@ -79,11 +79,6 @@ display: inline-block; } } - .stream-faces{ - display: flex; - flex-flow: row wrap; - img{ margin: 1px; } - } } } } diff --git a/app/assets/stylesheets/stream-faces.scss b/app/assets/stylesheets/stream-faces.scss deleted file mode 100644 index b05f19f43..000000000 --- a/app/assets/stylesheets/stream-faces.scss +++ /dev/null @@ -1,7 +0,0 @@ -#selected_aspect_contacts .avatar { - height: 32px; - width: 32px; - margin-bottom: 2px; -} - -.stream-faces a:hover { text-decoration: none; } diff --git a/app/views/streams/main_stream.html.haml b/app/views/streams/main_stream.html.haml index b2c5ad088..cb3bb5d5f 100644 --- a/app/views/streams/main_stream.html.haml +++ b/app/views/streams/main_stream.html.haml @@ -51,12 +51,6 @@ .right-sidebar-fixed-sub-background.col-lg-3.visible-lg .right-sidebar-fixed-background.col-md-3.col-lg-2.hidden-sm.hidden-xs .col-md-3.col-lg-2.hidden-xs.hidden-sm.rightbar - #selected_aspect_contacts.section - .title - %h5.stream_title - = @stream.title - .content - = render 'shared/right_sections' %a.back-to-top#back-to-top{title: "#{t('layouts.application.back_to_top')}", href: "#"} diff --git a/spec/javascripts/app/views/stream_faces_view_spec.js b/spec/javascripts/app/views/stream_faces_view_spec.js deleted file mode 100644 index af42b3c6d..000000000 --- a/spec/javascripts/app/views/stream_faces_view_spec.js +++ /dev/null @@ -1,54 +0,0 @@ -describe("app.views.StreamFaces", function(){ - beforeEach(function(){ - var rebeccaBlack = factory.author({name : "Rebecca Black", id : 1492}); - this.post1 = factory.post({author : rebeccaBlack}); - this.post2 = factory.post({author : factory.author({name : "John Stamos", id : 1987})}); - this.post3 = factory.post({author : factory.author({name : "Michelle Tanner", id : 1986})}); - this.post4 = factory.post({author : factory.author({name : "Barack Obama", id : 2000})}); - this.post5 = factory.post({author : factory.author({name : "Obi-wan Kenobi", id : 2020})}); - this.post6 = factory.post({author : rebeccaBlack}); - this.post7 = factory.post({author : rebeccaBlack}); - - app.stream = new app.models.Stream(); - app.stream.add([this.post1, this.post2, this.post3, this.post4, this.post5, this.post6, this.post7]); - this.posts = app.stream.items; - - this.view = new app.views.StreamFaces({collection : this.posts}); - }); - - it("should take them unique", function(){ - this.view.render(); - expect(this.view.people.length).toBe(5); - }); - - it("Finds people that were added to the collection", function() { - this.posts.add(factory.post({author : factory.author({name : "Harriet Tubman"})})); - expect(this.view.people.length).toBe(6); - }); - - it("Finds people that were removed from the collection", function() { - this.posts.remove([this.post2, this.post3]); - expect(this.view.people.length).toBe(3); - }); - - describe(".render", function(){ - beforeEach(function(){ - this.view.render(); - }); - - it("appends the people's avatars", function(){ - expect(this.view.$("img").length).toBe(5); - }); - - it("links to the people", function(){ - expect(this.view.$("a").length).toBe(5); - }); - - it("rerenders when people are added, but caps to 15 people", function(){ - var posts = _.map(_.range(20), function(){ return factory.post()}); - this.posts.reset(posts); //add 20 posts silently to the collection - this.posts.add(factory.post()); //trigger an update - expect(this.view.$("img").length).toBe(15); - }); - }); -}); diff --git a/spec/javascripts/app/views/stream_post_spec.js b/spec/javascripts/app/views/stream_post_spec.js index 13fa30c59..46088809d 100644 --- a/spec/javascripts/app/views/stream_post_spec.js +++ b/spec/javascripts/app/views/stream_post_spec.js @@ -6,6 +6,7 @@ describe("app.views.StreamPost", function(){ this.collection = new app.collections.Posts(posts); this.statusMessage = this.collection.models[0]; this.reshare = this.collection.models[1]; + app.stream = new app.models.Stream(); }); describe("events", function(){