about summary refs log tree commit diff
path: root/config
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-11-12 11:45:39 +0100
committerGitHub <noreply@github.com>2022-11-12 11:45:39 +0100
commit210341fba168533069f12172f61090ea45603778 (patch)
tree85940c4e0efe18e7b32866044aab9fd276c9effc /config
parentc813df2ebb0483236d95797d1bb840b48b95d290 (diff)
parentaf89b14628c648e95cc8a920f2ff886b9c61ffdf (diff)
Merge pull request #1918 from ClearlyClaire/glitch-soc/features/glitch-label
Add “Glitch-only” label to some settings
Diffstat (limited to 'config')
-rw-r--r--config/initializers/simple_form.rb10
-rw-r--r--config/locales-glitch/simple_form.en.yml2
2 files changed, 12 insertions, 0 deletions
diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb
index 92cffc5a2..d167a1600 100644
--- a/config/initializers/simple_form.rb
+++ b/config/initializers/simple_form.rb
@@ -19,8 +19,17 @@ module RecommendedComponent
   end
 end
 
+module GlitchOnlyComponent
+  def glitch_only(_wrapper_options = nil)
+    return unless options[:glitch_only]
+    options[:label_text] = ->(raw_label_text, _required_label_text, _label_present) { safe_join([raw_label_text, ' ', content_tag(:span, I18n.t('simple_form.glitch_only'), class: 'glitch_only')]) }
+    nil
+  end
+end
+
 SimpleForm.include_component(AppendComponent)
 SimpleForm.include_component(RecommendedComponent)
+SimpleForm.include_component(GlitchOnlyComponent)
 
 SimpleForm.setup do |config|
   # Wrappers are used by the form builder to generate a
@@ -78,6 +87,7 @@ SimpleForm.setup do |config|
 
     b.wrapper tag: :div, class: :label_input do |ba|
       ba.optional :recommended
+      ba.optional :glitch_only
       ba.use :label
 
       ba.wrapper tag: :div, class: :label_input__wrapper do |bb|
diff --git a/config/locales-glitch/simple_form.en.yml b/config/locales-glitch/simple_form.en.yml
index fd1c64bbb..c6e7d54ca 100644
--- a/config/locales-glitch/simple_form.en.yml
+++ b/config/locales-glitch/simple_form.en.yml
@@ -1,6 +1,7 @@
 ---
 en:
   simple_form:
+    glitch_only: glitch-soc
     hints:
       defaults:
         fields: You can have up to %{count} items displayed as a table on your profile
@@ -8,6 +9,7 @@ en:
         setting_default_content_type_markdown: When writing toots, assume they are using Markdown for rich text formatting, unless specified otherwise
         setting_default_content_type_plain: When writing toots, assume they are plain text with no special formatting, unless specified otherwise (default Mastodon behavior)
         setting_default_language: The language of your toots can be detected automatically, but it's not always accurate
+        setting_hide_followers_count: Hide your followers count from everybody, including you. Some applications may display a negative followers count.
         setting_skin: Reskins the selected Mastodon flavour
     labels:
       defaults: