silently add a newly created Post to the stream's posts collection & fire stream.prependPost instead (this will make new posts show up top
This commit is contained in:
parent
565a0b21f7
commit
33e0de94f8
3 changed files with 19 additions and 6 deletions
|
|
@ -32,9 +32,11 @@ app.views.Feedback = app.views.StreamObject.extend({
|
|||
if(window.confirm("Reshare " + this.model.baseAuthor().name + "'s post?")) {
|
||||
var reshare = new app.models.Reshare();
|
||||
reshare.save({root_guid : this.model.baseGuid()}, {
|
||||
success : $.proxy(function(data){
|
||||
app.stream.collection.add(this);
|
||||
}, reshare)
|
||||
success : function(data){
|
||||
var newPost = new app.models.Post(data);
|
||||
app.stream.collection.add(newPost, {silent : true});
|
||||
app.stream.prependPost(newPost);
|
||||
}
|
||||
});
|
||||
return reshare;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,11 @@ app.views.Publisher = Backbone.View.extend({
|
|||
"aspect_ids" : serializedForm["aspect_ids[]"],
|
||||
"photos" : serializedForm["photos[]"]
|
||||
}, {
|
||||
success : $.proxy(function(data) {
|
||||
app.stream.collection.add(this);
|
||||
}, statusMessage)
|
||||
success : function(data) {
|
||||
var newPost = new app.models.Post(data);
|
||||
app.stream.collection.add(newPost, {silent : true});
|
||||
app.stream.prependPost(newPost);
|
||||
}
|
||||
});
|
||||
|
||||
// clear state
|
||||
|
|
|
|||
|
|
@ -12,9 +12,18 @@ app.views.Stream = Backbone.View.extend({
|
|||
return this;
|
||||
},
|
||||
|
||||
prependPost : function(post) {
|
||||
var postView = new app.views.Post({ model: post });
|
||||
$(this.el).prepend(postView.render().el);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
appendPost: function(post) {
|
||||
var postView = new app.views.Post({ model: post });
|
||||
$(this.el).append(postView.render().el);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
collectionFetched: function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue