about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2022-11-12 10:09:41 -0600
committerStarfall <us@starfall.systems>2022-11-12 10:11:39 -0600
commitb07b6b9f339b604f9af150eb10ac1486eca8f189 (patch)
tree512943f7488b1fdb7d7c5d87cc039ea2f1886292 /config/initializers
parentb96b336a7871b5e88da8f308116e8f0ca7827132 (diff)
parent81b1d32d5b618daa4003b8de8292ae4dd3e656f6 (diff)
Merge remote-tracking branch 'glitch/main'
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/simple_form.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb
index 8ec642653..5e4763b7f 100644
--- a/config/initializers/simple_form.rb
+++ b/config/initializers/simple_form.rb
@@ -8,7 +8,16 @@ module AppendComponent
   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(GlitchOnlyComponent)
 
 SimpleForm.setup do |config|
   # Wrappers are used by the form builder to generate a
@@ -65,6 +74,7 @@ SimpleForm.setup do |config|
     b.use :html5
 
     b.wrapper tag: :div, class: :label_input do |ba|
+      ba.optional :glitch_only
       ba.use :label
 
       ba.wrapper tag: :div, class: :label_input__wrapper do |bb|