Skip to content
Extraits de code Groupes Projets
Valider 33e0de94 rédigé par danielgrippi's avatar danielgrippi Validation de Dennis Collinson
Parcourir les fichiers

silently add a newly created Post to the stream's posts collection & fire...

silently add a newly created Post to the stream's posts collection & fire stream.prependPost instead (this will make new posts show up top
parent 565a0b21
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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() {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter