0

構成を使用して simple_form をコンポーネントの異なる順序で存在させる方法はありますか?

SimpleFormは現在、次のように表示されます。label, input, errors, hint

私が欲しいlabel, input, hint, errors

4

1 に答える 1

2

css で管理できない場合は、ラッパーをビルド/編集することをお勧めします。


たとえば、デフォルトの simple_form ラッパー (/config/initializers/wrap_parameters.rb) では、b.use :hintb.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
于 2013-01-03T14:48:20.693 に答える