summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-14 18:18:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-14 18:18:19 +0000
commit8c7898bb5db0d29cd418eac3c6e27191cf3571ed (patch)
treeaae5c57d61644de3c1d3786192ce7e2069c23e13 /app/models
parentb878a427f2928e600ca51d03fc47637fa85cf859 (diff)
downloadredmine-8c7898bb5db0d29cd418eac3c6e27191cf3571ed.tar.gz
redmine-8c7898bb5db0d29cd418eac3c6e27191cf3571ed.zip
Let user choose columns and sort order of issue lists on "My page" (#1565).
git-svn-id: http://svn.redmine.org/redmine/trunk@16400 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/query.rb16
-rw-r--r--app/models/user_preference.rb1
2 files changed, 17 insertions, 0 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 192502024..23eca0278 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -386,6 +386,22 @@ class Query < ActiveRecord::Base
new(attributes).build_from_params(params)
end
+ def as_params
+ params = {}
+ filters.each do |field, options|
+ params[:f] ||= []
+ params[:f] << field
+ params[:op] ||= {}
+ params[:op][field] = options[:operator]
+ params[:v] ||= {}
+ params[:v][field] = options[:values]
+ end
+ params[:c] = column_names
+ params[:sort] = sort_criteria.to_param
+ params[:set_filter] = 1
+ params
+ end
+
def validate_query_filters
filters.each_key do |field|
if values_for(field)
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb
index 41c0f0b4b..0ebafa839 100644
--- a/app/models/user_preference.rb
+++ b/app/models/user_preference.rb
@@ -128,6 +128,7 @@ class UserPreference < ActiveRecord::Base
end
def update_block_settings(block, settings)
+ block = block.to_s
block_settings = my_page_settings(block).merge(settings.symbolize_keys)
my_page_settings[block] = block_settings
end