diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-07-12 18:13:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-07-12 18:13:20 +0000 |
commit | 2a721fff4cec3d1e14c924566d0d1334152a3393 (patch) | |
tree | 666f8780bbcdc16c63c7da4d0ddb9fd0f3308d7c /app/models/query.rb | |
parent | ffea3d5ba3cea6a5f6b1d500ae5417fe158a4546 (diff) | |
download | redmine-2a721fff4cec3d1e14c924566d0d1334152a3393.tar.gz redmine-2a721fff4cec3d1e14c924566d0d1334152a3393.zip |
Set default configuration for the timelog list (#26356).
git-svn-id: http://svn.redmine.org/redmine/trunk@16814 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/query.rb')
-rw-r--r-- | app/models/query.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index c8c89860d..02e808eca 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -365,7 +365,7 @@ class Query < ActiveRecord::Base end # Builds the query from the given params - def build_from_params(params) + def build_from_params(params, defaults={}) if params[:fields] || params[:f] self.filters = {} add_filters(params[:fields] || params[:f], params[:operators] || params[:op], params[:values] || params[:v]) @@ -374,10 +374,12 @@ class Query < ActiveRecord::Base add_short_filter(field, params[field]) if params[field] end end - self.group_by = params[:group_by] || (params[:query] && params[:query][:group_by]) - self.column_names = params[:c] || (params[:query] && params[:query][:column_names]) - self.totalable_names = params[:t] || (params[:query] && params[:query][:totalable_names]) - self.sort_criteria = params[:sort] || (params[:query] && params[:query][:sort_criteria]) + + query_params = params[:query] || defaults || {} + self.group_by = params[:group_by] || query_params[:group_by] + self.column_names = params[:c] || query_params[:column_names] + self.totalable_names = params[:t] || query_params[:totalable_names] + self.sort_criteria = params[:sort] || query_params[:sort_criteria] self end |