class DisplayFor::Builder::List
Public Instance Methods
build_actions(resource)
click to toggle source
# File lib/display_for/builder/list.rb, line 17 def build_actions(resource) result = [] @actions.each do |action| result << action.content(resource) end result.join(" ").html_safe end
build_row(resource)
click to toggle source
# File lib/display_for/builder/list.rb, line 5 def build_row(resource) result = '' @attributes.each do |attribute| result << content_tag(:span, attribute.content(resource), attribute.html_options) end result << content_tag(:span, build_actions(resource)) if @actions.any? options = {} options[:id] = "#{@resource_class}_#{resource.id}".underscore if resource content_tag(:li, result.html_safe, options) << "\n" end
to_s()
click to toggle source
# File lib/display_for/builder/list.rb, line 27 def to_s result = "\n".html_safe @collection.each do |resource| result << build_row(resource) end if @footer result << @footer.build_row(nil) end html_options[:class] ||= "list #{@resource_class.to_s.underscore}-list" content_tag(:ul, result, html_options).html_safe end