Add open reports count to admin overview (#13346)
* Add open reports count * Conditionally pluralize open reports copy * Add new scope to FeedbackMessage
This commit is contained in:
parent
8aed81c739
commit
c7e0b496ba
3 changed files with 17 additions and 1 deletions
|
|
@ -1,6 +1,9 @@
|
|||
module Admin
|
||||
class OverviewController < Admin::ApplicationController
|
||||
layout "admin"
|
||||
def index; end
|
||||
def index
|
||||
@open_abuse_reports_count =
|
||||
FeedbackMessage.open_abuse_reports.size
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ class FeedbackMessage < ApplicationRecord
|
|||
CATEGORIES = ["spam", "other", "rude or vulgar", "harassment", "bug", "listings"].freeze
|
||||
STATUSES = %w[Open Invalid Resolved].freeze
|
||||
|
||||
scope :open_abuse_reports, -> { where(status: "Open", feedback_type: "abuse-reports") }
|
||||
|
||||
validates :feedback_type, :message, presence: true
|
||||
validates :reported_url, :category, presence: { if: :abuse_report? }, length: { maximum: 250 }
|
||||
validates :message, length: { maximum: 2500 }
|
||||
|
|
|
|||
|
|
@ -22,6 +22,17 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<h2 class="crayons-subtitle-1 mb-3">Analytics</h2>
|
||||
<article class="grid s:grid-cols-2 gap-3 mb-4" data-controller="ahoy">
|
||||
<section class="crayons-card">
|
||||
<div class="crayons-card__body">
|
||||
<h2 class="crayons-title"><%= @open_abuse_reports_count %></h2>
|
||||
<p class="crayons-subtitle-4 color-base-70">
|
||||
<%= "Open report".pluralize(@open_abuse_reports_count) %>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
<h2 class="crayons-subtitle-1 mb-3">Resources</h2>
|
||||
<article class="grid s:grid-cols-2 gap-3" data-controller="ahoy">
|
||||
<section class="crayons-card">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue