Class: ActiveScaffold::Config::List::UserSettings
- Defined in:
- lib/active_scaffold/config/list.rb
Instance Attribute Summary collapse
-
#nested_default_sorting ⇒ Object
Returns the value of attribute nested_default_sorting.
Instance Method Summary collapse
- #count_includes ⇒ Object
- #default_sorting ⇒ Object
- #get_sorting ⇒ Object
-
#label ⇒ Object
This label has alread been localized.
- #page ⇒ Object
- #page=(value = nil) ⇒ Object
- #per_page ⇒ Object
- #sorting ⇒ Object
Instance Attribute Details
#nested_default_sorting ⇒ Object
Returns the value of attribute nested_default_sorting.
149 150 151 |
# File 'lib/active_scaffold/config/list.rb', line 149 def nested_default_sorting @nested_default_sorting end |
Instance Method Details
#count_includes ⇒ Object
178 179 180 |
# File 'lib/active_scaffold/config/list.rb', line 178 def count_includes @conf.count_includes end |
#default_sorting ⇒ Object
156 157 158 |
# File 'lib/active_scaffold/config/list.rb', line 156 def default_sorting nested_default_sorting.nil? ? @conf.sorting : nested_default_sorting end |
#get_sorting ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/active_scaffold/config/list.rb', line 164 def get_sorting # we want to store as little as possible in the session, but we want to return a Sorting data structure. so we recreate it each page load based on session data. @session['sort'] = [@params['sort'].to_sym, @params['sort_direction'] == 'DESC'] if @params['sort'] and @params['sort_direction'] @session['sort'] = nil if @params['sort_direction'] == 'reset' if @session['sort'] sorting = @conf.sorting.clone sorting.set(@session['sort'][1] ? @session['sort'][0].desc : @session['sort'][0]) return sorting else return default_sorting end end |
#label ⇒ Object
This label has alread been localized.
131 132 133 |
# File 'lib/active_scaffold/config/list.rb', line 131 def label @session[:label] ? @session[:label] : @conf.label end |
#page ⇒ Object
140 141 142 143 |
# File 'lib/active_scaffold/config/list.rb', line 140 def page @session['page'] = @params['page'] if @params.has_key? 'page' @session['page'] || 1 end |
#page=(value = nil) ⇒ Object
145 146 147 |
# File 'lib/active_scaffold/config/list.rb', line 145 def page=(value = nil) @session['page'] = value end |
#per_page ⇒ Object
135 136 137 138 |
# File 'lib/active_scaffold/config/list.rb', line 135 def per_page @session['per_page'] = @params['limit'].to_i if @params.has_key? 'limit' @session['per_page'] || @conf.per_page end |
#sorting ⇒ Object
160 161 162 |
# File 'lib/active_scaffold/config/list.rb', line 160 def sorting @sorting ||= get_sorting end |