Reputation: 1247
Hopefully there is someone out there that can help me. I have made a helper method which is supposed to output a checkbox (which is either checked or not depending on the player), a picture of the player and the name of the player. Unfortunately the only thing that is outputted is the checkbox. I am just getting empty li's. here is the code:
def add_players_and_checkboxes(game_id,user)
boolean = 0
find_all_players(game_id).each do |p|
boolean = true if user.id == p.id
end
output = content_tag :div, :class => "span2" do
concat(content_tag :li, add_check_box(user,game_id,boolean))
concat(content_tag :li) do
concat(content_tag :ul) do
concat(content_tag :li) do
concat(image_tag(user.picture, :height => '50px',:alt => 'user_pic'), :class =>"picture")
end
concat(content_tag :li, user.first_name, :class => "name")
end
end
end
return output
Upvotes: 0
Views: 504
Reputation: 1247
output = content_tag :div, :class => "span2" do
content_tag(:li, add_check_box(user,game_id,boolean)) +
content_tag(:li) do
content_tag(:ul) do
content_tag(:li) do
image_tag user.picture, :height => '50px', :alt => 'user_pic', :class => "picture"
end +
content_tag(:li, user.first_name, :class => "name")
end
end
end
Upvotes: 2