Merge pull request #6962 from svbergerem/fix-mentioning-modal
Fix mentioning model being broken when reopening it
This commit is contained in:
commit
bd74eea140
3 changed files with 24 additions and 14 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
modalBody.load(url, function(){
|
modalBody.load(url, function(){
|
||||||
$(id).find("#modalWaiter").remove();
|
$(id).find("#modalWaiter").remove();
|
||||||
|
$(id).trigger("modal:loaded");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ app.views.ProfileHeader = app.views.Base.extend({
|
||||||
initialize: function(opts) {
|
initialize: function(opts) {
|
||||||
this.photos = _.has(opts, 'photos') ? opts.photos : null;
|
this.photos = _.has(opts, 'photos') ? opts.photos : null;
|
||||||
this.contacts = _.has(opts, 'contacts') ? opts.contacts : null;
|
this.contacts = _.has(opts, 'contacts') ? opts.contacts : null;
|
||||||
|
$("#mentionModal").on("modal:loaded", this.mentionModalLoaded.bind(this));
|
||||||
|
$("#mentionModal").on("hidden.bs.modal", this.mentionModalHidden);
|
||||||
},
|
},
|
||||||
|
|
||||||
presenter: function() {
|
presenter: function() {
|
||||||
|
|
@ -56,6 +58,26 @@ app.views.ProfileHeader = app.views.Base.extend({
|
||||||
app.helpers.showModal("#mentionModal");
|
app.helpers.showModal("#mentionModal");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mentionModalLoaded: function() {
|
||||||
|
app.publisher = new app.views.Publisher({
|
||||||
|
standalone: true,
|
||||||
|
prefillMention: _.extend({handle: this.model.get("diaspora_id")}, this.model.attributes)
|
||||||
|
});
|
||||||
|
app.publisher.open();
|
||||||
|
$("#publisher").bind("ajax:success", function() {
|
||||||
|
$("#mentionModal").modal("hide");
|
||||||
|
app.publisher.clear();
|
||||||
|
app.publisher.remove();
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
mentionModalHidden: function() {
|
||||||
|
app.publisher.clear();
|
||||||
|
app.publisher.remove();
|
||||||
|
$("#mentionModal .modal-body").empty();
|
||||||
|
},
|
||||||
|
|
||||||
showMessageModal: function(){
|
showMessageModal: function(){
|
||||||
app.helpers.showModal("#conversationModal");
|
app.helpers.showModal("#conversationModal");
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,3 @@
|
||||||
:selected_aspects => @aspects_with_person,
|
:selected_aspects => @aspects_with_person,
|
||||||
:person => @person }
|
:person => @person }
|
||||||
|
|
||||||
:javascript
|
|
||||||
$(function() {
|
|
||||||
app.publisher = new app.views.Publisher({
|
|
||||||
standalone: true,
|
|
||||||
prefillMention: #{json_escape @person.to_json}
|
|
||||||
});
|
|
||||||
app.publisher.open();
|
|
||||||
$("#publisher").bind('ajax:success', function(){
|
|
||||||
$("#mentionModal").modal('hide');
|
|
||||||
app.publisher.clear();
|
|
||||||
location.reload();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue