UX: Rename FAQ to Guidelines (#27451)

This commit is contained in:
Jan Cernik 2024-06-13 12:09:53 -03:00 committed by GitHub
parent fe00796027
commit d7ece61252
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 45 additions and 8 deletions

View File

@ -1,10 +1,13 @@
import Controller from "@ember/controller";
import { gt } from "@ember/object/computed";
import { alias, gt } from "@ember/object/computed";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
export default Controller.extend({
faqOverridden: gt("siteSettings.faq_url.length", 0),
renameFaqToGuidelines: alias(
"siteSettings.experimental_rename_faq_to_guidelines"
),
@discourseComputed("model.contact_url", "model.contact_email")
contactInfo(url, email) {

View File

@ -2,12 +2,18 @@ import BaseSectionLink from "discourse/lib/sidebar/base-community-section-link";
import I18n from "discourse-i18n";
export default class FAQSectionLink extends BaseSectionLink {
get renameToGuidelines() {
return (
this.siteSettings.experimental_rename_faq_to_guidelines && !this.href
);
}
get name() {
return "faq";
return this.renameToGuidelines ? "guidelines" : "faq";
}
get route() {
return "faq";
return this.renameToGuidelines ? "guidelines" : "faq";
}
get href() {
@ -15,13 +21,19 @@ export default class FAQSectionLink extends BaseSectionLink {
}
get title() {
return I18n.t("sidebar.sections.community.links.faq.title");
if (this.renameToGuidelines) {
return I18n.t("sidebar.sections.community.links.guidelines.title");
} else {
return I18n.t("sidebar.sections.community.links.faq.title");
}
}
get text() {
const name = this.renameToGuidelines ? "Guidelines" : this.overridenName;
return I18n.t(
`sidebar.sections.community.links.${this.overridenName.toLowerCase()}.content`,
{ defaultValue: this.overridenName }
`sidebar.sections.community.links.${name.toLowerCase()}.content`,
{ defaultValue: name }
);
}

View File

@ -15,6 +15,10 @@
<li class="nav-item-faq"><LinkTo @route="faq">{{i18n
"faq"
}}</LinkTo></li>
{{else if this.renameFaqToGuidelines}}
<li class="nav-item-guidelines"><LinkTo @route="guidelines">{{i18n
"guidelines"
}}</LinkTo></li>
{{else}}
<li class="nav-item-faq"><LinkTo @route="faq">{{i18n
"faq"

View File

@ -67,6 +67,7 @@ class StaticController < ApplicationController
@title = "#{title_prefix} - #{SiteSetting.title}"
@body = @topic.posts.first.cooked
@faq_overridden = !SiteSetting.faq_url.blank?
@experimental_rename_faq_to_guidelines = SiteSetting.experimental_rename_faq_to_guidelines
render :show, layout: !request.xhr?, formats: [:html]
return

View File

@ -13,7 +13,7 @@
</li>
<li itemscope itemtype='http://schema.org/SiteNavigationElement'>
<span itemprop='name'>
<a href='<%= path "/guidelines" %>' itemprop="url"><%= t 'guidelines_topic.title' %> </a>
<a href='<%= path "/guidelines" %>' itemprop="url"><%= t 'guidelines_topic.guidelines_title' %> </a>
</span>
</li>
<% if tos_url.present? %>

View File

@ -6,6 +6,8 @@
<% if @faq_overridden %>
<li class='nav-item-guidelines'><a class='<%= @page == 'faq' ? 'active' : '' %>' href='<%= guidelines_path %>'><%= t 'js.guidelines' %></a></li>
<li class='nav-item-faq'><a href='<%= faq_path %>'><%= t 'js.faq' %></a></li>
<% elsif @experimental_rename_faq_to_guidelines %>
<li class='nav-item-guidelines'><a class='<%= @page == 'faq' ? 'active' : '' %>' href='<%=guidelines_path%>'><%= t 'js.guidelines' %></a></li>
<% else %>
<li class='nav-item-faq'><a class='<%= @page == 'faq' ? 'active' : '' %>' href='<%=faq_path%>'><%= t 'js.faq' %></a></li>
<% end %>

View File

@ -4772,6 +4772,9 @@ en:
faq:
content: "FAQ"
title: "Guidelines for using this site"
guidelines:
content: "Guidelines"
title: "Guidelines for using this site"
groups:
content: "Groups"
title: "List of available user groups"

View File

@ -4624,6 +4624,7 @@ en:
guidelines_topic:
title: "FAQ/Guidelines"
guidelines_title: "Guidelines"
body: |
<a name="civilized"></a>

View File

@ -2455,6 +2455,10 @@ legal:
default: ""
log_anonymizer_details:
default: true
experimental_rename_faq_to_guidelines:
default: false
hidden: true
client: true
backups:
enable_backups:

View File

@ -90,7 +90,14 @@ module SeedData
# FAQ/Guidelines
topics << {
site_setting_name: "guidelines_topic_id",
title: I18n.t("guidelines_topic.title"),
title:
(
if SiteSetting.experimental_rename_faq_to_guidelines
I18n.t("guidelines_topic.guidelines_title")
else
I18n.t("guidelines_topic.title")
end
),
raw:
I18n.t(
"guidelines_topic.body",