Fix mentioning model being broken when reopening it
This commit is contained in:
parent
049b607b35
commit
d60862c3c6
3 changed files with 24 additions and 14 deletions
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
modalBody.load(url, function(){
|
||||
$(id).find("#modalWaiter").remove();
|
||||
$(id).trigger("modal:loaded");
|
||||
});
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ app.views.ProfileHeader = app.views.Base.extend({
|
|||
initialize: function(opts) {
|
||||
this.photos = _.has(opts, 'photos') ? opts.photos : 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() {
|
||||
|
|
@ -52,10 +54,30 @@ app.views.ProfileHeader = app.views.Base.extend({
|
|||
return (this.contacts && this.contacts > 0);
|
||||
},
|
||||
|
||||
showMentionModal: function(){
|
||||
showMentionModal: function() {
|
||||
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(){
|
||||
app.helpers.showModal("#conversationModal");
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,16 +4,3 @@
|
|||
:selected_aspects => @aspects_with_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