我尝试了一段时间使用 simple_form 创建下面的示例,但是 + 标签并修复了一些样式.任何人都知道如何解决:
Im trying for some time to use simple_form to create the below example but + the label and fixing some styling. Anyone knows how to fix:
删除 2 不知道它们来自哪里(在生产中似乎很奇怪的 i18n 错误,它会在其中抛出一大堆 I18n)在单选按钮后添加男性"或女性"文字 remove the 2's no idea where they come from (seems strange i18n bug on production it throws a whole bunch of I18n in ) Have the text Male or Female after the radio button是下面代码的结果:
.clear
= f.label "Gender"
= f.collection_radio_buttons(:gender, [['Male', 'icon_male'], ['Female', 'icon_female']],
:first, :last,
:item_wrapper_class => 'horizontal',
) do |gender|
= gender.label { image_tag("/assets/icons/16x16/#{gender.text}.png") + gender.radio_button }
.clear
.ruler
最终工作片段:
= f.label "Gender"
- f.collection_radio_buttons(:gender, [['Male', 'icon_male'], ['Female', 'icon_female']], :first, :last, :item_wrapper_class => 'horizontal') do |gender|
= gender.label { image_tag("/assets/icons/16x16/#{gender.text}.png") + gender.radio_button }
.clear
.ruler