我需要将自定义html添加到由simple_form生成的提示和错误元素。最好我想通过配置文件自定义它。生成的html看起来像这样
span.error
Some error message
理想的输出:
span.error
span.icon.alert
Some error message
答案 0 :(得分:0)
也许简单为.error类添加背景图片(警报图标)?
或尝试在config:
中附加包装器config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.wrapper :tag => 'div', :class => 'controls' do |ba|
ba.use :input
ba.wrapper :tag => 'div', :class => 'controls' do |input|
input.wrapper :tag => 'span', :class => 'error-append' do |append|
append.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
end
end
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
end
端