class TableSettings::Buttons

Public Class Methods

new() click to toggle source
# File lib/table_settings/table_button.rb, line 3
def initialize()
  @buttons_hash = {}
  @rows = {}
end

Public Instance Methods

add_button(row_id, label, url_path = nil) { |button| ... } click to toggle source
# File lib/table_settings/table_button.rb, line 26
def add_button(row_id, label, url_path = nil)
  row = @rows[row_id].nil? ? add_row(row_id) : @rows[row_id]

  button = row.add_button(label, url_path)

  yield(button) if block_given?

  button
end
add_row(row_id) { |row| ... } click to toggle source
# File lib/table_settings/table_button.rb, line 16
def add_row(row_id)
  row = TableSettings::Row.new(row_id)

  yield(row) if block_given?

  @rows[row_id] = row

  row
end
hash() click to toggle source
# File lib/table_settings/table_button.rb, line 8
def hash
  @rows.each_value do |row|
    @buttons_hash[row.id] = row.data
  end

  @buttons_hash
end
summarize_page_all_value(value) click to toggle source

Add summary value to whole column Have to set TableSettings::Column.summarize_all

# File lib/table_settings/table_button.rb, line 46
def summarize_page_all_value(value)
  @buttons_hash[:summarize_page_all] = value

  self
end
summarize_page_value(value) click to toggle source

Add summary value to page Have to set TableSettings::Column.summarize_page

# File lib/table_settings/table_button.rb, line 38
def summarize_page_value(value)
  @buttons_hash[:summarize_page_value] = value

  self
end