Split checkbox_tag into two or three columns

11 views
Skip to first unread message

John Sanderbeck

unread,
Mar 5, 2016, 10:44:36 AM3/5/16
to rubyonra...@googlegroups.com
What I have is a list of audience types attending a training, and I
would like to split the list of checked items into two or three columns
instead of having one long list with checkboxes.

Here is my current code which works fine however it is presented in one
long list that you need to scroll down to see it all.

Is this even possible, and if it is, is it proper to do this having
mobile access in mind?

<tr>
<th>Audience:</th>
<td>
<ul>
<% @audiences.each do |audience| -%>
<li>
<%= check_box_tag('training[audience_ids][]', audience.id,
@training.audience_ids.include?(audience.id)) %>
<%= audience.name %>
</li>
<% end -%>
</ul>
</td>
</tr>

John

--
Posted via http://www.ruby-forum.com/.

Hassan Schroeder

unread,
Mar 5, 2016, 2:02:06 PM3/5/16
to rubyonrails-talk
On Sat, Mar 5, 2016 at 7:44 AM, John Sanderbeck <li...@ruby-forum.com> wrote:
> What I have is a list of audience types attending a training, and I
> would like to split the list of checked items into two or three columns
> instead of having one long list with checkboxes.

> Is this even possible, and if it is, is it proper to do this having
> mobile access in mind?

Not a Rails question but --

I'd probably use the CSS3 column-* attributes with appropriate
breakpoints for smaller devices.

HTH,
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote

John Sanderbeck

unread,
Mar 5, 2016, 5:32:12 PM3/5/16
to rubyonra...@googlegroups.com
I never thought about CSS3... Thank you!!
Reply all
Reply to author
Forward
0 new messages