[WIP] [mobile] Embedded new comment form in HTML

This commit is contained in:
Marien Fressinaud 2015-10-10 13:29:48 +02:00 committed by Augier
parent 053625c277
commit bde3b47c02
2 changed files with 21 additions and 16 deletions

View file

@ -122,27 +122,29 @@
showCommentBox: function(link){
if(!link.hasClass("inactive") || link.hasClass("loading")) { return; }
var self = this;
$.ajax({
url: link.attr("href"),
beforeSend: function(){
link.addClass("loading");
},
context: link,
success: function(data) {
self.appendCommentBox.call(this, link, data);
},
error: function() {
link.removeClass("loading");
}
});
// var self = this;
// $.ajax({
// url: link.attr("href"),
// beforeSend: function(){
// link.addClass("loading");
// },
// context: link,
// success: function(data) {
// self.appendCommentBox.call(this, link, data);
// },
// error: function() {
// link.removeClass("loading");
// }
// });
this.appendCommentBox(link);
},
appendCommentBox: function(link, data) {
appendCommentBox: function(link) {
link.removeClass("loading");
link.removeClass("inactive");
var bottomBar = link.closest(".bottom_bar").first();
bottomBar.append(data);
// bottomBar.append(data);
var addCommentSwitcher = bottomBar.find(".add-comment-switcher").removeClass('hidden')
var textArea = bottomBar.find("textarea.comment_box").first()[0];
autosize(textArea);
},

View file

@ -29,3 +29,6 @@
- if defined?(expanded_info) && expanded_info
= render partial: "shared/post_stats", locals: {post: @post}
.add-comment-switcher{class: ('hidden' unless defined?(expanded_info) && expanded_info)}
= render :partial => 'comments/new_comment', :locals =>{:post_id => post.id}