Merge pull request #6757 from svbergerem/fix-mentions-input-box-submitting

Fix publisher overflow on submit
This commit is contained in:
Dennis Schubert 2016-03-18 07:28:36 +01:00
commit 3bb28ec016
4 changed files with 22 additions and 2 deletions

View file

@ -175,6 +175,7 @@ app.views.Publisher = Backbone.View.extend({
var serializedForm = $(evt.target).closest("form").serializeObject();
// disable input while posting, must be after the form is serialized
this.setInputEnabled(false);
this.wrapperEl.addClass("submitting");
// lulz this code should be killed.
var statusMessage = new app.models.Post();
@ -220,6 +221,9 @@ app.views.Publisher = Backbone.View.extend({
app.flashMessages.error(resp.responseText);
self.setButtonsEnabled(true);
self.setInputEnabled(true);
self.wrapperEl.removeClass("submitting");
self.handleTextchange();
autosize.update(self.inputEl);
}
});
},
@ -399,6 +403,7 @@ app.views.Publisher = Backbone.View.extend({
// enable input
this.setInputEnabled(true);
this.wrapperEl.removeClass("submitting");
// enable buttons
this.setButtonsEnabled(true);

View file

@ -20,6 +20,8 @@
box-sizing: border-box;
}
.form-control[disabled] { background-color: transparent; }
.mentions-autocomplete-list {
background: white;
display: none;

View file

@ -253,6 +253,8 @@
.locator { display: none; }
}
&.submitting .mentions-box { display: none; }
.twitter-typeahead {
left: -1px;
position: absolute;

View file

@ -134,6 +134,13 @@ describe("app.views.Publisher", function() {
this.view.clear($.Event());
expect($("#location").length).toBe(0);
});
it("removes the 'submitting' class from the textarea wrapper", function(){
this.view.wrapperEl.addClass("submitting");
expect(this.view.wrapperEl).toHaveClass("submitting");
this.view.clear($.Event());
expect(this.view.wrapperEl).not.toHaveClass("submitting");
});
});
describe("createStatusMessage", function(){
@ -150,6 +157,12 @@ describe("app.views.Publisher", function() {
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, responseText: "{\"id\": 1}" });
expect(app.stream.addNow).toHaveBeenCalled();
});
it("adds the 'submitting' class from the textarea wrapper", function(){
expect(this.view.wrapperEl).not.toHaveClass("submitting");
this.view.createStatusMessage($.Event());
expect(this.view.wrapperEl).toHaveClass("submitting");
});
});
describe("createPostPreview", function(){
@ -617,6 +630,4 @@ describe("app.views.Publisher", function() {
});
});
});
});