class ActiveScaffold::Config::List
Attributes
always show create
what string to use to join records from plural associations
Auto paginate, only can be used with pagination enabled
-
true: First page will be loaded on first request, next pages will be requested by AJAX until all items are loaded
-
false: Disable auto pagination
Enable auto select columns on list, so only columns needed for list columns are selected
Enable ETag calculation (when conditional_get_support is enabled), it requires to load records for page, when is disabled query can be avoided when page is cached in browser order clause will be used for ETag when calculate_etag
is disabled, so query for records can be avoided
overwrite the includes used for the count sql query
what string to use when a field is empty
filter human message you may show the user a humanized applied filters, not the default ones
the filters for this controller
if list view is nested hide nested_column
display messages above table header
how many page links around current page to show
how many page links around current page to show
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
how many rows to show at once
include list header on refresh
the ActionLink to reset the filters
the ActionLink to reset search
show a link to reset the filter next to filter human message
show a link to reset the search next to filtered message
wrap normal cells (not inplace editable columns or with link) with a tag it allows for more css styling
Public Class Methods
Source
# File lib/active_scaffold/config/list.rb, line 123 def self.filters ActiveScaffold::DataStructures::Filters end
Source
# 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 @filters = ActiveScaffold::DataStructures::Filters.new @page_links_inner_window = self.class.page_links_inner_window @page_links_outer_window = self.class.page_links_outer_window # originates here @sorting = ActiveScaffold::DataStructures::Sorting.new(@core.columns, @core.model) @sorting.set_default_sorting # inherit from global scope @empty_field_text = self.class.empty_field_text @association_join_text = self.class.association_join_text @pagination = self.class.pagination @auto_pagination = self.class.auto_pagination @show_search_reset = self.class.show_search_reset @show_filter_reset = self.class.show_filter_reset @filter_human_message = self.class.filter_human_message @reset_link = self.class.reset_link.clone @reset_filter_link = self.class.reset_filter_link.clone @wrap_tag = self.class.wrap_tag @always_show_search = self.class.always_show_search @always_show_create = self.class.always_show_create @messages_above_header = self.class.messages_above_header @auto_select_columns = self.class.auto_select_columns @refresh_with_header = self.class.refresh_with_header @calculate_etag = self.class.calculate_etag end
ActiveScaffold::Config::Base::new
Public Instance Methods
Source
# File lib/active_scaffold/config/list.rb, line 239 def always_show_create @always_show_create && @core.actions.include?(:create) end
Source
# File lib/active_scaffold/config/list.rb, line 216 def always_show_search @always_show_search && search_partial.present? end
Source
# File lib/active_scaffold/config/list.rb, line 228 def auto_search_partial if @core.actions.include?(:search) 'search' elsif @core.actions.include?(:field_search) 'field_search' end end
Source
# File lib/active_scaffold/config/list.rb, line 212 def filtered_message @filtered_message || :filtered end
Source
# File lib/active_scaffold/config/list.rb, line 246 def hide_nested_column @hide_nested_column.nil? ? true : @hide_nested_column end
Source
# File lib/active_scaffold/config/list.rb, line 202 def label @label ? as_(@label, count: 2) : @core.label(count: 2) end
Source
# File lib/active_scaffold/config/list.rb, line 208 def no_entries_message @no_entries_message || :no_entries end
Source
# File lib/active_scaffold/config/list.rb, line 220 def search_partial if @always_show_search == true auto_search_partial elsif @core.actions.include? @always_show_search @always_show_search.to_s end end
Source
# File lib/active_scaffold/config/list.rb, line 192 def sorting @sorting ||= ActiveScaffold::DataStructures::Sorting.new(@core.columns, @core.model) end
Source
# File lib/active_scaffold/config/list.rb, line 187 def sorting=(val) val = [val] if val.is_a? Hash sorting.set(*val) end
the default sorting. should be a hash of {column_name => direction}, e.g. {a: ‘desc’, b: ‘asc’}. for backwards compatibility, it may 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, e.g. {a: ‘desc’}.