From b4afd3d9c9eb90cb53318871adb5d76c00578784 Mon Sep 17 00:00:00 2001
From: root
Date: Sat, 21 Feb 2026 07:54:30 +0000
Subject: [PATCH] added comments that Actually work + an updates marquee
---
app/controllers/comments_controller.rb | 2 ++
app/mailers/comment_mailer.rb | 11 +++++++++++
app/views/comment_mailer/new_comment.html.erb | 14 ++++++++++++++
app/views/layouts/application.html.erb | 4 ++--
app/views/posts/show.html.erb | 12 ++++++++++--
app/views/welcome/index.html.erb | 4 +++-
test/mailers/comment_mailer_test.rb | 7 +++++++
test/mailers/previews/comment_mailer_preview.rb | 3 +++
8 files changed, 52 insertions(+), 5 deletions(-)
create mode 100644 app/mailers/comment_mailer.rb
create mode 100644 app/views/comment_mailer/new_comment.html.erb
create mode 100644 test/mailers/comment_mailer_test.rb
create mode 100644 test/mailers/previews/comment_mailer_preview.rb
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index 547feb1..b72502b 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -7,10 +7,12 @@ class CommentsController < ApplicationController
def create
@comment = @post.comments.build(comment_params)
if @comment.save
+ CommentMailer.new_comment(@comment).deliver_later
redirect_to member_blog_post_path(@member, @blog, @post), notice: "Comment added!"
else
redirect_to member_blog_post_path(@member, @blog, @post), alert: "Could not save comment."
end
+
end
def destroy
diff --git a/app/mailers/comment_mailer.rb b/app/mailers/comment_mailer.rb
new file mode 100644
index 0000000..b8b669b
--- /dev/null
+++ b/app/mailers/comment_mailer.rb
@@ -0,0 +1,11 @@
+class CommentMailer < ApplicationMailer
+ default from: "sunset@lovingwomen.online"
+
+ def new_comment_notification
+ @user = params[:user]
+ @comment = params[:comment]
+ @comment_url = post_url(@comment.post)
+ @author = @post.member
+ mail(to: @user.email, subject: "A new comment was posted!")
+ end
+end
diff --git a/app/views/comment_mailer/new_comment.html.erb b/app/views/comment_mailer/new_comment.html.erb
new file mode 100644
index 0000000..d263b9c
--- /dev/null
+++ b/app/views/comment_mailer/new_comment.html.erb
@@ -0,0 +1,14 @@
+New Comment on "<%= @post.title %>"
+
+
+ <%= @comment.name %> wrote:
+
+
+
+ <%= @comment.body %>
+
+
+
+ View it here:
+ <%= link_to "View Post", post_url(@post) %>
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 0e93a7c..3a65db3 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -36,10 +36,10 @@
<% if current_user %>
- <%= link_to 'Sign Out', sign_out_path, data: { turbo_method: :delete } %>
+<%= button_to "Sign Out", sign_out_path, method: :delete %>
<% else %>
- <%= link_to "Sign In", new_session_path %>
+ <%= button_to "Sign In", login_path %>
<% end %>
diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb
index 590e4ff..dbca547 100644
--- a/app/views/posts/show.html.erb
+++ b/app/views/posts/show.html.erb
@@ -23,8 +23,16 @@
<%= @post.mood %>
<% end %>
-
-
+
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index 1345443..d1d49c6 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -1,6 +1,8 @@
+
Latest....
+
<% if @latest_post %>
<%= @latest_post.post_title %>
<%=@latest_post.created_at %>
<%= truncate(@latest_post.text.to_plain_text, length: 200) %>
@@ -14,7 +16,7 @@
Welcome...

-Hi! I'm Agnes (Agnes the Alien!). I'm a freakdyke alien in its mid 20s trying to create a little home on the web. Here, you will find fandom thoughts and events, personal thoughts and life goings-on, my writing and creativity, and just about anything. This website is an eternal work in progress :) Feel free to look around!
friends, mutuals, cool people...





I'm a Hopeless Romantic
+Hi! I'm Agnes (Agnes the Alien!). I'm a freakdyke alien in its mid 20s trying to create a little home on the web. Here, you will find fandom thoughts and events, personal thoughts and life goings-on, my writing and creativity, and just about anything. This website is an eternal work in progress :) Feel free to look around!
friends, mutuals, cool internet people...






I'm a Hopeless Romantic
PICLOG!!

diff --git a/test/mailers/comment_mailer_test.rb b/test/mailers/comment_mailer_test.rb
new file mode 100644
index 0000000..996d230
--- /dev/null
+++ b/test/mailers/comment_mailer_test.rb
@@ -0,0 +1,7 @@
+require "test_helper"
+
+class CommentMailerTest < ActionMailer::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/mailers/previews/comment_mailer_preview.rb b/test/mailers/previews/comment_mailer_preview.rb
new file mode 100644
index 0000000..d14de05
--- /dev/null
+++ b/test/mailers/previews/comment_mailer_preview.rb
@@ -0,0 +1,3 @@
+# Preview all emails at http://localhost:3000/rails/mailers/comment_mailer
+class CommentMailerPreview < ActionMailer::Preview
+end
Comments
+Add a comment:
+