]> git.openstreetmap.org Git - rails.git/commitdiff
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 21c717581fb979b3f86aec62008e80c69541c172..8a1bed50848785510dadb6e902e0441430ef7caf 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 075ac6462de78eaa2da850e9ca517adc0a1655fa..fa9e886280780a1cfbefdb4a045b2f84697dba8b 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 ae1386fb2a421f50956a5da97c6fa732aa6acc77..708bdd49d2024eb63e6b8aa7aa4b28c8eaca831b 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 872e31b3aa347c7e27c69b314ea62bbbeb5d347b..d8ca41eafae9c8ac2cc9ce77cbdcfa8c854c3031 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 be2e90b8a537f35d8ed0817e03752760df86a20f..b81d980a529e5172a36e7baf8a92ab72dc4d58a7 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 afc100dc965222056b7c1a282d52e30d125c3cab..f5fe7c325680adceeac0ae763101b87646b80f7d 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"