about summary refs log tree commit diff
path: root/app/views/admin/reports/show.html.haml
diff options
context:
space:
mode:
authorEmelia Smith <ThisIsMissEm@users.noreply.github.com>2018-04-10 20:27:59 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-04-10 20:27:59 +0200
commitd9b62e34da0c0238176f27557ac7b953da94df7e (patch)
tree57b5f3ee1e3ad6ef1942d5df9d6fff2a7b16422c /app/views/admin/reports/show.html.haml
parent45c9f16f714dd6de15391b5e2ae2bf0d30ef20fb (diff)
Feature: Improve reports ui (#7032)
* Further improvements to Reports UI

- Clean up notes display
- Clean up add new note form
- Simplify controller
- Allow reopening a report with a note
- Show created at date for reports
- Fix report details table formatting

* Show history of report using Admin::ActionLog beneath the report

* Fix incorrect log message when reopening a report

* Implement fetching of all ActionLog items that could be related to the report

* Ensure adding a report_note updates the report's updated_at

* Limit Report History to actions that happened between the report being created and the report being resolved

* Fix linting issues

* Improve report history builder

Thanks @gargron for the improvements
Diffstat (limited to 'app/views/admin/reports/show.html.haml')
-rw-r--r--app/views/admin/reports/show.html.haml47
1 files changed, 31 insertions, 16 deletions
diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml
index e7634a034..d57b4adc8 100644
--- a/app/views/admin/reports/show.html.haml
+++ b/app/views/admin/reports/show.html.haml
@@ -5,7 +5,7 @@
   = t('admin.reports.report', id: @report.id)
 
 %div{ style: 'overflow: hidden; margin-bottom: 20px' }
-  - if !@report.action_taken?
+  - if @report.unresolved?
     %div{ style: 'float: right' }
       = link_to t('admin.reports.silence_account'), admin_report_path(@report, outcome: 'silence'), method: :put, class: 'button'
       = link_to t('admin.reports.suspend_account'), admin_report_path(@report, outcome: 'suspend'), method: :put, class: 'button'
@@ -18,21 +18,28 @@
   %table.table.inline-table
     %tbody
       %tr
+        %th= t('admin.reports.created_at')
+        %td{colspan: 2}
+          %time.formatted{ datetime: @report.created_at.iso8601 }
+      %tr
         %th= t('admin.reports.updated_at')
         %td{colspan: 2}
           %time.formatted{ datetime: @report.updated_at.iso8601 }
       %tr
         %th= t('admin.reports.status')
-        %td{colspan: 2}
+        %td
           - if @report.action_taken?
             = t('admin.reports.resolved')
-            = table_link_to 'envelope-open', t('admin.reports.reopen'), admin_report_path(@report, outcome: 'reopen'), method: :put
           - else
             = t('admin.reports.unresolved')
+        %td{style: "text-align: right; overflow: hidden;"}
+          - if @report.action_taken?
+            = table_link_to 'envelope-open', t('admin.reports.reopen'), admin_report_path(@report, outcome: 'reopen'), method: :put
       - if !@report.action_taken_by_account.nil?
         %tr
           %th= t('admin.reports.action_taken_by')
-          %td= @report.action_taken_by_account.acct
+          %td{colspan: 2}
+            = @report.action_taken_by_account.acct
       - else
         %tr
           %th= t('admin.reports.assigned')
@@ -47,6 +54,8 @@
             - if !@report.assigned_account.nil?
               = table_link_to 'trash', t('admin.reports.unassign'), admin_report_path(@report, outcome: 'unassign'), method: :put
 
+%hr{ class: "section-break"}/
+
 .report-accounts
   .report-accounts__item
     %h3= t('admin.reports.reported_account')
@@ -88,22 +97,28 @@
           = link_to admin_report_reported_status_path(@report, status), method: :delete, class: 'icon-button trash-button', title: t('admin.reports.delete'), data: { confirm: t('admin.reports.are_you_sure') }, remote: true do
             = fa_icon 'trash'
 
-%hr/
+%hr{ class: "section-break"}/
 
 %h3= t('admin.reports.notes.label')
 
 - if @report_notes.length > 0
-  .table-wrapper
-    %table.table
-      %thead
-        %tr
-          %th
-      %tbody
-        = render @report_notes
+  %ul
+    = render @report_notes
 
-= simple_form_for @report_note, url: admin_report_notes_path do |f|
+%h4= t('admin.reports.notes.new_label')
+= form_for @report_note, url: admin_report_notes_path, html: { class: 'report-note__form' } do |f|
   = render 'shared/error_messages', object: @report_note
-  = f.input :content
+  = f.text_area :content, placeholder: t('admin.reports.notes.placeholder'), rows: 6, class: 'report-note__textarea'
   = f.hidden_field :report_id
-  = f.button :button, t('admin.reports.notes.create'), type: :submit
-  = f.button :button, t('admin.reports.notes.create_and_resolve'), type: :submit, name: :create_and_resolve
+  %div{ class: 'report-note__buttons' }
+    - if @report.unresolved?
+      = f.submit t('admin.reports.notes.create_and_resolve'), name: :create_and_resolve, class: 'button report-note__button'
+    - else
+      = f.submit t('admin.reports.notes.create_and_unresolve'), name: :create_and_unresolve, class: 'button report-note__button'
+    = f.submit t('admin.reports.notes.create'), class: 'button report-note__button'
+
+- if @report_history.length > 0
+  %h3= t('admin.reports.history')
+
+  %ul
+    = render @report_history