Class: ActiveScaffold::Config::List::UserSettings

Inherits:
UserSettings
  • Object
show all
Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb

Instance Method Summary collapse

Instance Method Details

#count_includesObject



137
138
139
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 137

def count_includes
  @conf.count_includes
end

#labelObject

This label has alread been localized.



105
106
107
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 105

def label
  @session[:label] ? @session[:label] : @conf.label
end

#pageObject



114
115
116
117
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 114

def page
  @session['page'] = @params['page'] if @params.has_key? 'page'
  @session['page'] || 1
end

#page=(value = nil) ⇒ Object



119
120
121
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 119

def page=(value = nil)
  @session['page'] = value
end

#per_pageObject



109
110
111
112
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 109

def per_page
  @session['per_page'] = @params['limit'].to_i if @params.has_key? 'limit'
  @session['per_page'] || @conf.per_page
end

#sortingObject



123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/config/list.rb', line 123

def 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'], @params['sort_direction']] 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'])
    return sorting
  else
    return @conf.sorting
  end
end