wip.
This commit is contained in:
parent
6d9dd1f4d3
commit
f62b9f9698
4 changed files with 62 additions and 8 deletions
|
|
@ -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",
|
templateName : "profile",
|
||||||
|
|
||||||
subviews : {
|
// subviews : {
|
||||||
"#canvas" : "canvasView"
|
// "#canvas" : "canvasView"
|
||||||
},
|
// },
|
||||||
|
|
||||||
initialize : function() {
|
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() {
|
postClass : app.views.SmallFrame,
|
||||||
this.canvasView = new app.views.Canvas()
|
|
||||||
|
mason : function() {
|
||||||
|
this.$el.isotope({
|
||||||
|
itemSelector : '.canvas-frame'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
// initViews : function() {
|
||||||
|
// this.canvasView = new app.views.Canvas({model : this.model})
|
||||||
|
// }
|
||||||
|
}));
|
||||||
5
app/assets/javascripts/app/views/small_frame.js
Normal file
5
app/assets/javascripts/app/views/small_frame.js
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
app.views.SmallFrame = app.views.Base.extend({
|
||||||
|
|
||||||
|
templateName: "small-frame"
|
||||||
|
|
||||||
|
});
|
||||||
8
app/assets/templates/small-frame.jst.hbs
Normal file
8
app/assets/templates/small-frame.jst.hbs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<div class="canvas-frame">
|
||||||
|
<div class="content">
|
||||||
|
filler
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
{{author.name}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
23
spec/javascripts/app/pages/profile_spec.js
Normal file
23
spec/javascripts/app/pages/profile_spec.js
Normal file
|
|
@ -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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue