[WIP] [mobile] Embedded new comment form in HTML
This commit is contained in:
parent
053625c277
commit
bde3b47c02
2 changed files with 21 additions and 16 deletions
|
|
@ -122,27 +122,29 @@
|
||||||
|
|
||||||
showCommentBox: function(link){
|
showCommentBox: function(link){
|
||||||
if(!link.hasClass("inactive") || link.hasClass("loading")) { return; }
|
if(!link.hasClass("inactive") || link.hasClass("loading")) { return; }
|
||||||
var self = this;
|
// var self = this;
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
url: link.attr("href"),
|
// url: link.attr("href"),
|
||||||
beforeSend: function(){
|
// beforeSend: function(){
|
||||||
link.addClass("loading");
|
// link.addClass("loading");
|
||||||
},
|
// },
|
||||||
context: link,
|
// context: link,
|
||||||
success: function(data) {
|
// success: function(data) {
|
||||||
self.appendCommentBox.call(this, link, data);
|
// self.appendCommentBox.call(this, link, data);
|
||||||
},
|
// },
|
||||||
error: function() {
|
// error: function() {
|
||||||
link.removeClass("loading");
|
// link.removeClass("loading");
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
this.appendCommentBox(link);
|
||||||
},
|
},
|
||||||
|
|
||||||
appendCommentBox: function(link, data) {
|
appendCommentBox: function(link) {
|
||||||
link.removeClass("loading");
|
link.removeClass("loading");
|
||||||
link.removeClass("inactive");
|
link.removeClass("inactive");
|
||||||
var bottomBar = link.closest(".bottom_bar").first();
|
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];
|
var textArea = bottomBar.find("textarea.comment_box").first()[0];
|
||||||
autosize(textArea);
|
autosize(textArea);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -29,3 +29,6 @@
|
||||||
|
|
||||||
- if defined?(expanded_info) && expanded_info
|
- if defined?(expanded_info) && expanded_info
|
||||||
= render partial: "shared/post_stats", locals: {post: @post}
|
= 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}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue