]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/diary_entries/_diary_comment.html.erb
Merge remote-tracking branch 'upstream/pull/4705'
[rails.git] / app / views / diary_entries / _diary_comment.html.erb
index 4ac9a0f967f1950dbe6e86f98b8a9d2c1f7e5a42..5ade361aa1ac66ff90f0f70f1981a0e94a5f4637 100644 (file)
@@ -1,15 +1,23 @@
-<div class="clearfix diary-comment">
-  <%= user_thumbnail diary_comment.user %>
-  <p class="deemphasize comment-heading" id="comment<%= diary_comment.id %>"><%= raw(t('.comment_from', :link_user => (link_to h(diary_comment.user.display_name), user_path(diary_comment.user)), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}"))) %>
-    <% if current_user and diary_comment.user.id != current_user.id %>
-      | <%= report_link(t(".report"), diary_comment) %>
-    <% end %>
-  </p>
+<div class="row diary-comment border-bottom py-3<%= " text-muted bg-danger bg-opacity-10" unless diary_comment.visible? %>">
+  <div class="col-auto pe-0 text-center">
+    <%= user_thumbnail diary_comment.user %>
+  </div>
+  <div class="col">
+    <p class="text-muted m-0" id="comment<%= diary_comment.id %>"><%= t(".comment_from_html", :link_user => (link_to diary_comment.user.display_name, diary_comment.user), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}")) %>
+      <% if current_user and diary_comment.user.id != current_user.id %>
+        | <%= report_link(t(".report"), diary_comment) %>
+      <% end %>
+    </p>
 
-  <div class="richtext"><%= diary_comment.body.to_html %></div>
-  <% if current_user && current_user.administrator? %>
-    <span>
-      <%= link_to t('.hide_link'), hide_diary_comment_path(:display_name => diary_comment.diary_entry.user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id), :method => :post, :data=> { :confirm => t('.confirm') } %>
-    </span>
-  <% end %>
+    <div class="richtext text-break"><%= diary_comment.body.to_html %></div>
+    <% if can? :hidecomment, DiaryEntry %>
+      <span>
+        <% if diary_comment.visible? %>
+          <%= link_to t(".hide_link"), hide_diary_comment_path(diary_comment.diary_entry.user, diary_comment.diary_entry, diary_comment), :method => :post, :data => { :confirm => t(".confirm") } %>
+        <% else %>
+          <%= link_to t(".unhide_link"), unhide_diary_comment_path(diary_comment.diary_entry.user, diary_comment.diary_entry, diary_comment), :method => :post, :data => { :confirm => t(".confirm") } %>
+        <% end %>
+      </span>
+    <% end %>
+  </div>
 </div>