構成を使用して simple_form をコンポーネントの異なる順序で存在させる方法はありますか?
SimpleFormは現在、次のように表示されます。label, input, errors, hint
私が欲しい:label, input, hint, errors
構成を使用して simple_form をコンポーネントの異なる順序で存在させる方法はありますか?
SimpleFormは現在、次のように表示されます。label, input, errors, hint
私が欲しい:label, input, hint, errors
css で管理できない場合は、ラッパーをビルド/編集することをお勧めします。
たとえば、デフォルトの simple_form ラッパー (/config/initializers/wrap_parameters.rb) では、b.use :hint
とb.use :error
行の順序を入れ替えました。
config.wrappers :default, :class => :input,
:hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
...
## Inputs
b.use :label_input
b.use :error, :wrap_with => { :tag => :span, :class => :error }
b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
end