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

Gregory Igelmund notifications at github.com
Wed Mar 20 16:52:56 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? } %>

🤔 I think in this context it should work as long as the `:data => { :turbo => true }`-structure is passed into the `:form => …`-key.

This would be:

```
:form => { :data => { :turbo => true }, :class => "inbox-mark-unread", …
```

I deliberately wanted to avoid more nesting in the hash structure, but I'd prefer to keep it consistent with the pre-existing style in the project. I'll have a look for other places in the partials and will report back.

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

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


More information about the rails-dev mailing list