From fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd Mon Sep 17 00:00:00 2001
From: Star Rauchenberger <fefferburbia@gmail.com>
Date: Sat, 14 Oct 2023 11:12:05 -0400
Subject: Added comment replying

---
 app/assets/javascripts/application.js       |  1 +
 app/assets/javascripts/main/comments.coffee | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 app/assets/javascripts/main/comments.coffee

(limited to 'app/assets/javascripts')

diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index cd58a9c..d8f72b4 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -17,3 +17,4 @@
 //= require jquery-ui
 //= require js-routes
 //= require_tree ./admin
+//= require_tree ./main
diff --git a/app/assets/javascripts/main/comments.coffee b/app/assets/javascripts/main/comments.coffee
new file mode 100644
index 0000000..d33e200
--- /dev/null
+++ b/app/assets/javascripts/main/comments.coffee
@@ -0,0 +1,14 @@
+comments_ready = ->
+  $(".comment-reply-to").click ->
+    $("#comment_reply_to_id").val($(this).data("commentId"))
+    $("#comment-reply-msg .comment-reply-author").text($(this).data("commentAuthor"))
+    $("#comment-reply-msg").show()
+    return false
+
+  $(".comment-reply-cancel").click ->
+    $("#comment_reply_to_id").val("")
+    $("#comment-reply-msg").hide()
+    return false
+
+$(document).ready(comments_ready)
+$(document).on('turbolinks:load', comments_ready)
-- 
cgit 1.4.1