From: Shrey Date: Fri, 14 Aug 2015 09:24:08 +0000 (+0530) Subject: Added helper + minor UI changes X-Git-Tag: live~3501^2~129 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/916f2c9036d280d1de451e35847d8b37c6550109?ds=sidebyside Added helper + minor UI changes (cherry picked from commit 3a6550ff54eb08ec282d13ebf85dc3461cca2983) --- diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index bcae2e224..92fe74ca7 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -89,4 +89,21 @@ module IssuesHelper end link_to title, params.merge(:sort => column, :direction => direction) end + + def report_type(report_class) + case report_class + when "DiaryEntry" + t('activerecord.models.diary_entry') + when "User" + t('activerecord.models.user') + when "DiaryComment" + t('activerecord.models.diary_comment') + when "Changeset" + t('activerecord.models.changeset') + when "Note" + t('activerecord.models.note') + else + nil + end + end end diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 12cd79b37..340f5ab9b 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -19,13 +19,13 @@ - <%= sortable("status") %> - <%= sortable("report_count", "Number of Reports") %> - <%= sortable("updated_at","Last updated at") %> - <%= sortable("updated_by","Last updated by") %> - Link to reports - <%= sortable("reported_user_id","Reported User") %> - Link to reported instance + <%= sortable("status") %> + <%= sortable("report_count", "Number of Reports") %> + <%= sortable("updated_at","Last updated at") %> + <%= sortable("updated_by","Last updated by") %> + Link to reports + <%= sortable("reported_user_id","Reported User") %> + Link to reported instance @@ -33,7 +33,7 @@ <% @issues.each do |issue| %> <%= issue.status.humanize %> - <%= issue.report_count %> + <%= issue.report_count %> <%= l(issue.updated_at.to_datetime, :format => :friendly) %> <% if issue.user_updated %> <%= issue.user_updated.display_name %> <% else %> - <% end %> <%= reports_url(issue) %> diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 51e179da1..4611324f3 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,6 +1,6 @@ <% content_for :heading do %>

<%= @issue.status.humanize %> Issue #<%= @issue.id %>

-

<%= @issue.reportable_type %> : <%= reportable_url(@issue.reportable) %>

+

<%= report_type(@issue.reportable_type) %> : <%= reportable_url(@issue.reportable) %>

<%= @issue.reports.count %> reports | First reported: <%= l @issue.created_at.to_datetime, :format => :friendly %> <%= "| Last resolved at #{l(@issue.resolved_at.to_datetime, :format =>:friendly)}" if @issue.resolved_at? %> <%= "| Last updated at #{l(@issue.updated_at.to_datetime, :format => :friendly)} by #{@updated_by_admin.display_name}" if @updated_by_admin %>