]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/templates/notes/show.jst.ejs
Add a "Hide" button to notes when viewed by moderators
[rails.git] / app / assets / javascripts / templates / notes / show.jst.ejs
index 028f4d084dd5bd5bdc1e164754c82328718fce57..04cb6dfc13dcfb84683d8fa0239079921aed9247 100644 (file)
@@ -1,16 +1,19 @@
 <div class="note">
-  <h2><%- I18n.t('javascripts.notes.show.title', { id: note.id }) %></h2>
+  <h2><a href="/?note=<%- note.id %>"><%- I18n.t('javascripts.notes.show.title', { id: note.id }) %></a></h2>
+  <% if (note.comments.some(function (comment) { return !comment.user })) { %>
+  <small class="warning"><%- I18n.t('javascripts.notes.show.anonymous_warning') %></small>
+  <% } %>
   <% note.comments.forEach(function (comment) { %>
   <div>
     <small class="deemphasize">
       <% if (comment.user) { %>
-        <%= I18n.t('javascripts.notes.show.event', {
-           action: comment.action, user: comment.user,
-           user_url: comment.user_url, time: comment.date
+        <%= I18n.t('javascripts.notes.show.' + comment.action + '_by', {
+           user: comment.user, user_url: comment.user_url,
+           time: I18n.l("time.formats.long", comment.date)
         }) %>
       <% } else { %>
-        <%- I18n.t('javascripts.notes.show.anonymous_event', {
-           action: comment.action, time: comment.date
+        <%- I18n.t('javascripts.notes.show.' + comment.action + '_by_anonymous', {
+           time: I18n.l("time.formats.long", comment.date)
         }) %>
       <% } %>
     </small>
   <% }) %>
   <% if (note.status == "open") { %>
   <form action="#">
-    <textarea name="text" cols="40" rows="5"></textarea>
+    <textarea class="comment" name="text" cols="40" rows="5"></textarea>
     <br/>
     <div class="buttons">
-      <input type="submit" name="close" value="<%- I18n.t('javascripts.notes.show.close') %>" data-url="<%- note.close_url %>">
-      <input type="submit" name="comment" value="<%- I18n.t('javascripts.notes.show.comment') %>" data-url="<%- note.comment_url %>" disabled="1">
+      <input type="submit" name="hide" value="<%- I18n.t('javascripts.notes.show.hide') %>" class="hide_unless_moderator" data-method="DELETE" data-url="<%- note.url %>">
+      <input type="submit" name="close" value="<%- I18n.t('javascripts.notes.show.resolve') %>" class="hide_unless_logged_in" data-method="POST" data-url="<%- note.close_url %>">
+      <input type="submit" name="comment" value="<%- I18n.t('javascripts.notes.show.comment') %>" data-method="POST" data-url="<%- note.comment_url %>" disabled="1">
     </div>
   </form>
   <% } %>