Added helper + minor UI changes
authorShrey <shrey14099@iiitd.ac.in>
Fri, 14 Aug 2015 09:24:08 +0000 (14:54 +0530)
committerMatt Amos <zerebubuth@gmail.com>
Mon, 22 Aug 2016 15:18:15 +0000 (16:18 +0100)
(cherry picked from commit 3a6550ff54eb08ec282d13ebf85dc3461cca2983)

app/helpers/issues_helper.rb
app/views/issues/index.html.erb
app/views/issues/show.html.erb

index bcae2e2..92fe74c 100644 (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
index 12cd79b..340f5ab 100644 (file)
        <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>
index 51e179d..4611324 100644 (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 %>