<p></p>
<p><b>@tomhughes</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4562#discussion_r1532374327">app/assets/javascripts/application.js</a>:</p>
<pre style='color:#555'>> @@ -108,6 +112,7 @@ $(document).ready(function () {
updateHeader();
$(window).resize(updateHeader);
+ document.addEventListener("turbo:render", updateHeader);
</pre>
<p dir="auto">So obviously this comes down to the whether-to-use-jquery question which was briefly mentioned before, but obviously this is using a raw API for something that we have generally done with jquery in the past.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4562#discussion_r1532375169">app/assets/javascripts/messages.js</a>:</p>
<pre style='color:#555'>> });
- $(".inbox-mark-read").on("ajax:success", function (event, data) {
- updateHtml(data);
- updateReadState(this, true);
+ $(".messages-table .message-summary").on("turbo:before-morph-element", function (event) {
+ if (event.target.querySelector("[data-is-destroyed]")) {
</pre>
<p dir="auto">Again this is a raw API where confusingly two lines later it uses jquery instead...</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4562#discussion_r1532380754">app/views/layouts/_head.html.erb</a>:</p>
<pre style='color:#555'>> @@ -2,6 +2,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<%= javascript_include_tag "es6" unless browser.es6? %>
+ <%= javascript_include_tag "turbo", :type => "module" %>
</pre>
<p dir="auto">What was the thinking behind making this a separate include rather than adding it to the application bundle? or is it necessary in order to include it as a module? I confess to not understanding javascript modules and how they interact with other sorts of javascript and rails assets very well...</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4562#discussion_r1532384192">app/views/messages/_message_summary.html.erb</a>:</p>
<pre style='color:#555'>> <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? } %>
</pre>
<p dir="auto">I'm not a fan of <code class="notranslate">:"..."</code> symbols I have to say... Can this be done as <code class="notranslate">:data => { :turbo => true }</code> which I think is how we've normally done data, or does that not work in this context?</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4562#pullrequestreview-1949364479">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLI5WQQW3GVFXO7DFYDYZGYKDAVCNFSM6AAAAABEIVPY5KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSNBZGM3DINBXHE">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLL7LPH6MJ7R5ZW2PSDYZGYKDA5CNFSM6AAAAABEIVPY5KWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTTUGDYP6.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/4562/review/1949364479</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/4562#pullrequestreview-1949364479",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/4562#pullrequestreview-1949364479",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>