I'm using Ruby on Rails 3 to create a form for the user, where he can save his birthdate. All the actions around the controller and model work just fine. But I'm having trouble with the styling of this form.
For every select in my forms I wrap a div around it, to style it, which normally works just fine. The problem with date_select
is that it generates three select boxes which all get wrapped into one div. As example in Haml the code for the field looks like this:
.select-wrapper
= f.date_select :birthday, :start_year => Time.now.year - 120, :end_year => Time.now.year
The .select_wrapper
creates a div around all three select boxes but I need every select box to have it's own wrapper. Is there any way to solve this issue?
Any help would be appreciated. Thanks.
This is not the prettiest, but it worked well for me ...
<div class="small-4 columns"><%= f.date_select :release_date, {date_separator: "</div><div class='small-4 columns'>"} %></div>
Where <div class="small-4 columns"></div>
was what I wanted everything to be wrapped in. Basically just made sure that the date_separator was the closing of my tag and the opening of my next one, and made sure that the opening of my first tag was before the date_select and the closing of my last tag was after the date_select.
I am using a solution involving the parameter :date_separator
.
Something along the lines of this:
.select-wrapper
= f.date_select :birthday, :start_year => Time.now.year - 120, :end_year => Time.now.year, :date_separator => '</div><div class="select-wrapper">'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With