所以我會正確地問。將simple_form集合導入到%ul?
這是從我的simple_form
= f.input :focus, collection: [[t('alg.focus.execution'), 'Execution'], [t('alg.focus.management'), 'Management'], [t('alg.focus.client'), 'Client'], [t('alg.focus.development'), 'Development']], :wrapper => :inline_checkbox, :include_blank => false, label: t('recruiter.jobs.new.focus')
輸入和在HTML輸出這
<div class="select required job_focus">
<select class="select required" name="job[focus]" id="job_focus">
<option value="Execution">Execuție</option>
<option value="Management">Management</option>
<option value="Client">Client</option>
<option value="Development">Dezvoltare</option></select></div>
現在我想要做的是改變選擇標籤爲UL和選項到li,這樣我可以自定義下拉菜單,因爲我想要的。
我在simple_form中找到了一種方法,您可以添加一個包裝類來標記或使用另一個標記而不是其他標記,但正如我所看到的僅限於某些標記,如輸入,標記,錯誤等。但我找不到如何更改選擇和選項。
加入此元素的輸入:wrapper => :inline_checkbox,
,並加入到這個simple_form.rb這個
config.wrappers :inline_checkbox, :error_class => 'error' do |b|
b.use :html5
b.use :input
b.use :label
b.wrapper :tag => 'div', :class => 'controls' do |ba|
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
end
end
所以我需要你的幫助。 提前致謝。
選擇是很難的風格。您可能正在尋找https://github.com/argerim/select2-rails –