Merge pull request #4858 from hincupetru/4514-clicking-show-more-comments-empties-textarea
Save textarea value before rendering comments when clicked 'show more....'
This commit is contained in:
commit
ab15bad53f
3 changed files with 12 additions and 2 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
* The photo stream no longer repeats after the last photo [#4726](https://github.com/diaspora/diaspora/issues/4726)
|
* The photo stream no longer repeats after the last photo [#4726](https://github.com/diaspora/diaspora/issues/4726)
|
||||||
* Fix hovercards in the notificaitons dropdown [#4693](https://github.com/diaspora/diaspora/issues/4693)
|
* Fix hovercards in the notificaitons dropdown [#4693](https://github.com/diaspora/diaspora/issues/4693)
|
||||||
* Do not parse hashtags inside Markdown links [#3692](https://github.com/diaspora/diaspora/issues/3692)
|
* Do not parse hashtags inside Markdown links [#3692](https://github.com/diaspora/diaspora/issues/3692)
|
||||||
|
* Restore comment textarea content after revealing more comments [#4514](https://github.com/diaspora/diaspora/issues/4514)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* You can report a single post by clicking the correct icon in the controler section [#4517](https://github.com/diaspora/diaspora/pull/4517)
|
* You can report a single post by clicking the correct icon in the controler section [#4517](https://github.com/diaspora/diaspora/pull/4517)
|
||||||
|
|
@ -52,7 +53,7 @@
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* Fix regression caused by using after_commit with nested '#save' which lead to an infinite recursion [#4715](https://github.com/diaspora/diaspora/issues/4715)
|
* Fix regression caused by using after_commit with nested '#save' which lead to an infinite recursion [#4715](https://github.com/diaspora/diaspora/issues/4715)
|
||||||
|
* Save textarea value before rendering comments when clicked 'show more...' [#4514](https://github.com/diaspora/diaspora/issues/4514)
|
||||||
# 0.3.0.0
|
# 0.3.0.0
|
||||||
|
|
||||||
## Pod statistics
|
## Pod statistics
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ app.views.CommentStream = app.views.Base.extend({
|
||||||
|
|
||||||
setupBindings: function() {
|
setupBindings: function() {
|
||||||
this.model.comments.bind('add', this.appendComment, this);
|
this.model.comments.bind('add', this.appendComment, this);
|
||||||
|
this.model.bind("commentsExpanded", this.storeTextareaValue, this);
|
||||||
this.model.bind("commentsExpanded", this.render, this);
|
this.model.bind("commentsExpanded", this.render, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -28,6 +29,7 @@ app.views.CommentStream = app.views.Base.extend({
|
||||||
|
|
||||||
// add autoexpanders to new comment textarea
|
// add autoexpanders to new comment textarea
|
||||||
this.$("textarea").autoResize({'extraSpace' : 10});
|
this.$("textarea").autoResize({'extraSpace' : 10});
|
||||||
|
this.$('textarea').val(this.textareaValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
presenter: function(){
|
presenter: function(){
|
||||||
|
|
@ -73,6 +75,10 @@ app.views.CommentStream = app.views.Base.extend({
|
||||||
this.$("form").removeClass('hidden').addClass("open");
|
this.$("form").removeClass('hidden').addClass("open");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
storeTextareaValue: function(){
|
||||||
|
this.textareaValue = this.$('textarea').val();
|
||||||
|
},
|
||||||
|
|
||||||
expandComments: function(evt){
|
expandComments: function(evt){
|
||||||
if(evt){ evt.preventDefault(); }
|
if(evt){ evt.preventDefault(); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,10 @@ describe("app.views.CommentStream", function(){
|
||||||
|
|
||||||
this.view.expandComments();
|
this.view.expandComments();
|
||||||
|
|
||||||
mostRecentAjaxRequest().response({ comments : [] });
|
mostRecentAjaxRequest().response({
|
||||||
|
status: 200,
|
||||||
|
responseText: JSON.stringify([factory.comment()])
|
||||||
|
});
|
||||||
|
|
||||||
expect(this.view.$("textarea").val()).toEqual("great post!");
|
expect(this.view.$("textarea").val()).toEqual("great post!");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue