class TaoUi::Components::Table::BaseBuilder

Attributes

expandable[R]
options[R]
selectable[R]
view[R]

Public Class Methods

new(view, options = {}) click to toggle source
# File lib/tao_ui/components/table/base_builder.rb, line 9
def initialize view, options = {}
  @view = view
  @options = options
  @expandable = options[:expandable].presence || false
  @selectable = options[:selectable].presence || false
end

Public Instance Methods

merge_options(options, other_options) click to toggle source
# File lib/tao_ui/components/table/base_builder.rb, line 16
def merge_options options, other_options
  options.merge(other_options) { |key, old_val, new_val|
    if key.to_s == 'class'
      old_val = old_val.split(' ') if old_val.is_a? String
      new_val = new_val.split(' ') if new_val.is_a? String
      Array(old_val) + Array(new_val)
    elsif old_val.is_a?(Hash) && old_val.is_a?(Hash)
      old_val.merge! new_val
    else
      new_val
    end
  }
end

Protected Instance Methods

expandable_td() click to toggle source
# File lib/tao_ui/components/table/base_builder.rb, line 42
def expandable_td
  @expandable_td ||= view.content_tag 'td', class: 'td-expand-icon' do
    view.tao_icon :arrow_right
  end
end
expandable_th() click to toggle source
# File lib/tao_ui/components/table/base_builder.rb, line 32
def expandable_th
  @expandable_th ||= view.content_tag 'th', nil, class: 'th-expand-icon'
end
selectable_td() click to toggle source
# File lib/tao_ui/components/table/base_builder.rb, line 48
def selectable_td
  @selectable_td ||= view.content_tag 'td', class: 'td-checkbox' do
    view.tao_check_box
  end
end
selectable_th() click to toggle source
# File lib/tao_ui/components/table/base_builder.rb, line 36
def selectable_th
  @selectable_th ||= view.content_tag 'th', class: 'th-checkbox' do
    view.tao_check_box
  end
end