From fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 14 Oct 2023 11:12:05 -0400 Subject: Added comment replying --- .../comment_mailer/reply_comment_email.html.haml | 14 ++++++++++++++ app/views/comment_mailer/reply_comment_email.text.erb | 19 +++++++++++++++++++ app/views/comments/_comment.html.haml | 1 + app/views/comments/_form.html.haml | 6 ++++++ 4 files changed, 40 insertions(+) create mode 100644 app/views/comment_mailer/reply_comment_email.html.haml create mode 100644 app/views/comment_mailer/reply_comment_email.text.erb (limited to 'app/views') diff --git a/app/views/comment_mailer/reply_comment_email.html.haml b/app/views/comment_mailer/reply_comment_email.html.haml new file mode 100644 index 0000000..22009ee --- /dev/null +++ b/app/views/comment_mailer/reply_comment_email.html.haml @@ -0,0 +1,14 @@ +%p + A reply has been posted to your comment on + = succeed "." do + = link_to @comment.blog.title, @comment.blog + The original comment: +%blockquote= @comment.reply_to.body +%p + = @comment.username + left the following response: +%blockquote= @comment.body +%p + Posted: + = @comment.published_at.strftime("%B #{@comment.published_at.day.ordinalize}, %Y at %-I:%M:%S%P") +%p= link_to "See the comment on the web", blog_url(@comment.blog, anchor: "comment-#{@comment.id}") diff --git a/app/views/comment_mailer/reply_comment_email.text.erb b/app/views/comment_mailer/reply_comment_email.text.erb new file mode 100644 index 0000000..bd60692 --- /dev/null +++ b/app/views/comment_mailer/reply_comment_email.text.erb @@ -0,0 +1,19 @@ +A reply has been posted to your comment on <%= @comment.blog.title %>. The original comment: + +--- + +<%= @comment.reply_to.body %> + +--- + +<%= @comment.username %> posted the following response: + +--- + +<%= @comment.body %> + +--- + +Posted: <%= @comment.published_at.strftime("%B #{@comment.published_at.day.ordinalize}, %Y at %-I:%M:%S%P") %> + +See the comment on the web: <%= blog_url(@comment.blog, anchor: "comment-#{@comment.id}") %> diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml index 3ad21e9..225b5d9 100644 --- a/app/views/comments/_comment.html.haml +++ b/app/views/comments/_comment.html.haml @@ -11,3 +11,4 @@ = link_to comment.username, comment.website on = comment.published_at.strftime("%B #{comment.published_at.day.ordinalize}, %Y at %-I:%M:%S%P") + = link_to (image_tag "comment_add.png"), "#", class: "comment-reply-to", title: "Reply to comment", data: { comment_id: comment.id, comment_author: comment.username } diff --git a/app/views/comments/_form.html.haml b/app/views/comments/_form.html.haml index f6df807..eb374c7 100644 --- a/app/views/comments/_form.html.haml +++ b/app/views/comments/_form.html.haml @@ -1,6 +1,12 @@ = form_for @comment || blog.comments.new, html: { id: "comment-form" } do |f| + = f.hidden_field :reply_to_id %fieldset#comment-body-field %blockquote.bubble.rounded.bottom + #comment-reply-msg + = link_to (image_tag "cross"), "#", class: "comment-reply-cancel" + Replying to comment by + = succeed ":" do + %span.comment-reply-author = f.label :body = f.text_area :body %cite.bubble Feel free to post a comment! You may use Markdown. -- cgit 1.4.1