simple_form 使用 <image>( X ) 标签与 twitter 引导程序渲染单选按钮组? [英] simple_form render radio button group with <image>( X ) Label with twitter bootstrap?

查看:17
本文介绍了simple_form 使用 <image>( X ) 标签与 twitter 引导程序渲染单选按钮组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了一段时间使用 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

这篇关于simple_form 使用 <image>( X ) 标签与 twitter 引导程序渲染单选按钮组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆