class Voom::Presenters::DSL::Components::List

Attributes

border[R]
color[R]
components[RW]
dense[R]
lines[R]
lines_only[R]
selectable[R]
total_lines[R]

Public Class Methods

new(**attribs_, &block) click to toggle source
# File lib/voom/presenters/dsl/components/list.rb, line 14
def initialize(**attribs_, &block)
  super(type: :list, **attribs_, &block)
  @color  = attribs.delete(:color) { nil }
  @border = attribs.delete(:border) { nil }

  @lines_only = attribs.delete(:lines_only) { false }
  @selectable = attribs.delete(:selectable) { false }
  @dense = attribs.delete(:dense) { false }
  @lines = []
  @components = []
  @total_lines = attribs.delete(:total_lines) || 0
  add_select_control!( attribs.fetch(:select_control_label) { 'Select All' } )
  expand!
end

Public Instance Methods

add_select_control!(text) click to toggle source
# File lib/voom/presenters/dsl/components/list.rb, line 29
def add_select_control!(text)
  return unless @selectable && !@lines_only
  @lines << Lists::Header.new(parent: self,
                              total_lines: @total_lines,
                              checkbox: {text: text, dirtyable: false})
end
line(text=nil, **attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/list.rb, line 36
def line(text=nil, **attribs, &block)
  @lines << Lists::Line.new(parent:self, text: text, selectable: selectable, **attribs, &block)
end
separator(**attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/list.rb, line 40
def separator(**attribs, &block)
  @lines << Lists::Separator.new(parent:self, **attribs, &block)
end