diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index c54f3a9d..ed6c6c98 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -36,7 +36,7 @@ class MainController < ApplicationController .order('id DESC') .limit(300) .shuffle - .first(3) + .first(8) # Increased from 3 to 8 for the ticker @most_recent_threads = Thredded::Topic.where(id: most_recent_posts.pluck(:postable_id)) .where(moderation_state: "approved") .includes(:posts, :messageboard) diff --git a/app/views/main/dashboard.html.erb b/app/views/main/dashboard.html.erb index 8d4103f5..f4fbf6e3 100644 --- a/app/views/main/dashboard.html.erb +++ b/app/views/main/dashboard.html.erb @@ -545,6 +545,50 @@ <% end %> + + <% if @most_recent_threads && @most_recent_threads.any? %> +
+
+

+ forum + Trending Conversations +

+ <%= link_to thredded.messageboards_path, class: "text-xs text-blue-600 hover:text-blue-700 font-medium" do %> + View all → + <% end %> +
+ + +
+ <% @most_recent_threads.first(8).each do |thread| %> + <%= link_to thredded.messageboard_topic_path(thread.messageboard, thread), + class: "group relative overflow-hidden bg-white hover:bg-gray-50 rounded-lg p-3 transition-all duration-200 hover:shadow-md border border-gray-200 hover:border-gray-300", + data: { turbo: false } do %> + + +

+ <%= thread.title %> +

+ + +
+
+ + chat_bubble_outline + <%= thread.posts.count %> + + + + <%= time_ago_in_words(thread.updated_at).gsub('about ', '').gsub('less than a ', '1').gsub(' ago', '') %> + +
+
+ <% end %> + <% end %> +
+
+ <% end %> +