class ActiveScaffold::Config::List

Attributes

always_show_create[W]

always show create

association_join_text[RW]

what string to use to join records from plural associations

count_includes[RW]

overwrite the includes used for the count sql query

empty_field_text[RW]

what string to use when a field is empty

filtered_message[W]
hide_nested_column[W]

if list view is nested hide nested_column

label[W]

the label for this List action. used for the header.

no_entries_message[W]
pagination[RW]

What kind of pagination to use:

  • true: The usual pagination

  • :infinite: Treat the source as having an infinite number of pages (i.e. don’t count the records; useful for large tables where counting is slow and we don’t really care anyway)

  • false: Disable pagination

per_page[RW]

how many rows to show at once

show_search_reset[RW]

show a link to reset the search next to filtered message

Public Class Methods

new(core_config) click to toggle source
Calls superclass method ActiveScaffold::Config::Base::new
# File lib/active_scaffold/config/list.rb, line 5
def initialize(core_config)
  super
  # inherit from global scope
  # full configuration path is: defaults => global table => local table
  @per_page = self.class.per_page
  @page_links_window = self.class.page_links_window
  
  # originates here
  @sorting = ActiveScaffold::DataStructures::Sorting.new(@core.columns)
  @sorting.set_default_sorting(@core.model)

  # inherit from global scope
  @empty_field_text = self.class.empty_field_text
  @association_join_text = self.class.association_join_text
  @pagination = self.class.pagination
  @show_search_reset = true
end

Public Instance Methods

always_show_create() click to toggle source
# File lib/active_scaffold/config/list.rb, line 119
def always_show_create
  @always_show_create && @core.actions.include?(:create)
end
columns() click to toggle source

provides access to the list of columns specifically meant for the Table to use

# File lib/active_scaffold/config/list.rb, line 52
def columns
  self.columns = @core.columns._inheritable unless @columns # lazy evaluation
  @columns
end
filtered_message() click to toggle source
# File lib/active_scaffold/config/list.rb, line 103
def filtered_message
  @filtered_message ? @filtered_message : :filtered
end
hide_nested_column() click to toggle source
# File lib/active_scaffold/config/list.rb, line 125
def hide_nested_column
  @hide_nested_column.nil? ? true : @hide_nested_column
end
label() click to toggle source
# File lib/active_scaffold/config/list.rb, line 93
def label
  @label ? as_(@label, :count => 2) : @core.label(:count => 2)
end
no_entries_message() click to toggle source
# File lib/active_scaffold/config/list.rb, line 98
def no_entries_message
  @no_entries_message ? @no_entries_message : :no_entries
end
search_partial() click to toggle source
# File lib/active_scaffold/config/list.rb, line 112
def search_partial
  return "search" if @core.actions.include?(:search)
  return "field_search" if @core.actions.include?(:field_search)
end
sorting() click to toggle source
# File lib/active_scaffold/config/list.rb, line 84
def sorting
  @sorting ||= ActiveScaffold::DataStructures::Sorting.new(@core.columns)
end
sorting=(val) click to toggle source

the default sorting. should be an array of hashes of {column_name => direction}, e.g. [{:a => ‘desc’}, {:b => ‘asc’}]. to just sort on one column, you can simply provide a hash, though, e.g. {:a => ‘desc’}.

# File lib/active_scaffold/config/list.rb, line 81
def sorting=(val)
  sorting.set(*val)
end