require_relative '../helpers/indented_grid' Voom::Presenters.define(:lists) do helpers Demo::Helpers::IndentedGrid attach :top_nav attach :component_drawer page_title 'Lists' helpers do def actors [OpenStruct.new(name: "Bryan Cranston", episodes: 62, body: 'Bryan Cranston played the role of Walter in Breaking Bad. He is also known for playing Hal in Malcom in the Middle.'), OpenStruct.new(name: "Aaron Paul", episodes: 62, body: 'Aaron Paul played the role of Jesse in Breaking Bad. He also featured in the "Need For Speed" Movie'), OpenStruct.new(name: "Bob Odenkirk", episodes: 62, body: 'Bob Odinkrik played the role of Saul in Breaking Bad. Due to public fondness for the character, Bob stars in his own show now, called "Better Call Saul".'), OpenStruct.new(name: "Giancarlo Esposito", episodes: 24, body: 'Giancarlo Giuseppe Alessandro Esposito played the role of Gustavo "Gus" Fring on the AMC shows Breaking Bad and Better Call Saul.')] end end indented_grid do headline 'Simple' list do actors.each do |actor| line do text actor.name end end end headline 'Simple with Separators' list do actors.each do |actor| line do text actor.name end separator unless actor == actors.last end end headline 'Simple with Selected' list do actors.each do |actor| line selected: actors.first == actor do text actor.name end end end headline 'Icons' list do actors.each do |actor| line do text actor.name icon :person end end end headline 'Avatars and actions' list do actors.each do |actor| line do text actor.name avatar :person actions do icon :star end end end end headline 'Avatars and controls' list do actors.each_with_index do |actor, index| line do text actor.name avatar :person actions do case index%4 when 0 checkbox when 1 radio_button when 2 switch when 3 icon_toggle :star end end end end end headline 'Two line' list do actors.each_with_index do |actor, index| line do text actor.name avatar :person info 'actor' if index == 0 actions do icon_toggle :star end subtitle "#{actor.episodes} episodes" end end end headline 'Selectable List' list selectable: true do actors.each do |actor| line do text actor.name avatar :person subtitle "#{actor.episodes} episodes" end end end attach :code, file: __FILE__ end end