2023-08-14 13:05:27 +00:00
|
|
|
<h2>Chats</h2>
|
|
|
|
|
|
|
|
<%= for message <- messages do %>
|
2023-08-21 11:40:48 +00:00
|
|
|
<div class="row" style="margin-bottom: 2px;"
|
|
|
|
id="msg-<%= message.id %>"
|
|
|
|
<%= unless is_nil(message.bookmark) do %>
|
|
|
|
data-bookmark="<%= message.bookmark %>"
|
|
|
|
<% end %>
|
|
|
|
>
|
2023-08-14 13:05:27 +00:00
|
|
|
<div class="card">
|
|
|
|
<div class="card-body" style="padding: 8px;">
|
|
|
|
<blockquote class="blockquote mb-0" style="font-size: 1rem;">
|
2023-08-15 11:06:25 +00:00
|
|
|
<%= BdfrBrowser.RenderUtils.message(message.message) %>
|
2023-08-14 13:05:27 +00:00
|
|
|
|
|
|
|
<footer class="blockquote-footer">
|
2023-08-15 15:36:04 +00:00
|
|
|
<a href="/user/<%= message.author %>"><%= message.author %></a>,
|
2023-08-14 13:05:27 +00:00
|
|
|
<small><%= DateTime.to_iso8601(message.posted_at) %></small>
|
2023-08-21 11:40:48 +00:00
|
|
|
|
|
|
|
<%= unless is_nil(message.bookmark) do %>
|
|
|
|
<span class="badge text-bg-secondary"><%= message.bookmark %></span>
|
|
|
|
<% end %>
|
2023-08-14 13:05:27 +00:00
|
|
|
</footer>
|
|
|
|
</blockquote>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2023-08-21 11:40:48 +00:00
|
|
|
|
|
|
|
<script>
|
|
|
|
const bookmarks = document.querySelectorAll('[data-bookmark]');
|
|
|
|
const header = document.getElementsByTagName('h2')[0];
|
|
|
|
let container = document.createElement('p');
|
|
|
|
|
|
|
|
for (var i = 0; i < bookmarks.length; i++) {
|
|
|
|
let bookmarkElement = document.createElement('a');
|
|
|
|
bookmarkElement.href = `#${bookmarks[i].id}`;
|
|
|
|
bookmarkElement.innerText = bookmarks[i].dataset.bookmark;
|
|
|
|
bookmarkElement.className = "btn btn-secondary btn-sm";
|
|
|
|
bookmarkElement.setAttribute('role', 'button');
|
|
|
|
|
|
|
|
container.appendChild(bookmarkElement);
|
2023-08-21 15:29:46 +00:00
|
|
|
container.appendChild(document.createTextNode(' '));
|
2023-08-21 11:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
header.after(container);
|
|
|
|
</script>
|