FEATURE: alows to add a description link to a report (#9065)

This commit adds a description link to users_per_trust_level report linking to our blog  article on the subject https://blog.discourse.org/2018/06/understanding-discourse-trust-levels/
This commit is contained in:
Joffrey JAFFEUX 2020-03-02 20:30:51 +01:00 committed by GitHub
parent c11e5eb042
commit 11425f8adc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 3 deletions

View File

@ -21,6 +21,8 @@ const Report = EmberObject.extend({
average: false,
percent: false,
higher_is_better: true,
description_link: null,
description: null,
@discourseComputed("type", "start_date", "end_date")
reportUrl(type, start_date, end_date) {

View File

@ -23,9 +23,15 @@
</a>
{{#if model.description}}
<span class="info" data-tooltip="{{model.description}}">
{{d-icon "question-circle"}}
</span>
{{#if model.description_link}}
<a target="_blank" rel="noopener" href="{{model.description_link}}" class="info" data-tooltip="{{model.description}}">
{{d-icon "question-circle"}}
</a>
{{else}}
<span class="info" data-tooltip="{{model.description}}">
{{d-icon "question-circle"}}
</span>
{{/if}}
{{/if}}
</li>
{{/unless}}

View File

@ -11,11 +11,13 @@ class Admin::ReportsController < Admin::AdminController
reports = reports_methods.map do |name|
type = name.to_s.gsub('report_', '')
description = I18n.t("reports.#{type}.description", default: '')
description_link = I18n.t("reports.#{type}.description_link", default: '')
{
type: type,
title: I18n.t("reports.#{type}.title"),
description: description.presence ? description : nil,
description_link: description_link.presence ? description_link : nil
}
end

View File

@ -99,12 +99,15 @@ class Report
def as_json(options = nil)
description = I18n.t("reports.#{type}.description", default: "")
description_link = I18n.t("reports.#{type}.description_link", default: "")
{
type: type,
title: I18n.t("reports.#{type}.title", default: nil),
xaxis: I18n.t("reports.#{type}.xaxis", default: nil),
yaxis: I18n.t("reports.#{type}.yaxis", default: nil),
description: description.presence ? description : nil,
description_link: description_link.presence ? description_link : nil,
data: data,
start_date: start_date&.iso8601,
end_date: end_date&.iso8601,

View File

@ -1175,6 +1175,7 @@ en:
labels:
level: Level
description: "Number of users grouped by trust level."
description_link: "https://blog.discourse.org/2018/06/understanding-discourse-trust-levels/"
users_by_type:
title: "Users per Type"
xaxis: "Type"