Class: ActiveScaffold::Config::List
- Defined in:
- lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb
Defined Under Namespace
Classes: UserSettings
Constant Summary collapse
- @@per_page =
15
- @@empty_field_text =
'-'
Instance Attribute Summary collapse
- #always_show_create ⇒ Object
- #always_show_search ⇒ Object
-
#count_includes ⇒ Object
overwrite the includes used for the count sql query.
-
#empty_field_text ⇒ Object
what string to use when a field is empty.
- #filtered_message ⇒ Object
- #label ⇒ Object
- #no_entries_message ⇒ Object
-
#per_page ⇒ Object
how many rows to show at once.
-
#show_search_reset ⇒ Object
AST show_search_reset.
Attributes inherited from Base
Instance Method Summary collapse
-
#columns ⇒ Object
provides access to the list of columns specifically meant for the Table to use.
- #columns=(val) ⇒ Object
-
#initialize(core_config) ⇒ List
constructor
A new instance of List.
- #search_partial ⇒ Object
- #sorting ⇒ Object
-
#sorting=(val) ⇒ Object
the default sorting.
Methods inherited from Base
#crud_type, #formats, #formats=, inherited
Methods included from ActiveScaffold::Configurable
Constructor Details
#initialize(core_config) ⇒ List
Returns a new instance of List.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 5 def initialize(core_config) @core = core_config # inherit from global scope # full configuration path is: defaults => global table => local table @per_page = self.class.per_page # AST show_search_reset @show_search_reset = true # 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 end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveScaffold::Configurable
Instance Attribute Details
#always_show_create ⇒ Object
99 100 101 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 99 def always_show_create @always_show_create && @core.actions.include?(:create) end |
#always_show_search ⇒ Object
84 85 86 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 84 def always_show_search @always_show_search && !search_partial.blank? end |
#count_includes ⇒ Object
overwrite the includes used for the count sql query
63 64 65 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 63 def count_includes @count_includes end |
#empty_field_text ⇒ Object
what string to use when a field is empty
50 51 52 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 50 def empty_field_text @empty_field_text end |
#filtered_message ⇒ Object
78 79 80 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 78 def @filtered_message ? as_(@filtered_message) : 'Filtered List' end |
#label ⇒ Object
67 68 69 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 67 def label @label ? as_(@label, :count => 2) : @core.label(:count => 2) end |
#no_entries_message ⇒ Object
73 74 75 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 73 def @no_entries_message ? as_(@no_entries_message) : 'No Entries' end |
#per_page ⇒ Object
how many rows to show at once
47 48 49 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 47 def per_page @per_page end |
#show_search_reset ⇒ Object
AST show_search_reset
89 90 91 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 89 def show_search_reset @show_search_reset end |
Instance Method Details
#columns ⇒ Object
provides access to the list of columns specifically meant for the Table to use
37 38 39 40 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 37 def columns self.columns = @core.columns._inheritable unless @columns # lazy evaluation @columns end |
#columns=(val) ⇒ Object
41 42 43 44 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 41 def columns=(val) @columns = ActiveScaffold::DataStructures::ActionColumns.new(*val) @columns.action = self end |
#search_partial ⇒ Object
91 92 93 94 95 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 91 def search_partial return "search" if @core.actions.include?(:search) return "live_search" if @core.actions.include?(:live_search) return "field_search" if @core.actions.include?(:field_search) end |
#sorting ⇒ Object
58 59 60 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 58 def sorting @sorting ||= ActiveScaffold::DataStructures::Sorting.new(@core.columns) end |
#sorting=(val) ⇒ Object
the default sorting. should be an array of hashes of => direction, e.g. [=> ‘desc’, => ‘asc’]. to just sort on one column, you can simply provide a hash, though, e.g. => ‘desc’.
53 54 55 56 57 |
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 53 def sorting=(val) val = [val] if val.is_a? Hash sorting.clear val.each { |clause| sorting.add *Array(clause).first } end |