Commit 473cc251 authored by Steffen van Bergerem's avatar Steffen van Bergerem Committed by Benjamin Neff

Replace comment_box with comment-box

parent 7457f254
......@@ -7,7 +7,7 @@ app.views.CommentStream = app.views.Base.extend({
className : "comment_stream",
events: {
"keydown .comment_box": "keyDownOnCommentBox",
"keydown .comment-box": "keyDownOnCommentBox",
"submit form": "createComment",
"click .toggle_post_comments": "expandComments",
"click form": "openForm"
......@@ -26,11 +26,11 @@ app.views.CommentStream = app.views.Base.extend({
postRenderTemplate : function() {
this.model.comments.each(this.appendComment, this);
this.commentBox = this.$(".comment_box");
this.commentBox = this.$(".comment-box");
this.commentSubmitButton = this.$("input[name='commit']");
this.mentions = new app.views.CommentMention({el: this.$el, postId: this.model.get("id")});
this.mdEditor = new Diaspora.MarkdownEditor(this.$(".comment_box"), {
this.mdEditor = new Diaspora.MarkdownEditor(this.$(".comment-box"), {
onPreview: function($mdInstance) {
var renderedText = app.helpers.textFormatter($mdInstance.getContent(), this.mentions.getMentionedPeople());
return "<div class='preview-content'>" + renderedText + "</div>";
......
......@@ -26,8 +26,8 @@ app.views.SinglePostActions = app.views.Feedback.extend({
},
focusComment: function() {
$('.comment_stream .comment_box').focus();
$('html,body').animate({scrollTop: $('.comment_stream .comment_box').offset().top - ($('.comment_stream .comment_box').height() + 20)});
$('.comment_stream .comment-box').focus();
$('html,body').animate({scrollTop: $('.comment_stream .comment-box').offset().top - ($('.comment_stream .comment-box').height() + 20)});
return false;
},
......
......@@ -88,7 +88,7 @@ app.views.StreamPost = app.views.Post.extend({
focusCommentTextarea: function(evt){
evt.preventDefault();
this.$(".new-comment-form-wrapper").removeClass("hidden");
this.$(".comment_box").focus();
this.$(".comment-box").focus();
return this;
}
......
......@@ -11,7 +11,7 @@
initialize: function() {
var self = this;
new Diaspora.MarkdownEditor(".comment_box");
new Diaspora.MarkdownEditor(".comment-box");
this.stream().on("tap click", "a.show-comments", function(evt){
evt.preventDefault();
......@@ -43,7 +43,7 @@
submitComment: function(evt){
evt.preventDefault();
var form = $(this);
var commentBox = form.find(".comment_box");
var commentBox = form.find(".comment-box");
var commentText = $.trim(commentBox.val());
if(!commentText){
commentBox.focus();
......@@ -169,7 +169,7 @@
showCommentBox: function(link){
var bottomBar = link.closest(".bottom-bar").first();
var textArea = bottomBar.find("textarea.comment_box").first()[0];
var textArea = bottomBar.find("textarea.comment-box").first()[0];
bottomBar.find(".add-comment-switcher").removeClass("hidden");
autosize(textArea);
},
......
......@@ -53,11 +53,11 @@
}
padding-left: 12px;
}
.comment_box {
.comment-box {
height: 35px;
resize: none;
}
textarea.comment_box:focus, textarea.comment_box:valid, textarea.comment_box:active {
textarea.comment-box:focus, textarea.comment-box:valid, textarea.comment-box:active {
border-color: $border-dark-grey;
box-shadow: none;
}
......
......@@ -28,7 +28,7 @@
<form accept-charset="UTF-8" action="/posts/{{id}}/comments"
class="new-comment" id="new-comment-on-{{id}}" method="post">
<textarea class="comment_box form-control mention-textarea"
<textarea class="comment-box form-control mention-textarea"
id="comment_text_on_{{id}}" name="text" rows="1" required placeholder="{{t "stream.comment"}}" />
<div class="typeahead-mention-box-wrap">
<input class="typeahead-mention-box hidden" type="text">
......
......@@ -9,7 +9,7 @@
%fieldset
= hidden_field_tag :post_id, post_id, id: "post-id-on-#{post_id}"
.form-group.clearfix
= text_area_tag :text, nil, class: "col-md-12 comment_box form-control",
= text_area_tag :text, nil, class: "col-md-12 comment-box form-control",
id: "comment-text-on-#{post_id}", placeholder: t(".comment")
= submit_tag t(".comment"), :id => "comment-submit-#{post_id}", "data-disable-with" => t(".commenting"),
"data-reset-with" => t(".comment"), :class => "btn btn-primary btn-block comment-button"
......@@ -40,5 +40,5 @@ Given /^"([^"]*)" has commented a lot on "([^"]*)"$/ do |email, post_text|
end
When /^I enter "([^"]*)" in the comment field$/ do |comment_text|
find("textarea.comment_box.mention-textarea").native.send_keys(comment_text)
find("textarea.comment-box.mention-textarea").native.send_keys(comment_text)
end
......@@ -51,7 +51,7 @@ describe("app.views.CommentStream", function(){
this.view.commentBox = undefined;
this.view.postRenderTemplate();
expect(this.view.commentBox).toBeDefined();
expect(this.view.commentBox).toEqual(this.view.$(".comment_box"));
expect(this.view.commentBox).toEqual(this.view.$(".comment-box"));
});
it("sets commentSubmitButton", function() {
......@@ -124,7 +124,7 @@ describe("app.views.CommentStream", function(){
context("submission", function() {
beforeEach(function() {
this.view.$(".comment_box").val('a new comment');
this.view.$(".comment-box").val('a new comment');
this.view.createComment();
this.request = jasmine.Ajax.requests.mostRecent();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment