diff --git a/app/controllers/admin/configs_controller.rb b/app/controllers/admin/configs_controller.rb index 0ac8f1ae7..1e2867866 100644 --- a/app/controllers/admin/configs_controller.rb +++ b/app/controllers/admin/configs_controller.rb @@ -14,6 +14,8 @@ module Admin COMMUNITY_PARAMS = %i[ community_name + collective_noun + collective_noun_disabled community_description community_member_label community_copyright_start_year diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c9f02f08e..6bfc13eea 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -185,7 +185,9 @@ module ApplicationHelper end def community_qualified_name - "#{community_name} Community" + return "#{community_name} #{SiteConfig.collective_noun}" unless SiteConfig.collective_noun_disabled + + community_name end def release_adjusted_cache_key(path) diff --git a/app/javascript/admin/controllers/config_controller.js b/app/javascript/admin/controllers/config_controller.js index 3242d32f7..d7b3fd304 100644 --- a/app/javascript/admin/controllers/config_controller.js +++ b/app/javascript/admin/controllers/config_controller.js @@ -3,19 +3,27 @@ import { Controller } from 'stimulus'; const recaptchaFields = document.querySelector('#recaptchaContainer'); export default class ConfigController extends Controller { - static targets = ['inviteOnlyMode', 'authenticationProviders', 'requireCaptchaForEmailPasswordRegistration']; + static targets = [ + 'authenticationProviders', + 'collectiveNoun', + 'requireCaptchaForEmailPasswordRegistration', + ]; - disableAuthenticationOptions() { - if (this.inviteOnlyModeTarget.checked) { - this.authenticationProvidersTarget.disabled = true; + disableTargetField(event) { + const targetElementName = event.target.dataset.disableTarget; + const targetElement = this[`${targetElementName}Target`]; + const newValue = event.target.checked; + targetElement.disabled = newValue; + + // Disable the button generated by ERB for select tags + if (targetElement.nodeName === 'SELECT') { + const snakeCaseName = targetElementName.replace( + /[A-Z]/g, + (letter) => `_${letter.toLowerCase()}`, + ); document.querySelector( - 'button[data-id=site_config_authentication_providers]', - ).disabled = true; - } else { - this.authenticationProvidersTarget.disabled = false; - document.querySelector( - 'button[data-id=site_config_authentication_providers]', - ).disabled = false; + `button[data-id=site_config_${snakeCaseName}]`, + ).disabled = newValue; } } diff --git a/app/lib/constants/site_config.rb b/app/lib/constants/site_config.rb index 15f44cf15..7aefce1a7 100644 --- a/app/lib/constants/site_config.rb +++ b/app/lib/constants/site_config.rb @@ -49,6 +49,10 @@ module Constants description: "https://url.com/lander", placeholder: "URL campaign sidebar image will link to" }, + collective_noun: { + description: "Used to describe your collective identity.", + placeholder: "Herd" + }, community_copyright_start_year: { description: "Used to mark the year this forem was started.", placeholder: Time.zone.today.year.to_s diff --git a/app/mailers/devise_mailer.rb b/app/mailers/devise_mailer.rb index 3d9b655ff..da1c85e18 100644 --- a/app/mailers/devise_mailer.rb +++ b/app/mailers/devise_mailer.rb @@ -2,7 +2,8 @@ class DeviseMailer < Devise::Mailer before_action :use_site_config_values def use_site_config_values - Devise.mailer_sender = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>" + Devise.mailer_sender = + "#{SiteConfig.community_name} #{SiteConfig.collective_noun} <#{SiteConfig.email_addresses[:default]}>" ActionMailer::Base.default_url_options[:host] = SiteConfig.app_domain end end diff --git a/app/models/site_config.rb b/app/models/site_config.rb index cdd59a392..fca2f407a 100644 --- a/app/models/site_config.rb +++ b/app/models/site_config.rb @@ -48,6 +48,8 @@ class SiteConfig < RailsSettings::Base # Community Content field :community_name, type: :string, default: ApplicationConfig["COMMUNITY_NAME"] || "New Forem" + field :collective_noun, type: :string, default: "Community" + field :collective_noun_disabled, type: :boolean, default: false field :community_description, type: :string field :community_member_label, type: :string, default: "user" field :tagline, type: :string diff --git a/app/views/admin/configs/show.html.erb b/app/views/admin/configs/show.html.erb index 22559633e..f2045b8cb 100644 --- a/app/views/admin/configs/show.html.erb +++ b/app/views/admin/configs/show.html.erb @@ -141,7 +141,7 @@
- Thank you for supporting the <%= community_name %> Community! Here’s what to expect with a Bronze Sponsorship: + Thank you for supporting the <%= community_qualified_name %>! Here’s what to expect with a Bronze Sponsorship:
- As a Bronze sponsor, you will receive special flair that lives on your organization page. This visual cue will show the <%= community_name %> Community and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community. + As a Bronze sponsor, you will receive special flair that lives on your organization page. This visual cue will show the <%= community_qualified_name %> and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community.
<% if user_signed_in? %>-As a Gold sponsor, you will receive special flair that lives on your organization page. This visual cue will show the <%= community_name %> Community and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community. +As a Gold sponsor, you will receive special flair that lives on your organization page. This visual cue will show the <%= community_qualified_name %> and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community.
<% unless user_signed_in? %>- As a Silver sponsor, you will receive special flair that lives on your organization page. This visual cue will show the <%= community_name %> Community and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community. + As a Silver sponsor, you will receive special flair that lives on your organization page. This visual cue will show the <%= community_qualified_name %> and broader ecosystem that you are an important community supporter, providing a natural draw for increased engagement on the platform. And, of course, you’ll have bragging rights and company pride knowing that you’re supporting a wonderful community.
<% if user_signed_in? %>- Members of the <%= community_name %> Community head to the dedicated tags page to explore new areas of the site, and to manage which tags they follow. Your company will be listed as a sponsor directly alongside the tag you support. This placement provides visibility to all members, even if they don’t directly engage within your tag. + Members of the <%= community_qualified_name %> head to the dedicated tags page to explore new areas of the site, and to manage which tags they follow. Your company will be listed as a sponsor directly alongside the tag you support. This placement provides visibility to all members, even if they don’t directly engage within your tag.