Add kmyblue mark in config page

This commit is contained in:
KMY 2023-05-11 11:16:53 +09:00
parent 424dc584a9
commit d1c625df7c
9 changed files with 34 additions and 11 deletions

View file

@ -19,8 +19,20 @@ module RecommendedComponent
end
end
module KmyblueComponent
def kmyblue(_wrapper_options = nil)
return unless options[:kmyblue]
key = options[:kmyblue].is_a?(Symbol) ? options[:kmyblue] : :kmyblue
options[:label_text] = ->(raw_label_text, _required_label_text, _label_present) { safe_join([raw_label_text, ' ', content_tag(:span, I18n.t(key, scope: 'simple_form'), class: key)]) }
nil
end
end
SimpleForm.include_component(AppendComponent)
SimpleForm.include_component(RecommendedComponent)
SimpleForm.include_component(KmyblueComponent)
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
@ -78,6 +90,7 @@ SimpleForm.setup do |config|
b.wrapper tag: :div, class: :label_input do |ba|
ba.optional :recommended
ba.optional :kmyblue
ba.use :label
ba.wrapper tag: :div, class: :label_input__wrapper do |bb|