Only remove photos from view when destroyed on server
This commit is contained in:
parent
4f8cf0fe07
commit
4cc1b40443
4 changed files with 8 additions and 2 deletions
|
|
@ -121,11 +121,13 @@ app.views.Base = Backbone.View.extend({
|
|||
var url = this.model.urlRoot + '/' + this.model.id;
|
||||
|
||||
if (confirm(Diaspora.I18n.t("confirm_dialog"))) {
|
||||
this.$el.addClass('deleting');
|
||||
this.model.destroy({ url: url })
|
||||
.done(function() {
|
||||
self.remove();
|
||||
})
|
||||
.fail(function() {
|
||||
self.$el.removeClass('deleting');
|
||||
var flash = new Diaspora.Widgets.FlashMessages;
|
||||
flash.render({
|
||||
success: false,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ app.views.Photo = app.views.Base.extend({
|
|||
|
||||
initialize : function() {
|
||||
$(this.el).attr("id", this.model.get("guid"));
|
||||
this.model.bind('remove', this.remove, this);
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@
|
|||
& > .media {
|
||||
margin: 0px;
|
||||
}
|
||||
&.deleting {
|
||||
> .media { opacity: 0.3; }
|
||||
.controls { display: none !important; }
|
||||
}
|
||||
}
|
||||
|
||||
#main_stream .stream_element {
|
||||
|
|
|
|||
|
|
@ -31,5 +31,6 @@ Feature: show photos
|
|||
When I am on "robert@grimm.grimm"'s photos page
|
||||
And I delete a photo
|
||||
And I confirm the alert
|
||||
And I am on "robert@grimm.grimm"'s page
|
||||
Then I should not see ".deleting" within ".stream"
|
||||
When I am on "robert@grimm.grimm"'s page
|
||||
Then I should not see "Photos" within "#profile_horizontal_bar"
|
||||
|
|
|
|||
Loading…
Reference in a new issue