Create a report_link helper, and use text instead of a flag icon
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 21 Mar 2018 09:14:56 +0000 (17:14 +0800)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 28 Mar 2018 03:05:46 +0000 (11:05 +0800)
app/controllers/reports_controller.rb
app/helpers/reports_helper.rb [new file with mode: 0644]
app/views/browse/note.html.erb
app/views/diary_entry/_diary_comment.html.erb
app/views/diary_entry/_diary_entry.html.erb
app/views/user/view.html.erb
config/locales/en.yml

index 21c7175..8a1bed5 100644 (file)
@@ -29,7 +29,7 @@ class ReportsController < ApplicationController
   private
 
   def required_new_report_params_present?
-    create_new_report_params['reportable_id'].present? && create_new_report_params['reportable_type'].present?
+    create_new_report_params["reportable_id"].present? && create_new_report_params["reportable_type"].present?
   end
 
   def create_new_report_params
diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb
new file mode 100644 (file)
index 0000000..70c9ada
--- /dev/null
@@ -0,0 +1,5 @@
+module ReportsHelper
+  def report_link(name, reportable)
+    link_to name, new_report_url(:reportable_id => reportable.id, :reportable_type => reportable.class.name)
+  end
+end
index 075ac64..fa9e886 100644 (file)
       <br/>
       <%= note_event(@note.status, @note.closed_at, @note_comments.last.author) %>
     <% end %>
-    <% if current_user && current_user != @note.author %>
-      <%= link_to new_report_url(reportable_id: @note.id, reportable_type: @note.class.name), :title => t('browse.note.report') do %>
-          &nbsp;&#9872;
-      <% end %>
-    <% end %>
   </div>
 
   <% if @note_comments.find { |comment| comment.author.nil? } -%>
     <p class='warning'><%= t "javascripts.notes.show.anonymous_warning" %></p>
   <% end -%>
 
+  <% if current_user && current_user != @note.author %>
+    <p class="deemphasize"><%= report_link(t(".report"), @note) %></p>
+  <% end %>
+
   <% if @note_comments.length > 1 %>
     <div class='note-comments'>
       <ul>
index ae1386f..708bdd4 100644 (file)
@@ -2,9 +2,7 @@
   <%= user_thumbnail diary_comment.user %>
   <p class="deemphasize comment-heading" id="comment<%= diary_comment.id %>"><%= raw(t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :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 %>
-      <%= link_to new_report_url(reportable_id: diary_comment.id, reportable_type: diary_comment.class.name), :title => t('diary_entry.diary_comment.report') do %>
-              &nbsp;&#9872;
-      <% end %>
+      | <%= report_link(t(".report"), diary_comment) %>
     <% end %>
   </p>
 
index 872e31b..d8ca41e 100644 (file)
@@ -6,12 +6,6 @@
 
     <h2><%= link_to h(diary_entry.title), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id %></h2>
 
-    <% if current_user and diary_entry.user != current_user %>
-           <%= link_to new_report_url(reportable_id: diary_entry.id, reportable_type: diary_entry.class.name), :title => t('diary_entry.diary_entry.report') do %>
-            &nbsp;&#9872;
-          <% end %>
-    <% end %>
-
     <small class='deemphasize'>
       <%= raw(t 'diary_entry.diary_entry.posted_by', :link_user => (link_to h(diary_entry.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_entry.user.display_name), :created => l(diary_entry.created_at, :format => :blog), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entry', :action => 'list', :display_name => nil, :language => diary_entry.language_code)) %>
     </small>
       <%= link_to t('diary_entry.diary_entry.edit_link'), :action => 'edit', :display_name => diary_entry.user.display_name, :id => diary_entry.id %>
     <% end %>
 
+    <% if current_user and diary_entry.user != current_user %>
+      <li>
+        <%= report_link(t(".report"), diary_entry) %>
+      </li>
+    <% end %>
+
     <%= if_administrator(:li) do %>
       <%= link_to t('diary_entry.diary_entry.hide_link'), hide_diary_entry_path(:display_name => diary_entry.user.display_name, :id => diary_entry.id), :method => :post, :data => { :confirm => t('diary_entry.diary_entry.confirm') } %>
     <% end %>
index be2e90b..b81d980 100644 (file)
 
           <% if current_user and @this_user.id != current_user.id %>
             <li>
-              <%= link_to new_report_url(reportable_id: @this_user.id, reportable_type: @this_user.class.name), :title => t('user.view.report') do %>
-                &nbsp;&#9872;
-              <% end %>
+              <%= report_link(t(".report"), @this_user) %>
             </li>
           <% end %>
         </ul>
index afc100d..f5fe7c3 100644 (file)
@@ -207,7 +207,7 @@ en:
       reopened_by: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
       reopened_by_anonymous: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
       hidden_by: "Hidden by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
-      report: Report this note?
+      report: Report this note
     query:
       title: "Query Features"
       introduction: "Click on the map to find nearby features."
@@ -298,12 +298,12 @@ en:
       edit_link: Edit this entry
       hide_link: Hide this entry
       confirm: Confirm
-      report: Report this entry?
+      report: Report this entry
     diary_comment:
       comment_from: "Comment from %{link_user} on %{comment_created_at}"
       hide_link: Hide this comment
       confirm: Confirm
-      report: Report this comment?
+      report: Report this comment
     location:
       location: "Location:"
       view: "View"
@@ -2061,7 +2061,7 @@ en:
       friends_diaries: "friends' diary entries"
       nearby_changesets: "nearby user changesets"
       nearby_diaries: "nearby user diary entries"
-      report: "Report this user?"
+      report: Report this User
     popup:
       your location: "Your location"
       nearby mapper: "Nearby mapper"