adds stream_aspect class
This commit is contained in:
parent
3f314cc7bb
commit
53ba55c9ca
3 changed files with 30 additions and 5 deletions
27
app/assets/javascripts/app/models/stream_aspects.js
Normal file
27
app/assets/javascripts/app/models/stream_aspects.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
app.models.StreamAspects = app.models.Stream.extend({
|
||||
|
||||
url : function(){
|
||||
return _.any(this.items.models) ? this.timeFilteredPath() : this.basePath()
|
||||
},
|
||||
|
||||
initialize : function(models, options){
|
||||
var collectionClass = options && options.collection || app.collections.Posts;
|
||||
this.items = new collectionClass([], this.collectionOptions());
|
||||
this.aspects_ids = options.aspects_ids;
|
||||
},
|
||||
|
||||
basePath : function(){
|
||||
return '/aspects';
|
||||
},
|
||||
|
||||
fetch: function() {
|
||||
if(this.isFetching()){ return false }
|
||||
var url = this.url();
|
||||
var ids = this.aspects_ids;
|
||||
this.deferred = this.items.fetch({
|
||||
add : true,
|
||||
url : url,
|
||||
data : { 'a_ids': ids }
|
||||
}).done(_.bind(this.triggerFetchedEvents, this))
|
||||
}
|
||||
});
|
||||
|
|
@ -87,18 +87,17 @@ app.Router = Backbone.Router.extend({
|
|||
app.aspects = new app.collections.Aspects(app.currentUser.get('aspects'));
|
||||
var aspects_list = new app.views.AspectsList({ collection: app.aspects });
|
||||
aspects_list.render();
|
||||
this.aspects_stream();
|
||||
},
|
||||
|
||||
aspects_stream : function(){
|
||||
|
||||
var ids = app.aspects.selectedAspects('id');
|
||||
|
||||
app.stream = new app.models.Stream([], {url: '/aspects'});
|
||||
app.stream.fetch({data: $.param({a_ids:ids})});
|
||||
app.stream = new app.models.StreamAspects([], { aspects_ids: ids });
|
||||
app.stream.fetch();
|
||||
|
||||
app.page = new app.views.Stream({model : app.stream});
|
||||
app.publisher = new app.views.Publisher({collection : app.stream.items});
|
||||
|
||||
var streamFacesView = new app.views.StreamFaces({collection : app.stream.items});
|
||||
|
||||
$("#main_stream").html(app.page.render().el);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ app.views.AspectsList = app.views.Base.extend({
|
|||
}
|
||||
|
||||
this.toggleSelector();
|
||||
|
||||
app.router.aspects_stream();
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue