0
我在編輯用戶的個人資料頁面中的生日字段如圖所示,需要內嵌的日期,月份和年份選擇標籤
我希望以這種方式來顯示,水平
到目前爲止,我使用下面的代碼,
在參觀者/ edit.html.erb,
<%= simple_form_for([@user],:url => visitor_path(@user), method: :put, :class => 'form form-horizontal') do |f| %>
<%= f.label :birthday %>
<div class="form-group">
<div class="col-sm-2">
<%= birthday_field_for(f, end_year: Date.today.year) %>
</div>
</div>
<% end %>
在application_helper.rb,
def birthday_field_for(form,options={})
date_field_for(form,:birthday,options.reverse_merge!(start_year: Date.today.year - 90, end_year: Date.today.year - 13))
end
def date_field_for(form,field,options={})
form.date_select(field, options.reverse_merge!(order: [:day, :month, :year],
include_blank: true))
end
請幫助我的CSS。
u能張貼HTML和CSS u've – Aru
你的小提琴是容器可能太小。簡單形式日期輸入自然內聯 – jmore009
@Aru請檢查http://jsfiddle.net/cofa5hx8/。這裏有點好了。但不是在我的應用程序。 –