From f62b9f9698713d1981bcd8112f0d1d9cd2acd6a9 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 18 Apr 2012 14:18:22 -0700 Subject: [PATCH] wip. --- app/assets/javascripts/app/pages/profile.js | 34 ++++++++++++++----- .../javascripts/app/views/small_frame.js | 5 +++ app/assets/templates/small-frame.jst.hbs | 8 +++++ spec/javascripts/app/pages/profile_spec.js | 23 +++++++++++++ 4 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 app/assets/javascripts/app/views/small_frame.js create mode 100644 app/assets/templates/small-frame.jst.hbs create mode 100644 spec/javascripts/app/pages/profile_spec.js diff --git a/app/assets/javascripts/app/pages/profile.js b/app/assets/javascripts/app/pages/profile.js index bd7fbd604..1c9dde547 100644 --- a/app/assets/javascripts/app/pages/profile.js +++ b/app/assets/javascripts/app/pages/profile.js @@ -1,16 +1,34 @@ -app.pages.Profile = app.views.Base.extend({ +//= require ../views/small_frame + +app.pages.Profile = app.views.Base.extend(_.extend(app.views.infiniteScrollMixin, { templateName : "profile", - subviews : { - "#canvas" : "canvasView" - }, +// subviews : { +// "#canvas" : "canvasView" +// }, initialize : function() { - this.initViews() + this.stream = this.model = this.model || new app.models.Stream() + this.collection = this.model.posts + this.model.fetch(); + + this.stream.bind("fetched", this.mason, this) + +// this.initViews() + + this.setupInfiniteScroll() }, - initViews : function() { - this.canvasView = new app.views.Canvas() + postClass : app.views.SmallFrame, + + mason : function() { + this.$el.isotope({ + itemSelector : '.canvas-frame' + }) } -}); \ No newline at end of file + +// initViews : function() { +// this.canvasView = new app.views.Canvas({model : this.model}) +// } +})); \ No newline at end of file diff --git a/app/assets/javascripts/app/views/small_frame.js b/app/assets/javascripts/app/views/small_frame.js new file mode 100644 index 000000000..b2102b5a3 --- /dev/null +++ b/app/assets/javascripts/app/views/small_frame.js @@ -0,0 +1,5 @@ +app.views.SmallFrame = app.views.Base.extend({ + + templateName: "small-frame" + +}); \ No newline at end of file diff --git a/app/assets/templates/small-frame.jst.hbs b/app/assets/templates/small-frame.jst.hbs new file mode 100644 index 000000000..899f01829 --- /dev/null +++ b/app/assets/templates/small-frame.jst.hbs @@ -0,0 +1,8 @@ +
+
+ filler +
+
+ {{author.name}} +
+
\ No newline at end of file diff --git a/spec/javascripts/app/pages/profile_spec.js b/spec/javascripts/app/pages/profile_spec.js new file mode 100644 index 000000000..38f721ebb --- /dev/null +++ b/spec/javascripts/app/pages/profile_spec.js @@ -0,0 +1,23 @@ +describe("app.pages.Profile", function(){ + beforeEach(function(){ + this.page = new app.pages.Profile(); + this.stream = this.page.stream + }); + + it("passes the model down to the post view", function(){ + expect(this.page.canvasView.model).toBeDefined() + expect(this.page.canvasView.model).toBe(this.stream) + }); + + it("fetches the stream for the user", function(){ + spyOn(this.stream, "fetch") + new app.pages.Profile({model : this.stream}) + expect(this.stream.fetch).toHaveBeenCalled() + }) + + describe("rendering", function(){ + beforeEach(function(){ + this.page.render(); + }); + }); +});