diff --git a/app/javascript/application.js b/app/javascript/application.js index c275ea8..240bbba 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,2 +1,4 @@ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails +import "@hotwired/turbo-rails" import "controllers" +import "@hotwired/turbo-rails" diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 900d72b..4a0aea6 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -34,7 +34,7 @@ -
+
<%= yield %>
diff --git a/app/views/messages/_thread.html.erb b/app/views/messages/_thread.html.erb index 40d891d..1655865 100644 --- a/app/views/messages/_thread.html.erb +++ b/app/views/messages/_thread.html.erb @@ -1,17 +1,17 @@
data-controller="thread"<% end %>> <% if depth == 0 %>
-
data-action="click->thread#toggle"<% end %>> +

<% if message.children&.any? %> - + <% end %> [#<%= message.list_seq %>] - <%= link_to without_list_prefix(message.subject), "/#{list.name}/#{message.list_seq}", data: {action: 'click->thread#toggle:stop'} %> + <%= link_to without_list_prefix(message.subject), "/#{list.name}/#{message.list_seq}", data: {turbo_frame: 'message_content'} %> — <%= message.from %>

@@ -33,7 +33,7 @@
- <%= link_to "/#{list.name}/#{message.list_seq}", class: "text-gray-900 dark:text-gray-100 hover:text-red-600 dark:hover:text-red-400 transition-colors" do %> + <%= link_to "/#{list.name}/#{message.list_seq}", class: 'text-gray-900 dark:text-gray-100 hover:text-red-600 dark:hover:text-red-400 transition-colors', data: {turbo_frame: 'message_content'} do %> [#<%= message.list_seq %>] <%= without_list_prefix(message.subject) %> <% end %> — <%= message.from %> diff --git a/app/views/messages/index.html.erb b/app/views/messages/index.html.erb index d05f22f..7990fe0 100644 --- a/app/views/messages/index.html.erb +++ b/app/views/messages/index.html.erb @@ -6,11 +6,26 @@
<% end %> -
+

<%= @list.name %>

Mailing list archive

-
- <%= render partial: 'thread', collection: @messages, as: :message, locals: {list: @list, depth: 0} %> +
+
+ <%= render partial: 'thread', collection: @messages, as: :message, locals: {list: @list, depth: 0} %> +
+ +
+ <%= turbo_frame_tag "message_content", class: "block" do %> +
+
+ + + +

Select a message to view

+
+
+ <% end %> +
diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index 9001a04..31e7f66 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -1,13 +1,11 @@ <% content_for :title, @message.subject %> -<% if notice %> -
- <%= notice %> -
-<% end %> - -
- <%= link_to "← Back to #{@message.list.name}", "/#{@message.list.name}/", class: "text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 font-medium" %> -
+<%= turbo_frame_tag 'message_content' do %> + <% if notice %> +
+ <%= notice %> +
+ <% end %> -<%= render @message %> + <%= render @message %> +<% end %> diff --git a/config/importmap.rb b/config/importmap.rb index cded577..cb0480c 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -4,3 +4,4 @@ pin "@hotwired/stimulus", to: "stimulus.min.js" pin "@hotwired/stimulus-loading", to: "stimulus-loading.js" pin_all_from "app/javascript/controllers", under: "controllers" +pin "@hotwired/turbo-rails", to: "turbo.min.js"