[openstreetmap/openstreetmap-website] Add Turbo to replace custom JS (PR #4562)

Gregory Igelmund notifications at github.com
Wed Mar 20 19:23:27 UTC 2024


@grekko commented on this pull request.



>    <td><%= link_to message_summary.sender.display_name, user_path(message_summary.sender) %></td>
   <td><%= link_to message_summary.title, message_path(message_summary) %></td>
   <td class="text-nowrap"><%= l message_summary.sent_on, :format => :friendly %></td>
   <td class="text-nowrap d-flex justify-content-end gap-1">
-    <%= button_to t(".unread_button"), message_mark_path(message_summary, :mark => "unread"), :remote => true, :class => "btn btn-sm btn-primary", :form => { :class => "inbox-mark-unread", :hidden => !message_summary.message_read? } %>
-    <%= button_to t(".read_button"), message_mark_path(message_summary, :mark => "read"), :remote => true, :class => "btn btn-sm btn-primary", :form => { :class => "inbox-mark-read", :hidden => message_summary.message_read? } %>
-    <%= button_to t(".destroy_button"), message_path(message_summary, :referer => request.fullpath), :method => :delete, :remote => true, :class => "btn btn-sm btn-danger", :form_class => "inbox-destroy" %>
+    <%= button_to t(".unread_button"), message_mark_path(message_summary, :mark => "unread"), :class => "btn btn-sm btn-primary", :form => { :"data-turbo" => true, :class => "inbox-mark-unread", :hidden => !message_summary.message_read? } %>

In other templates similar attributes are nested like `:data => { :foo => "bar" }`, e.g. here:

- https://github.com/openstreetmap/openstreetmap-website/blob/8da80ff471f7d04984ff5abab0c5fe32920330ba/app/views/layouts/_search.html.erb#L24
- https://github.com/openstreetmap/openstreetmap-website/blob/8da80ff471f7d04984ff5abab0c5fe32920330ba/app/views/traces/show.html.erb#L66
… and more places.

So for consistency reasons I agree to nest the data-attributes here, too. See 2a2a317

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4562#discussion_r1532714704
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/4562/review/1949919385 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240320/119cfbd5/attachment-0001.htm>


More information about the rails-dev mailing list