Added helper + minor UI changes

(cherry picked from commit 3a6550ff54eb08ec282d13ebf85dc3461cca2983)
This commit is contained in:
Shrey 2015-08-14 14:54:08 +05:30 committed by Matt Amos
parent 81b6599830
commit 916f2c9036
3 changed files with 26 additions and 9 deletions

View file

@ -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

View file

@ -19,13 +19,13 @@
<thead>
<tr>
<tr>
<td><b> <%= sortable("status") %></b></td>
<td><b> <%= sortable("report_count", "Number of Reports") %></b></td>
<td><b> <%= sortable("updated_at","Last updated at") %></b></td>
<td><b> <%= sortable("updated_by","Last updated by") %></b></td>
<td><b> Link to reports </b></td>
<td><b> <%= sortable("reported_user_id","Reported User") %> </b></td>
<td><b> Link to reported instance</b></td>
<td style="width:40px;"><b> <%= sortable("status") %></b></td>
<td style="width:160px;"><b> <%= sortable("report_count", "Number of Reports") %></b></td>
<td style="width:141px;"><b> <%= sortable("updated_at","Last updated at") %></b></td>
<td style="width:140px;"><b> <%= sortable("updated_by","Last updated by") %></b></td>
<td style="width:203px;"><b> Link to reports </b></td>
<td style="width:128px;"><b> <%= sortable("reported_user_id","Reported User") %> </b></td>
<td style="width:67px;"><b> Link to reported instance</b></td>
</tr>
</tr>
</thead>
@ -33,7 +33,7 @@
<% @issues.each do |issue| %>
<tr>
<td><%= issue.status.humanize %></td>
<td><%= issue.report_count %></td>
<td style="text-align:center;"><%= issue.report_count %></td>
<td><%= l(issue.updated_at.to_datetime, :format => :friendly) %></td>
<td><% if issue.user_updated %> <%= issue.user_updated.display_name %> <% else %> - <% end %></td>
<td> <%= reports_url(issue) %></td>

View file

@ -1,6 +1,6 @@
<% content_for :heading do %>
<h2> <%= @issue.status.humanize %> Issue #<%= @issue.id %> <br/></h2>
<p><%= @issue.reportable_type %> : <%= reportable_url(@issue.reportable) %></p>
<p><%= report_type(@issue.reportable_type) %> : <%= reportable_url(@issue.reportable) %></p>
<p class="deemphasize">
<small>
<%= @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 %>