module ActiveScaffold::Helpers::ShowColumnHelpers

Helpers that assist with the rendering of a List Column

Public Instance Methods

active_scaffold_show_text(column, record) click to toggle source
# File lib/active_scaffold/helpers/show_column_helpers.rb, line 29
def active_scaffold_show_text(column, record)
  simple_format(clean_column_value(record.send(column.name)))
end
override_show_column_ui(list_ui) click to toggle source

the naming convention for overriding show types with helpers

# File lib/active_scaffold/helpers/show_column_helpers.rb, line 38
def override_show_column_ui(list_ui)
  method = "active_scaffold_show_#{list_ui}"
  method if respond_to? method
end
show_column_override(column) click to toggle source
# File lib/active_scaffold/helpers/show_column_helpers.rb, line 33
def show_column_override(column)
  override_helper column, 'show_column'
end
show_column_value(record, column) click to toggle source
# File lib/active_scaffold/helpers/show_column_helpers.rb, line 5
def show_column_value(record, column)
  # check for an override helper
  if (method = show_column_override(column))
    # we only pass the record as the argument. we previously also passed the formatted_value,
    # but mike perham pointed out that prohibited the usage of overrides to improve on the
    # performance of our default formatting. see issue #138.
    if method(method).arity == 1
      ActiveSupport::Deprecation.warn("Add column argument to field override, signature is unified with list_ui")
      send(method, record)
    else
      send(method, record, column)
    end
  # second, check if the dev has specified a valid list_ui for this column
  elsif column.list_ui and (method = override_show_column_ui(column.list_ui))
    send(method, column, record)
  else
    if column.column and (method = override_show_column_ui(column.column.type))
      send(method, column, record)
    else
      get_column_value(record, column)
    end
  end
end